Is there anyway to design multiple buttons at once? I have 9 buttons and I don't wanna design it 1 by 1. Is there anyway to do this? I am good even the can be the same. And also what I wanna do is, in my JPanel, is there anyway to add multiple buttons at once? like panel.add(b1,b2,b3,...)
I tried:
for (int i = 0; i < 9; i++) {
JButton btn = null;
switch (i) {
case 0:
btn = b1;
break;
case 1:
btn = b2;
}
//And btn is up to b9 and i is up to 8
btn.setBackground(Color.black);
btn.setBorderPainted(false);
}