| Author |
layout manager
|
mani senthil
Greenhorn
Joined: Jan 18, 2007
Posts: 17
|
|
|
Which layout manager is best to pace the controls over a window as our wish? That is by mentioning X, Y position.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
|
|
The whole idea of a layout manager is that you don't enter the x, y coordinates of a component in a container. that is called "absolute positioning" or the "null layout." Find any decent book and read about layout managers (eg C Horstmann, G Cornell, Core Java 2 vol 1: fundamentals, Santa Clara: Sun Microsystems Press (Prentice-Hall) (2004), page 345ff, 424ff). The advantages of a manager over null positioning, according to Horstmann and Cornell are:-It is easier to alter the size of components to match their contents.Components do not "fall off" the edge of the container when it is resized."If you insist on using absolute positioning, try:-. . . or similar. I would suggest you read Horstmann, understand their GBC class (see page 433 or here, and use GridBag. But it is the most awkward manager to learn.
|
 |
Ricky Clarkson
Ranch Hand
Joined: Jul 27, 2006
Posts: 131
|
|
There are some disadvantages to using null layout rather than an actual written AbsoluteLayout, or XYLayout. I think I'm starting to favour allowing absolute positioning, on YAGNI grounds.
|
 |
 |
|
|
subject: layout manager
|
|
|