• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MigLayout, vertical alignment problem

 
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I wonder, if say the previous row has a JLabel and JTextField of certain size, and next to them there are a
JLabel and a second JTextField, say B
And the next row will not necessarily be the same size as the previous row, say there are a JLabel and a JComboBox there
and next to them are another JLabel and JTextField D
so B and D are not necessarily aligned,
How can I make B and D aligned
Like this

Thanks
Jack

miglayout.jpg
[Thumbnail for miglayout.jpg]
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is another test
With this one, I can't align the leftmost labels, and btw, how do you make a label
next to the very last created text field aligned to the second label of the first row?

The next picture is the wanted layout, I want the combo box in the second row to be longer than
the second text field of the first row, but stops at the middle of the third textfield

Update:
I have solved the second question myself, by putting a split2 in the LastName field



miglayout-another-shot.jpg
[Thumbnail for miglayout-another-shot.jpg]
wanted-layout.png
[Thumbnail for wanted-layout.png]
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put each component in a cell. It appears that you have two rows of 10 or so cells. Here's what I did to line up some buttons.


The above example creates three rows each with two buttons and is grouped by the row. You can specify the width with "width 50:50:50" etc.
(Now if I could figure out why, in a different app, a row of buttons does not center vertically in the container...)
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(there are two) MigLayout has notifier for a new row
reply
    Bookmark Topic Watch Topic
  • New Topic