This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes why  JTextField gets expanded when i maximize the JFrame window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "why  JTextField gets expanded when i maximize the JFrame window" Watch "why  JTextField gets expanded when i maximize the JFrame window" New topic
Author

why JTextField gets expanded when i maximize the JFrame window

great veera
Greenhorn

Joined: May 14, 2001
Posts: 24
Hi all
Can anyone tell how to nullify this effect of JTextField or any other component getting maximized when i maximize the JFrame window.
TIA
GV
vinod ac
Greenhorn

Joined: Jul 08, 2001
Posts: 9
Hi Gr8
Try using setBounds() method with null layout
Container c = getContentPane();
c.setLayout(null);
(JTextField object).setBounds(5,5,100,25);
c.add(JtextField Object)
k ? got it ???
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Or, add it to a JPanel, and then add the JPanel to the frame...

frames have a default BorderLayout layout manager, and Panels have a default FlowLayout. BorderLayout resizes the middle part of the layout, FlowLayout just sticks on a component with it's preferred size.

If you purposefully set the layout manager to null as listed above you can use setBounds() to specify the size and location off all your GUI elements. However, they will not be resized or moved if the window changes size.

You can read more about layout managers here.

-Nate

P.S. - Is your name really Great?
[This message has been edited by Nathan Pruett (edited July 17, 2001).]


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
great veera
Greenhorn

Joined: May 14, 2001
Posts: 24
Hi vinod,nathan
Thanks for helping me out,
Nathan my name is not great my name is the second part of this username Veera
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why JTextField gets expanded when i maximize the JFrame window
 
Similar Threads
i was made some mistake in gridbaglayout so pls help me
Resize Problem
Components aren't seen in Frame/JFrame
Maximize JFrame on run
flow layout