[英]Which LayoutManager should I use?
Please see the image attached. 请参阅附图。 I'm a beginner at Java GUI and was hoping someone could guide me in choosing a Layout Manager for GUI like this.
我是Java GUI的初学者,希望有人可以指导我选择这样的GUI布局管理器。 I know I might have to use nested layoutmanagers, but I'm not sure which would help me accomplish this job.
我知道我可能不得不使用嵌套布局管理器,但我不确定哪个可以帮助我完成这项工作。
Here's an idea: 这是一个想法:
Alternatively: you could use a 7x2 GridLayout and fill the two positions above the buttons with empty text fields, to separate the labels/fields above from the buttons below. 或者:您可以使用7x2 GridLayout并使用空文本字段填充按钮上方的两个位置,以将上面的标签/字段与下面的按钮分开。
check out DesignGridLayout , it will be perfectly suited for this form I think 看看DesignGridLayout ,我觉得它非常适合这种形式
just look at their example: 看看他们的例子:
with just a few lines of clean code: 只需几行干净的代码:
layout.row().grid(label("Last Name")) .add(lastNameField) .grid(label("First Name")) .add(firstNameField);
layout.row().grid(label("Phone")) .add(phoneField) .grid(label("Email")) .add(emailField);
layout.row().grid(label("Address 1")) .add(address1Field);
layout.row().grid(label("Address 2")) .add(address2Field);
layout.row().grid(label("City"), 1) .add(cityField);
layout.row().grid(label("State")) .add(stateField) .grid(label("Postal Code")) .add(postalField);
layout.row().grid(label("Country"), 1) .add(countryField);
layout.emptyRow();
layout.row().center().add(newButton).add(deleteButton).add(editButton).add(saveButton).add(cancelButton);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.