aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Converting from null Layout to Layouts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Converting from null Layout to Layouts" Watch "Converting from null Layout to Layouts" New topic
Author

Converting from null Layout to Layouts

Anurag Deepak
Greenhorn

Joined: Jun 16, 2003
Posts: 4
I have made a project using setLayout(null) and added the components using setBounds.
Now the requirement is that we have to use Layouts, so that the program runs in various resolutions (800x600) and (1024x768), which is not possible using hard bound values.
How can I do this ?
When I use scrollPane to add a table,and add it without using setSize, then it takes the whole window.
Is there any other way to write a GUI SWING application which is independent of the screen resolution?
Johanna Sousa
Greenhorn

Joined: Jul 18, 2003
Posts: 2
Hi.
I'm a little curious about why you opted not to use a layout manager if you don't mind me asking.
- Johanna
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

For general information on how to use different layout managers, check out the Swing Tutorial.

As for the table taking up the whole frame... use the setPreferredScrollableViewportSize( Dimension ) method of JTable to set the size you want the scrollpane to be.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
I feel your pain, I've read the Swing Tutorial and I still don't have a clue how to design a UI that looks good, even a simple form, using the layout managers.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Converting from null Layout to Layouts