I'm trying to resize JButton to always be a certain size. I have 9 of these buttons. I understand from the API that it JButton inherits setSize(int a, int b) and setSize(Dimension d). I opted to use the second though I tried the other and it didn't fix my problem. Here is the code.
// setup buttons
reset = new JButton("Reset");
square1 = new JButton();
square2 = new JButton();
square3 = new JButton();
square4 = new JButton();
square5 = new JButton();
square6 = new JButton();
square7 = new JButton();
square8 = new JButton();
square9 = new JButton();
//set button size
Dimension d = new Dimension(100,100);
square1.setSize(d);
square2.setSize(d);
square3.setSize(d);
square4.setSize(d);
square5.setSize(d);
square6.setSize(d);
square7.setSize(d);
square8.setSize(d);
square9.setSize(d);
I've tried several diferent dimensions and none of them make any difference. What am I missing? I'm using a gridLayout(3,3,5,5) for the the JPanel that the buttons are on. The dimensions for the JFrame are (400,425). Thanks for any help!