PDA

Click to See Complete Forum and Search --> : Stop Objects from Resizing in Swing?


The Hobo
Oct 20th, 2004, 02:34 PM
I'm working on the following swing GUI for a project:

What I want to do is make it so the "Simulation Options" don't resize at all, but just stay the same size and don't move when the whole frame is resized. How can I accomplish this?

The "Simulation Options" is a JPanel with a GridLayout.

Dillinger4
Oct 20th, 2004, 06:08 PM
Sounds like you want the layout manager to honor the components preferred size. Normally when you don't want a component to stretch out when its container is resized you can add it to a panel then add the panel to a the container. JPanels use the flowlayout manager which does not ignore the componets preferred size as GridLayout does.

The Hobo
Oct 21st, 2004, 01:17 PM
Not sure I follow. :confused:

Dillinger4
Oct 21st, 2004, 04:04 PM
Sorry i was assuming that you had a component inside the JPanel that you didnt want resized with the JFrame was resized. Why not keep the frame from being resized in the first place?

debbie_82
Oct 26th, 2004, 11:28 AM
well u could use absolute positioning of the components.. if u don't want the components to be resized... if it does no include moving of components also.

debbie_82
Oct 26th, 2004, 11:32 AM
Originally posted by The Hobo
I'm working on the following swing GUI for a project:

What I want to do is make it so the "Simulation Options" don't resize at all, but just stay the same size and don't move when the whole frame is resized. How can I accomplish this?

The "Simulation Options" is a JPanel with a GridLayout.

oops I didn't read that one... gridLayout hmmm.

why don't u use SpringLayout then? on the part of the buttons that is.