Meaningless Drivel is fun!
The moose likes Swing / AWT / SWT and the fly likes Resizing Layout with change in Screen Resolution Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Resizing Layout with change in Screen Resolution" Watch "Resizing Layout with change in Screen Resolution" New topic

Resizing Layout with change in Screen Resolution

Sandeep Ramachandran

Joined: Jun 30, 2008
Posts: 3
Hi all,

I am programming a Swing application. The entire gui of the application is divided into 9 equal sized panels arranged in 3 rows and 3 columns. Now some panels have tabbed panes and some have some buttons (JButtons). Now the screen resolution of my laptop is 1280x800 pixels. I am using layout managers to layout these panels and the objects inside them. I am using borderlayout and flowlayout predominantly. Now under the above mentioned screen layout everything is fine to look. but when I connect my laptop to a projector to show my GUI to others in a conference, the projector has a lower resolution, so the entire layout is mixed up. In particular the tabbed panes and buttons. I have given some lengthy names as heading of the tabbed panes and so instead of displaying linearly ( one after other ), they overlap. The button are of different sizes and are put in a panel with flowlayout. So the buttons in the right most side of the panel disappear under low resolution. What should I do. I dont mind if the names of the buttons and tabbed panes ends with "......", for example - I have a button called "Create/Modify". The button totally disappears under low resolution.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46326
Sounds like something which would sit better in the Swing Forum.

There are methods in the Toolkit class (you have to use the static getDefaultToolkit method first) which supply screen resolution and screen size, which you can use to resize your display. But you will never get a pretty display with FlowLayout. There are lots of layouts, but some people say to look for MigLayout as the best available.
I agree. Here's the link:
subject: Resizing Layout with change in Screen Resolution
jQuery in Action, 3rd edition