Customer ArrayList Class amending Specific Element in Java -
how change specific variable @ specific point in custom arraylist? have created arraylist class , need adjust variable within list, cannot seem figure how achieve it. have searched answer nothing seems specific problem.
the code super class is:
public class parcel extends jpanel { protected int idnum; protected double charge; protected char zone; protected imageicon i; protected static arraylist<parcel> parcellist; protected static parcellist newparcel = new parcellist(); public parcel(int id, char z) { this.idnum = id; this.zone = z; }
and code list is...
public class parcellist extends parcel { parcellist() { parcellist = new arraylist<parcel>(); } public void addbox(int id, char z, int w, int l, int h) { parcellist.add(new box(id,z,w,l,h)); }
what looking change imageicon example, change imageicon of 5th element in list of list contains many different instances of box differing images. , removing element.
is possible current way have set code up?
never minding seems redundancy in code, 1 way use newparcel.get(index)
, modify box
using setter methods, newparcel.set(index, newbox)
Comments
Post a Comment