java - creating arrays of Jbuttons in windowbuilder -
is there anyway make arrays of j buttons in eclipse. want use window builder there anyway this?? program kinda needs use array cause have use loops , cant if buttons of different variable names. found tutorials there manually done. want use windowbuilder create same output of jbuttons
can provide tutorials or videos on how can achieve this? thank you
have code far.
public class sungka_gui extends jframe { public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { try { sungka_gui frame = new sungka_gui(); frame.setvisible(true); } catch (exception e) { e.printstacktrace(); } } }); } /** * create frame. */ public sungka_gui() { setresizable(false); seticonimage(toolkit.getdefaulttoolkit().getimage(sungka_gui.class.getresource("/com/sun/java/swing/plaf/windows/icons/javacup32.png"))); settitle("sungka"); setdefaultcloseoperation(jframe.exit_on_close); setbounds(100, 100, 675, 370); getcontentpane().setlayout(null); jlabel frame = new jlabel(""); frame.setbounds(0, -13, 669, 354); image img = new imageicon(this.getclass().getresource("/wood3.png")).getimage(); frame.seticon(new imageicon(img)); getcontentpane().add(frame); } }
extend jpanel class, create loop creates , initializes (adds them jpanel, initializes event listeners etc...) collection of buttons created, add getter collection. in window builder add jpanel , later in code change jpanel class of element class extending jpanel.
Comments
Post a Comment