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...
1 Antwort
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);