Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Layout Managers and docking

Status
Not open for further replies.

Cabaal

Programmer
Aug 28, 2001
9
US
What is the best choice for a layout manager given the following scenario?
I have a program that should open one main window. In this case it is a content pane. The main window should then contain smallers sub-windows (JInternalFrame) and allow the user to move them around as they see fit. Each JInternalFrame should be run as a thread to allow data to be updated simultaneously. There must also be some default layout that has each frame docked in a certain location. Any suggestions are appreciated.
 
hmmm, not so sure about this one, but i shall relay what I know. It is fine to have a contentpane, but you will need to add a JDesktopPane, or some other DefaultDesktopManager to your content pane in order to utilise JInternalFrames - i think layout managers and JDesktopPane are going to be mutually exclusive in this case.

You don't need a layout manager anyhow, the JDesktopPane automatically handles the manipulation (on screen) of the internal frames e.g. resizing, iconify and drag/drop etc. The default location for the frames to appear is set to top left.

My only suggestion is that you investigate the setBoundsForFrame(JComponent component, int Xposition, int Yposition,int width,int height) method of the DesktopManager ineterface, which appears to allow you to specify the component (such as a JInternalFrame) to display on the desktop and its subsequent size and position details.

Hope this has helped.
 
Here is a better description of what I want to accomplish:
An application that contains many frames. Each frame can be Viewed or not viewed based on user preference. If a user removes a frame, the other frame should expand to fill the void. If a new frame is added, the others should accomodate and contract to allow room. This is very similar to a modular program. Something like Photoshop.
However, I will look into your suggestions. The setBoundsForFrame sounds interesting. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top