Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

MigLayout, vertical alignment problem  RSS feed

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • 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
  • 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]
 
Nate Lockwood
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • 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...)
 
m Korbel
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(there are two) MigLayout has notifier for a new row
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!