0

How to code multiple checkboxes at once in jframe(java) ? IDE is netbeans.

Actually am making a software for a cinema and to select seats i am using checkboxes. So now I have to code multiple checkboxes with same code. So plz tell if there is any shorter way to do it...

22nd Mar 2019, 8:48 AM
Sam
Sam - avatar
1 ответ
0
You can use loop for example Set 7 as max: JCeckBox[] boxes = new JCeckBox[7]; Loop through the boxes: for(int i = 0; < 7; i++){ boxes[i] = new JCheckBox(); frame.add(boxes[i]); } And if you gonna use for example FlowLayout: frame.setLayout(new FlowLayout(FlowLayout.LEFT);
22nd Mar 2019, 10:44 AM
JavaBobbo
JavaBobbo - avatar