• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Adjust alignment of button in gridlayout?  RSS feed

 
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.
 
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!