本文整理汇总了Java中com.jgoodies.forms.builder.PanelBuilder.build方法的典型用法代码示例。如果您正苦于以下问题:Java PanelBuilder.build方法的具体用法?Java PanelBuilder.build怎么用?Java PanelBuilder.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jgoodies.forms.builder.PanelBuilder
的用法示例。
在下文中一共展示了PanelBuilder.build方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ParamEditorElem
import com.jgoodies.forms.builder.PanelBuilder; //导入方法依赖的package包/类
/**
* Create a {@link VirtualDevice virtual device} display element.
*
* @param group - the product group
*/
public ParamEditorElem(ProductGroup group)
{
this.group = group;
FormLayout layout = new FormLayout("6dlu, l:p, 3dlu, f:p:g, 6dlu",
"8dlu, p, 6dlu, f:p:g, 3dlu, f:p:g, 3dlu");
PanelBuilder builder = new PanelBuilder(layout);
CellConstraints cc = new CellConstraints();
JLabel lbl;
int row = 2;
lbl = builder.addLabel(I18n.getMessage("ParamEditorTester.caption"), cc.rcw(row, 2, 3));
lbl.setFont(FontUtils.getCaptionFont());
lbl.setOpaque(false);
row = 4;
pagesList.setCellRenderer(new ParameterListCellRenderer());
builder.add(new JScrollPane(pagesList), cc.rc(row, 2));
detailsPanel = builder.build();
updateContents();
}
示例2: buildGroupedButtonBar
import com.jgoodies.forms.builder.PanelBuilder; //导入方法依赖的package包/类
/**
* Builds and returns a button bar that consists of the given buttons.
* Aims to build a focus group via the {@code FocusTraversalUtils},
* if in the class path.
*
* @return the built panel
*/
private static JComponent buildGroupedButtonBar(AbstractButton... buttons) {
checkArgument(buttons.length > 1, "You must provide more than one button.");
FormLayout layout = new FormLayout(
String.format("pref, %s*($rgap, pref)", buttons.length - 1),
"p");
PanelBuilder builder = new PanelBuilder(layout);
int column = 1;
for (AbstractButton button : buttons) {
builder.add(button, CC.xy(column, 1));
column += 2;
}
FocusTraversalUtilsAccessor.tryToBuildAFocusGroup(buttons);
return builder.build();
}
示例3: buildGroupedButtonStack
import com.jgoodies.forms.builder.PanelBuilder; //导入方法依赖的package包/类
/**
* Builds and returns a button bar that consists of the given buttons.
* Aims to build a focus group via the {@code FocusTraversalUtils},
* if in the class path.
*
* @return the built panel
*/
private static JComponent buildGroupedButtonStack(AbstractButton... buttons) {
checkArgument(buttons.length > 1, "You must provide more than one button.");
FormLayout layout = new FormLayout(
"pref",
String.format("p, %s*(0, p)", buttons.length - 1));
PanelBuilder builder = new PanelBuilder(layout);
int row = 1;
for (AbstractButton button : buttons) {
builder.add(button, CC.xy(1, row));
row += 2;
}
FocusTraversalUtilsAccessor.tryToBuildAFocusGroup(buttons);
return builder.build();
}
示例4: LanguagesElem
import com.jgoodies.forms.builder.PanelBuilder; //导入方法依赖的package包/类
/**
* Create a {@link Language languages} display element.
*/
public LanguagesElem()
{
FormLayout layout = new FormLayout("6dlu, left:pref, 4dlu, fill:pref:grow, 6dlu",
"8dlu, pref, 8dlu, pref, 4dlu, pref, 4dlu, pref, fill:pref:grow, pref, 4dlu");
PanelBuilder builder = new PanelBuilder(layout);
CellConstraints cc = new CellConstraints();
builder.addLabel(I18n.getMessage("LanguagesElem.caption"), cc.rcw(2, 2, 3))
.setFont(FontUtils.getCaptionFont());
builder.addLabel(I18n.getMessage("LanguagesElem.id"), cc.rc(4, 2));
builder.add(idField, cc.rc(4, 4));
ValidationComponentUtils.setMandatoryBackground(idField);
builder.addLabel(I18n.getMessage("LanguagesElem.name"), cc.rc(6, 2));
builder.add(nameField, cc.rc(6, 4));
ValidationComponentUtils.setMandatoryBackground(nameField);
builder.addLabel(I18n.getMessage("LanguagesElem.etsId"), cc.rc(8, 2));
etsIdField = BasicComponentFactory.createLabel(new ConverterValueModel(validationHandler.getModel("id"), etsIdValueConverter));
builder.add(etsIdField, cc.rc(8, 4));
builder.add(Box.createVerticalGlue(), cc.rcw(9, 2, 3));
JComponent reportPane = ValidationResultViewFactory.createReportList(validationHandler.getValidationResultModel());
builder.add(reportPane, cc.rcw(10, 2, 3));
detailsPanel = builder.build();
validationHandler.setValidatedContainer(detailsPanel);
validationHandler.observeSelectionChange(selectionInList);
ProdEdit.getInstance().getProjectService().addListener(projectListener);
setupToolBar();
}
示例5: horizontal
import com.jgoodies.forms.builder.PanelBuilder; //导入方法依赖的package包/类
/**
* Builds and returns a panel where the given components are laid out
* horizontally separated by gaps as described by the given
* FormLayout gap (column) specification.
* <blockquote><pre>
* Forms.horizontal("4dlu", component1, component2);
* Forms.horizontal("$rgap", component1, component2, component3);
* Forms.horizontal("0", component1, component2, component3);
* </pre></blockquote>
*
* @param gapColSpec describes the horizontal gap between the components
* @param components the components to be laid out
* @return the built panel
* @throws NullPointerException if {@code components} is {@code null}
* @throws IllegalArgumentException if {@code components} is empty
*/
public static JComponent horizontal(String gapColSpec, JComponent... components) {
checkNotBlank(gapColSpec, MUST_NOT_BE_BLANK, "gap column specification");
checkNotNull(components, MUST_NOT_BE_NULL, "component array");
checkArgument(components.length > 1, "You must provide more than one component.");
FormLayout layout = new FormLayout(
components.length - 1 + "*(pref, " + gapColSpec + "), pref",
"p");
PanelBuilder builder = new PanelBuilder(layout);
int column = 1;
for (JComponent component : components) {
builder.add(component, CC.xy(column, 1));
column += 2;
}
return builder.build();
}
示例6: vertical
import com.jgoodies.forms.builder.PanelBuilder; //导入方法依赖的package包/类
/**
* Builds and returns a panel where the given components are laid out
* vertically separated by gaps as described by the given
* FormLayout gap (row) specification.
* <blockquote><pre>
* Forms.vertical("4dlu", component1, component2);
* Forms.vertical("$rgap", component1, component2, component3);
* Forms.vertical("0", component1, component2, component3);
* </pre></blockquote>
*
* @param gapRowSpec describes the vertical gap between the components
* @param components the components to be laid out
* @return the built panel
* @throws NullPointerException if {@code components} is {@code null}
* @throws IllegalArgumentException if {@code components} is empty
*/
public static JComponent vertical(String gapRowSpec, JComponent... components) {
checkNotBlank(gapRowSpec, MUST_NOT_BE_BLANK, "gap row specification");
checkNotNull(components, MUST_NOT_BE_NULL, "component array");
checkArgument(components.length > 1, "You must provide more than one component.");
FormLayout layout = new FormLayout(
"pref",
components.length - 1 + "*(p, " + gapRowSpec + "), p");
PanelBuilder builder = new PanelBuilder(layout);
int row = 1;
for (JComponent component : components) {
builder.add(component, CC.xy(1, row));
row += 2;
}
return builder.build();
}
示例7: ProductGroupsElem
import com.jgoodies.forms.builder.PanelBuilder; //导入方法依赖的package包/类
/**
* Create a product groups display element.
*/
public ProductGroupsElem()
{
FormLayout layout = new FormLayout("6dlu, left:pref, 4dlu, fill:pref:grow, 6dlu",
"8dlu, pref, 8dlu, pref, 4dlu, pref, 4dlu, pref, 4dlu, pref, 1dlu, pref, fill:pref:grow, pref, 4dlu");
PanelBuilder builder = new PanelBuilder(layout);
CellConstraints cc = new CellConstraints();
int row = 2;
builder.addLabel(I18n.getMessage("ProductGroupsElem.caption"), cc.rcw(row, 2, 3)).setFont(
FontUtils.getCaptionFont());
row += 2;
builder.addLabel(I18n.getMessage("ProductGroupsElem.id"), cc.rc(row, 2));
builder.add(idField, cc.rc(row, 4));
row += 2;
builder.addLabel(I18n.getMessage("ProductGroupsElem.name"), cc.rc(row, 2));
builder.add(nameField, cc.rc(row, 4));
row += 2;
builder.addLabel(I18n.getMessage("ProductGroupsElem.manufacturer"), cc.rc(row, 2));
builder.add(manufacturerField, cc.rc(row, 4));
row += 2;
builder.addLabel(I18n.getMessage("ProductGroupsElem.description"), cc.rcw(row, 2, 3));
row += 2;
builder.add(descArea, cc.rcw(row, 2, 3));
descArea.setRows(5);
builder.add(Box.createVerticalGlue(), cc.rcw(++row, 2, 3));
JComponent reportPane = ValidationResultViewFactory
.createReportList(validationHandler.getValidationResultModel());
builder.add(reportPane, cc.rcw(++row, 2, 3));
detailsPanel = builder.build();
prodGroupsList.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
ProductGroup group = selectionInList.getSelection();
if (group != null && e.getClickCount() == 2)
{
ProdEdit.getInstance().showProductGroupTab(group);
}
}
});
validationHandler.setValidatedContainer(detailsPanel);
validationHandler.observeSelectionChange(selectionInList);
ProdEdit.getInstance().getProjectService().addListener(projectListener);
setupToolBar();
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
prodGroupsList.setSelectedIndex(0);
}
});
}
示例8: ApplicationProgramElem
import com.jgoodies.forms.builder.PanelBuilder; //导入方法依赖的package包/类
/**
* Create a {@link VirtualDevice virtual device} display element.
*
* @param group - the product group
*/
public ApplicationProgramElem(final ProductGroup group)
{
this.group = group;
FormLayout layout = new FormLayout("6dlu, l:p, 4dlu, f:p:g, 6dlu",
"8dlu, p, 6dlu, p, 4dlu, p, 4dlu, p, 4dlu, p, " +
"4dlu, p, 4dlu, p, 4dlu, p, 4dlu, p, 4dlu, p, " +
"4dlu, " +
"f:p:g, p, 4dlu");
PanelBuilder builder = new PanelBuilder(layout);
CellConstraints cc = new CellConstraints();
int row = 2;
builder.addLabel(I18n.getMessage("ApplicationProgramElem.caption"), cc.rcw(row, 2, 3))
.setFont(FontUtils.getCaptionFont());
idField.setHorizontalAlignment(SwingConstants.RIGHT);
idField.setOpaque(false);
builder.add(idField, cc.rc(row, 4));
row = 4;
builder.addLabel(I18n.getMessage("ApplicationProgramElem.name"), cc.rc(row, 2));
builder.add(nameField, cc.rc(row, 4));
row = 6;
builder.addLabel(I18n.getMessage("ApplicationProgramElem.version"), cc.rc(row, 2));
builder.add(versionValueField, cc.rc(row, 4));
row = 8;
builder.addLabel(I18n.getMessage("ApplicationProgramElem.deviceType"), cc.rc(row, 2));
builder.add(deviceTypeField, cc.rc(row, 4));
row = 21;
builder.add(Box.createVerticalGlue(), cc.rcw(row, 2, 3));
row = 23;
JComponent reportPane = ValidationResultViewFactory.createReportList(validationHandler.getValidationResultModel());
builder.add(reportPane, cc.rcw(++row, 2, 3));
detailsPanel = builder.build();
validationHandler.setValidatedContainer(detailsPanel);
updateContents();
}
示例9: VirtualDeviceElem
import com.jgoodies.forms.builder.PanelBuilder; //导入方法依赖的package包/类
/**
* Create a {@link VirtualDevice virtual device} display element.
*
* @param group - the product group
* @param selectionInList - the selection in list of the virtual devices
*/
public VirtualDeviceElem(ProductGroup group, SelectionInList<VirtualDevice> selectionInList)
{
this.group = group;
this.selectionInList = selectionInList;
PresentationModel<VirtualDevice> detailsModel = new PresentationModel<VirtualDevice>(selectionInList);
validationHandler = new ListValidationHandler<VirtualDevice>(detailsModel, validator);
ConverterValueModel nameValueModel = new ConverterValueModel(validationHandler.getModel("name"), nameSyncConverter);
nameField = BasicComponentFactory.createTextField(nameValueModel, false);
idField = BasicComponentFactory.createLabel(detailsModel.getModel("idStr"));
descArea = BasicComponentFactory.createTextArea(detailsModel.getModel("description"), false);
numberField = BasicComponentFactory.createIntegerField(detailsModel.getModel("number"), 0);
FormLayout layout = new FormLayout("6dlu,l:p,4dlu,f:p:g,6dlu",
"8dlu,p,8dlu,p,4dlu,p,p,4dlu,p,4dlu,p,4dlu,p,4dlu,p,4dlu,p,4dlu,p,4dlu,f:p:g,p,4dlu");
PanelBuilder builder = new PanelBuilder(layout);
CellConstraints cc = new CellConstraints();
int row = 2;
builder.addLabel(I18n.getMessage("VirtualDeviceElem.caption"), cc.rcw(row, 2, 3))
.setFont(FontUtils.getCaptionFont());
row += 2;
builder.addLabel(I18n.getMessage("VirtualDeviceElem.name"), cc.rc(row, 2));
builder.add(nameField, cc.rc(row, 4));
ValidationComponentUtils.setMandatoryBackground(nameField);
row += 2;
builder.addLabel(I18n.getMessage("VirtualDeviceElem.description"), cc.rcw(row, 2, 3));
builder.add(descArea, cc.rcw(++row, 2, 3));
descArea.setRows(5);
row += 2;
builder.addLabel(I18n.getMessage("VirtualDeviceElem.number"), cc.rc(row, 2));
builder.add(numberField, cc.rc(row, 4));
row += 2;
builder.addLabel(I18n.getMessage("VirtualDeviceElem.productType"), cc.rc(row, 2));
// builder.add(productTypeField, cc.rc(row, 4));
row += 2;
builder.addLabel(I18n.getMessage("VirtualDeviceElem.catalogEntry"), cc.rc(row, 2));
builder.add(catalogEntryCombo, cc.rc(row, 4));
row += 2;
builder.addLabel(I18n.getMessage("VirtualDeviceElem.functionalEntity"), cc.rc(row, 2));
builder.add(functionalEntityCombo, cc.rc(row, 4));
row += 2;
builder.addLabel(I18n.getMessage("VirtualDeviceElem.id"), cc.rc(row, 2));
builder.add(idField, cc.rc(row, 4));
builder.add(Box.createVerticalGlue(), cc.rcw(++row, 2, 3));
JComponent reportPane = ValidationResultViewFactory.createReportList(validationHandler.getValidationResultModel());
builder.add(reportPane, cc.rcw(++row, 2, 3));
detailsPanel = builder.build();
validationHandler.setValidatedContainer(detailsPanel);
validationHandler.observeSelectionChange(selectionInList);
// ProdEdit.getInstance().getProjectService().addListener(projectListener);
setupToolBar();
updateContents();
}
示例10: ParameterTypesElem
import com.jgoodies.forms.builder.PanelBuilder; //导入方法依赖的package包/类
/**
* Create a {@link Product products} display element.
*
* @param group - the products group to display.
*/
public ParameterTypesElem(ProductGroup group)
{
this.group = group;
listScrollPane = new JScrollPane(paramTypeList);
toolBar = new JToolBar();
atomicTypeCombo.setRenderer(new ParameterAtomicTypeComboBoxRenderer(atomicTypeCombo.getRenderer()));
idField.setHorizontalAlignment(SwingConstants.RIGHT);
FormLayout layout = new FormLayout("6dlu, l:p, 4dlu, f:p:g, 4dlu, l:p, 4dlu, f:p:g, 6dlu",
"8dlu, p, 8dlu, p, 4dlu, p, 4dlu, p, 4dlu, p," +
"8dlu, p, 4dlu, f:p:g, 4dlu, fill:min:grow, 4dlu");
PanelBuilder builder = new PanelBuilder(layout);
CellConstraints cc = new CellConstraints();
int row = 2;
builder.addLabel(I18n.getMessage("ParameterTypesElem.caption"), cc.rcw(2, 2, 7))
.setFont(FontUtils.getCaptionFont());
row = 4;
builder.addLabel(I18n.getMessage("ParameterTypesElem.name"), cc.rc(row, 2));
builder.add(nameField, cc.rcw(row, 4, 3));
ValidationComponentUtils.setMandatoryBackground(nameField);
builder.add(idField, cc.rc(row, 8));
row = 6;
builder.addLabel(I18n.getMessage("ParameterTypesElem.type"), cc.rc(row, 2));
builder.add(atomicTypeCombo, cc.rcw(row, 4, 3));
row = 8;
builder.addLabel(I18n.getMessage("ParameterTypesElem.size"), cc.rc(row, 2));
builder.add(sizeField, cc.rc(row, 4));
builder.addLabel(I18n.getMessage("ParameterTypesElem.sizeUnit"), cc.rcw(row, 6, 3));
row = 10;
builder.addLabel(I18n.getMessage("ParameterTypesElem.minValue"), cc.rc(row, 2));
builder.add(minValueField, cc.rc(row, 4));
builder.addLabel(I18n.getMessage("ParameterTypesElem.maxValue"), cc.rc(row, 6));
builder.add(maxValueField, cc.rc(row, 8));
row = 11;
builder.add(new JSeparator(SwingConstants.HORIZONTAL), cc.rcw(row, 2, 7));
row = 12;
valuesCaption = builder.addLabel(I18n.getMessage("ParameterTypeValues.caption"), cc.rcw(row, 2, 7));
valuesCaption.setFont(FontUtils.getSubCaptionFont());
row = 14;
valuesPanel = new ParameterTypeValues(selectionInList);
builder.add(valuesPanel, cc.rcw(row, 2, 7));
row = 16;
JComponent reportPane = ValidationResultViewFactory.createReportList(validationHandler.getValidationResultModel());
builder.add(reportPane, cc.rcw(row, 2, 7));
detailsPanel = builder.build();
validationHandler.setValidatedContainer(detailsPanel);
validationHandler.observeSelectionChange(selectionInList);
setupToolBar();
atomicTypeValue.addValueChangeListener(new PropertyChangeListener()
{
@Override
public void propertyChange(PropertyChangeEvent evt)
{
ParameterAtomicType atomicType = (ParameterAtomicType) atomicTypeValue.getValue();
boolean visible = atomicType == ParameterAtomicType.ENUM || atomicType == ParameterAtomicType.LONG_ENUM;
valuesPanel.setVisible(visible);
valuesCaption.setVisible(visible);
}
});
}
示例11: single
import com.jgoodies.forms.builder.PanelBuilder; //导入方法依赖的package包/类
/**
* Creates and returns a panel where {@code component} is laid out
* using a FormLayout with the given column and row specifications.
* <blockquote><pre>
* Forms.single( "left:150dlu", "c:p", component);
* Forms.single( "fill:150dlu:grow", "f:20dlu", component);
* Forms.single("center:150dlu", "b:p:g", component);
* </pre></blockquote>
*
* @param columnSpec a FormLayout column specification for a single column
* @param rowSpec a FormLayout row specification for a single row
* @param component the component to lay out
* @return the built panel
* @throws NullPointerException if {@code columnSpec}, {@code rowSpec},
* or {@code component} is {@code null}
* @throws IllegalArgumentException if {@code columnSpec} or {@code rowSpec}
* is empty or whitespace
*/
public static JComponent single(String columnSpec, String rowSpec,
JComponent component) {
checkNotBlank(columnSpec, MUST_NOT_BE_BLANK, "column specification");
checkNotBlank(rowSpec, MUST_NOT_BE_BLANK, "row specification");
checkNotNull (component, MUST_NOT_BE_NULL, "component");
FormLayout layout = new FormLayout(columnSpec, rowSpec);
PanelBuilder builder = new PanelBuilder(layout);
builder.add(component, CC.xy(1, 1));
return builder.build();
}