java - Adding a JPanel Array to a Container -
look @ last line of code, add jpanel array container. alot guys or gals!
code:
private jframe b = new jframe("lotus"); private jlabel currentp = new jlabel(); private int currents; private container pieces = new container(); private jbutton exitt = new jbutton("exit"); private imageicon b1=new imageicon("c:\\users\\brusty\\downloads\\p1.jpg"); private imageicon b2=new imageicon("c:\\users\\brusty\\downloads\\p2.jpg"); linkedlist<stack<integer>> spotlist = new linkedlist<stack<integer>>(); //creation of gamepiece labels public void labels(){ jlabel[] labelsp1 = new jlabel[10]; jlabel[] labelsp2 = new jlabel[10]; for(int = 0 ; < labelsp1.length ; i++){ labelsp1[i] = new jlabel(b1); for(int j = 0 ; j < labelsp2.length ; j++){ labelsp2[j] = new jlabel(b2); } container c = b.getcontentpane(); c.setlayout(new gridlayout(13,3)); c.add(pieces); pieces.add(labelsp1);
not sure see problem. need loop through labelsp1
array , add labels...
for (jlabel label : labelsp1) { pieces.add(label); }
Comments
Post a Comment