Skip to main content

A bug, which must be fixed in Mustang?

3 replies [Last post]
theuserbl
Offline
Joined: 2004-05-04

Have a look at this little example code:
http://www.theuserbl.ag.vu/BoxLayoutDemo2.java

In the latest Java1.6 it looks like this:
http://www.theuserbl.ag.vu/layout1.png

In Java 1.4 it looks like
http://www.theuserbl.ag.vu/layout2.png

And with an JVM which used GNU Classpath it looks like
http://www.theuserbl.ag.vu/layout3.png

For me the result of the GNU Classpath (http://www.classpath.org) version makes much more sense.

Which implementation have now the bug? Suns implementation of Java or GNUs implementation?
I am not sure. But the GNUs version makes more sense.

The
b1.setAlignmentX(Component.LEFT_ALIGNMENT);
creates on GNUs implemenation a Button on the left side. On Suns impl. it is on the right side. But not completly on the right side.

The
b2.setAlignmentX(Component.CENTER_ALIGNMENT);
creates on GNUs impl. a Button on in the middle. On Suns impl. it is not in the middle.

The
b3.setAlignmentX(Component.RIGHT_ALIGNMENT);
creates on GNUs impl. a Button on the right side. But on Suns impl. it ios on the left side. But not completely on the left.

Greatings
theuserbl

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
zander
Offline
Joined: 2003-06-13

I agree that there is a bug, but its in the documentation since it takes a very specific mindset to understand Suns javadoc in such a way to understand why the result shown is created.

Maybe someone can file a bug for SUN stating that the documentation is insufficient.

mthornton
Offline
Joined: 2003-06-10

> ... it takes a very specific mindset

A knowledge of TeX certainly helps, specifically its box model.

mthornton
Offline
Joined: 2003-06-10

The Sun layout looks correct to me.

b1.setAlignmentX(Component.LEFT_ALIGNMENT);
b2.setAlignmentX(Component.CENTER_ALIGNMENT);

This requests that the left side of b1 is aligned with the center of b2.

b3.setAlignmentX(
Component.RIGHT_ALIGNMENT);

which is then aligned with the right hand side of b3. Similarly for b4 and b5.
The result is not wide enough to fill the window, so extra space is added on both sides.