Solved

swing gui layout issues - any help or advice?

Posted on 2006-07-03
8
235 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 300 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 200 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

739 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