aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How add comp to frame so x,y pos and height never changes, width does adjust? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How add comp to frame so x,y pos and height never changes, width does adjust?" Watch "How add comp to frame so x,y pos and height never changes, width does adjust?" New topic
Author

How add comp to frame so x,y pos and height never changes, width does adjust?

Robert Paris
Ranch Hand

Joined: Jul 28, 2002
Posts: 585
I want to have a component at the top of a frame that never moves from the 0,0 position and it's height is always 20px tall. The component should get wider when the frame is expanded. Also, whatever components are below this one (on the frame) should expand as normal (i.e. relatively). Does anyone know how I would achieve this?
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Use a JPanel with BorderLayout, add the top component to BorderLayout.NORTH, and the rest to another JPanel at BorderLayout.CENTER.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How add comp to frame so x,y pos and height never changes, width does adjust?