• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adjust alignment of button in gridlayout?  RSS feed

 
Bob Zoloman
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, is it possible to change the horizontal alignment of a button or label in a gridlayout? I have a form with 2 labels, 2 textfields, and 1 button.

Here's the layout:
X = label
Y = TextField
Z = Button

X Y
X Y
Z

How can I get Z to be under Y? Thanks in advance.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add an empty label prior to adding Z
 
Bob Zoloman
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So for that kind of layout you can't use SwingConstants.Right or some other method for aligning?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you're not aligning anything.

you have 6 compartments/cells, 3 x 2.
they fill up left to right then top to bottom.

so, to get something into cell 5 (0-based),
you first have to put something in the prior 0 to 4

[edit] had 2 x 3
[ August 29, 2006: Message edited by: Michael Dunn ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!