posted 19 years ago
About the app — 'setSize' is not so useful for resizing components in swing. 'setPreferredSize' works much better in swing and, as of j2se 1.5, is now also a Component (AWT) method. It is a luxury in gui work.
I added some things to your app as a way of exploring these validation and sizing options. 'Button 1' works with 'setPreferredSize' and 'Button 2' with 'setSize'. Observe that the 'setSize' method changes the size but not the location of button2.