Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

swing gui layout issues - any help or advice?

Posted on 2006-07-03
8
Medium Priority
?
256 Views
Last Modified: 2010-03-31
Hi,

I'm currently writing a swing gui, which requires the following characteristics:

- a menu bar at the top of the frame
- 3 panels, with the top panel the largest of the three panels, the middle panel a set height, and the bottom panel large enough to fit a textfield and 2 buttons
- resizeable, and maintain the predefined size proportions for each panel

Which layout manager is best to use to achieve the above characteristics?

Any advice or help is appreciated.

Thanks
0
Comment
Question by:nhay59
  • 5
  • 2
8 Comments
 
LVL 24

Expert Comment

by:sciuriware
ID: 17032104
BorderLayout.

;JOOP!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 17032116
The menu is attached to the mainframe and independent of the layout.

Put the 3 panels at Notrh, Centre and South resp.

;JOOP!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 17032120
North of course.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:nhay59
ID: 17032197
Hi,

Thanks for the reply. Is it possible to define set sizes for the panels, in order to stop the center panel from being the largest one?

Whenever I've used BorderLayout before, the North and South panels have been big enough to fit all the components and the center panel has simply filled all the remaining space. I need the top/North panel to be the largest, in order to fit images that are chosen from the open item within the menu bar.

Thanks for the help.
0
 
LVL 24

Accepted Solution

by:
sciuriware earned 1200 total points
ID: 17032939
You could put a (vertical) split panel in the centre and put the first 2 panels in there.
I never did it, but I read somewhere that the split panel keeps the proportions.

;JOOP!
0
 
LVL 92

Assisted Solution

by:objects
objects earned 800 total points
ID: 17033870
you'd need two BorderLayout Panels

the first would contain:
   - the top panel in CENTER
   - add second panel in SOUTH

the second would contain:
   - middel panel at NORTH
   - bottom panel at SOUTH

And set the height of the middle panel use setPreferredSzie()
0
 

Author Comment

by:nhay59
ID: 17037886
Hi,

Thanks for the replies. I've managed to get it to work with a combination of both possible answers. I put the main image viewing panel as Center within a BorderLayout, and used a split pane for the bottom two panels, with a position as South in a BorderLayout.

Thanks for the help.
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 17040273
Great! :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question