Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SWING components adjustment in different resolutions  RSS feed

 
Blue tears
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create a fairly complex GUI using any IDE at 800x600 resolutions and then I need the GUI to adjust itself on 1024X768 and high resolutions. If I reduce the resolution, it should show Scrollbars.
In otherwords, i need a layout which is expanding but should not shrink from a certain level and show scrollbars instead.
Currently I am using JBuilder X to create the GUI with null layout and use scrollbars when the resolution is reduced but when the resolution is increased it shows empty space on right side.
Questions
1. Which layout to use to do that?
2. What is the best IDE to speed up such process and set the components with the recommended layout
3. If I use Gridbag layout, which is not easy to set for complex GUIs, how will I show scrollbars when the resolutions is reduced from 800x600

P.s. I have seen JGoodies forms and its layout, but could not find a good IDE to work with it.

Regards
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is me just talking off the top of my head.

I have been trying to do a similar thing but I ended up just resizing the screen and forgetting about the scroll bars.

What I was thinking to do though was to have the contents of the frame in a JScrollPane (or similar) and then listen for resize events on the frame and set the scrollPane's bars accordingly.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Blue tears,

Welcome to Javaranch. We don't have too many rules around here but we do have a Naming Policy. Please read this policy and adjust your display name.

Thanks a bunch.
 
Don Kiddick
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. FlowLayout, BoxLayout, GridLayout, BoxLayout and GridBagLayout do it for me. You can get away with just using GridBagLayout if you desire, but I try to use the other, simpler ones when possible.
2. I recommend you only use an IDE for prototyping, if at all (I do not). Using an IDE means that you will learn swing more slowly and the code produced will tend to be ugly and more difficult to edit by hand.
3. Use whatever layouts you like. Just make sure the top most component is within a JScrollPane, et voila !
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!