JToggleButton position shift in Java 1.4.2

C

Cyril Mrazek

I noticed that the JCheckBox and JRadionButton are drawn two pixels more to the right in Java 1.4.2 than in the previous versions. I found that by setting setMargin(new Insets(0,-2,0,0)) I can correct this in a compatible way with respect to the previous version 1.4.1, but that means editing the existing sources and recompiling, and I don't like setting insets with negative values anyway. Is there a better solution or have I missed some fundamental change in the rendering ?

Cyril Mrazek, Switzerland
 
A

Andrew Thompson

Cyril Mrazek said:
I noticed that the JCheckBox and JRadionButton
are drawn two pixels more to the right in Java 1.4.2
than in the previous versions.

Use the appropriate layout managers and you probably
would _not_ have noticed..
I found that by setting setMargin(new Insets(0,-2,0,0))
I can correct this in a compatible way with respect to the
previous version 1.4.1,

What do you plan to do for the 1.4.3, 1.4.4, 1.5....?
(whatever..)
..but that means editing the existing sources and recompiling,
and I don't like setting insets with negative values anyway.
Is there a better solution or have I missed some
fundamental change in the rendering ?

Use the most appropriate layout managers provided,
(or, in rare instances, write your own) and let your
UI lay itself out.

There are better things to be doing than counting pixels.
 
C

Cyril Mrazek

Use the appropriate layout managers and you probably
would _not_ have noticed..

This is often a good solution, but in a complicated GUI, where place
is scarce, the null LayoutManager and setBounds combination might be
easier, though more riscy, I agree, to construct than a complicated
GridBag. However, I am surprised that the anchor points of certain
elements have been changed, IMHO it is close to a bug, the setBounds
_is_not_ an illegal operation.

What do you plan to do for the 1.4.3, 1.4.4, 1.5....?
(whatever..)

Yes, that's why I posted my original question, I _know_ that my
workaround is very bad.

Use the most appropriate layout managers provided,
(or, in rare instances, write your own) and let your
UI lay itself out.

There are better things to be doing than counting pixels.

The human eye has some hard-wired functions for registering vertical
and horizontal lines, groups of items .... A GUI is more intuitive,
more easy to read and understand, if it complies with these features.
There might be cases, where a misfortunate positionning of a control
can make the GUI harder to use. On the other hand, an agreeable
aesthetic feeling of using a nice GUI can help in stress situations.
We are, after all, creating tools for people who use them every day,
in this respect they are not different from other objects of everyday
use (cups, knives, chairs, cars, the pants you wear ...).

Cyril Mrazek, Switzerland
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top