Home arrow static arrow Java Programming [Archive] - Resizable components.
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Resizable components.
This topic has 3 replies on 1 page.

Posts:27
Registered: 5/24/04
Resizable components.  
Jun 23, 2004 4:59 AM



 
I use GridBagLayout, when I put components to the Frame, then resize it,
componentsdo are not resize...

How to make them resizable ?

here is part of my code..

JTextArea txaArea = new JTextArea();
txaArea.setPreferredSize(new Dimension(170,170));
pPanel = new JPanel()
pPanel.add(txaArea,
new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));

Thanks!
 

Posts:10,972
Registered: 10/23/03
Re: Resizable components.  
Jun 23, 2004 5:10 AM (reply 1 of 3)



 
Remind me again where you set any container's LayoutManager to be GridBagLayout.
 

Posts:27
Registered: 5/24/04
Re: Resizable components.  
Jun 23, 2004 5:14 AM (reply 2 of 3)



 
Here is more code..

GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();

// Setting up layout for panels
pPanel.setLayout(gridbag);

pPanel.add(txaArea,
new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));

 

Posts:945
Registered: 3/13/02
Re: Resizable components.  
Jun 23, 2004 5:18 AM (reply 3 of 3)



 
Read up on the weightx, weighty, and fill parameters of the GridlBagConstraints
 
This topic has 3 replies on 1 page.