Results 1 to 3 of 3
Thread: LayoutManager Best Choice
- 11-10-2010, 01:55 AM #1
Member
- Join Date
- Mar 2010
- Location
- Hilton Head, SC
- Posts
- 34
- Rep Power
- 0
LayoutManager Best Choice
I'm not all that familiar with the different layout managers right now so I'm hoping someone can point out the best manager for my situation:
I have 3 areas that will be on the form:
-- JEditorPane (1)
-- JPanel (2)
-- JLabel (3)
They are arranged as follows:
-----------------------
|###|############|
|###|############|
| (2) |####(1)######|
|###|############|
|###|############|
|____|_______________|
|________(3)_________|
The JLabel is at the bottom of the form and is 20 pixels high and as wide as the form.
The JPanel is 50 pixels wide and as tall as the form, minus the 20 pixels for the JLabel.
The JEditorPane is as wide as the form allows (but of course right next to the JPanel) and as wide as the form will allow.
Right now I just wrote a component listener that detects resizing and does everything for me but if you have ever quickly resized a form that is using this method, you get a nasty black area before the items resize themselves correctly.
If you know of a layout manager that will allow me to do all of this or a way to remove the nasty black area when using a component listener, I would appreciate your response.
-
You usually use a combination of layout managers, but in your example above, mostly BorderLayout. But why guess at what they do? The tutorials show you visually what they do. Please have a look.
-
For instance, this simple GUI has a JPanel that uses GridBagLayout for the JLabels and JTextFields in the upper left corner, a JPanel that uses FlowLayout for the buttons below this, a JPanel that uses BoxLayout to hold the GridBagLayout JPanel and the FlowLayout JButton panel, and a JPanel that uses BorderLayout to hold the BoxLayout JPanel on the left and a JEditPane in the Center section.
Similar Threads
-
Changing buttonsizes in layoutmanager
By frederic202 in forum AWT / SwingReplies: 2Last Post: 03-23-2010, 06:08 PM -
What layoutmanager is suitable for forms.
By Somelauw in forum AWT / SwingReplies: 9Last Post: 12-05-2009, 01:04 PM -
Syntax for choice box(combo box)
By NickkicN in forum New To JavaReplies: 2Last Post: 08-14-2008, 10:26 PM -
Need help with T/F and Multiple Choice
By sayso36 in forum Advanced JavaReplies: 0Last Post: 03-12-2008, 04:39 PM -
Using java.awt.Choice
By Java Tip in forum Java TipReplies: 0Last Post: 01-02-2008, 06:33 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks