wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes Could someone explain why the BorderLayout Manger is only limited to 5 panels? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Could someone explain why the BorderLayout Manger is only limited to 5 panels?" Watch "Could someone explain why the BorderLayout Manger is only limited to 5 panels?" New topic
Author

Could someone explain why the BorderLayout Manger is only limited to 5 panels?

kenny gill
Ranch Hand

Joined: Mar 12, 2012
Posts: 54

I'm trying to solve a short answer on why the manager can only handle 5 panels(without including putting panels inside of panels).

I've tried looking at this link but I couldn't find any information as to why it is limited to 5 panels:

http://docs.oracle.com/javase/1.4.2/docs/api/java/awt/BorderLayout.html
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

It's limited to five panels because that's the way it's laid out. One panel in the centre, one at each side, that makes five.
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4339
    
    7

It's a remarkably flexible layout manager. Full width components at the top and bottom using their preferred height, full (remaining) height components on either side using their preferred width, and the rest.

You can, of course, define a layout behaviour that has more panels. But that would be a different layout. There's nothing stopping people writing one (and many have), but it doesn't make a BorderLayout less useful.

(The only layout manager I've ever written myself that I actually found useful was an "inverse border layout". A centred component of it's own preferred size, and then components filling the spaces round the edges. it came in handy for interfaces with two lists of the same size with some buttons in the middle for transferring between them).
 
wood burning stoves
 
subject: Could someone explain why the BorderLayout Manger is only limited to 5 panels?
 
Similar Threads
Out of memory
How to detect FocusLost on JPanel
Is this Console reading Code poor?
Would someone please help me figure how many panels one BorderLayout Manager can handle?
Layout