> Hi. I have a GUI with a JPanel to which I have added
> 43 JButtons. I use a for loop to add the buttons but I
> cannot set the size of individual buttons. I want two
> of the buttons to be bigger than the rest. Can anyone
> please help me
As some else has mentioned, much depends on your
layout manager. You be able to do the job with
GridBagLayout, but if that's too much like hard
work, you can always turn the panel's layout manager off
and manually place & size each of your buttons.
setLayout( null );
and for each button:
button.setBounds( x, y, width, height );
If you do this, the buttons won't move or expand
when the panel is resized. I reckon that's not
a bad thing for buttons anyway.