aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes BoxLayout quirk Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "BoxLayout quirk" Watch "BoxLayout quirk" New topic
Author

BoxLayout quirk

Eric Larsen
Ranch Hand

Joined: Mar 28, 2009
Posts: 35
Why does my my JLabel appear all the way on the right-hand side of my GUI?

The source code for the class:



Attached is a screenshot of the GUI output.




[Thumbnail for Wessenger_screen.JPG]

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
add these lines

usernamePane.setAlignmentX(0);
passwordPane.setAlignmentX(0);
buttonPane.setAlignmentX(0);

comment out this line
//buttonPane.add(Box.createHorizontalGlue());

and they'll all be left-aligned
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: BoxLayout quirk