
Signature
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Well,
How can I put the label at an absolute position?
Don Quichotte
Qu?bec wrote:
> Should not this put the label at an absolute position?
No. GridBagConstraints' gridx and gridy fields are not pixel offsets;
they are positions within the grid. It makes little sense for you to
put your label in column number 'absheight - 30'.

Signature
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Andrew Thompson - 17 Mar 2004 18:35 GMT
On Wed, 17 Mar 2004 11:48:01 -0500, Québec wrote:
> How can I put the label at an absolute position?
I think you should understand first,
why you should generally _not_ do that..
<http://groups.google.com/groups?th=e12ea8c6daf7eb65>
Note particularly Q 3. of the top 5.

Signature
Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology
Chris Smith - 17 Mar 2004 19:13 GMT
Québec wrote:
> How can I put the label at an absolute position?
There are two ways to control the placement of your components.
The best way to control the positioning of your components is to write a
LayoutManager class. See the API docs on that class for more details.
The LayoutManager gets called whenever the positioning of components
needs to change (for example, the window was resized or some component
has asked to redo the layout because its preferred or minimum size has
changed). Once you've got your layout manager, set it on the container
using "setLayout(myLayout)", and you're all set.
As for writing the layout manager itself, you just need to pay attention
to factors such as:
1. How big does each component want to be? ("getPreferredSize()")
2. How big does each component need to be? ("getMinimumSize()")
3. How big is the container? ("getWidth()" and "getHeight()")
4. Of course, how you want to lay them out.
This gives you precise control over things like the relative positions
of components that is often elusive when using standard layout managers.
Fully absolute positioning is possible too, of course, but since it
ignores three of the four factors above, it creates very sloppy
interfaces that look rather unprofessional when used anywhere except
where you developed them.

Signature
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation