Results 1 to 2 of 2
Thread: button not resizing in awt
- 08-17-2010, 01:23 PM #1
Member
- Join Date
- May 2010
- Posts
- 32
- Rep Power
- 0
button not resizing in awt
Hi
I am adding a button to a panel with GridBagLayout
I resize it using a Dimension object:
Dimension dim = new Dimension(30,10);
Button myButton = new Button();
neither myButton.setSize(dim);
nor myButton.setPreferredSize(dim);
are working.... Not sure what else to do :mad:
- 08-17-2010, 03:43 PM #2
Member
- Join Date
- Jun 2010
- Posts
- 28
- Rep Power
- 0
After you change the preferred size of an awt component you need to call invalidate() on it, and then call validate() on the frame containing the component.
In swing this done automatically for you with a single revalidate() call. Although, technically swing doesn't travel all the way up to the frame to call validate(). It travels up to the the first component that returns true for JComponent#isValidateRoot.
Similar Threads
-
panel resizing
By simo_mon in forum AWT / SwingReplies: 1Last Post: 08-15-2009, 02:09 PM -
JFrame resizing
By carderne in forum New To JavaReplies: 3Last Post: 07-22-2009, 07:42 PM -
panel resizing
By kumar_gemi in forum New To JavaReplies: 3Last Post: 03-13-2009, 02:51 AM -
Image Resizing and DPi
By Rob_ in forum Java AppletsReplies: 4Last Post: 11-27-2008, 02:21 PM -
Image resizing
By alley in forum Java 2DReplies: 2Last Post: 11-13-2007, 10:10 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks