List of usage examples for javax.swing Box setPreferredSize
@BeanProperty(preferred = true, description = "The preferred size of the component.") public void setPreferredSize(Dimension preferredSize)
From source file:org.jdal.swing.form.SimpleBoxFormBuilder.java
/** * Builds the panel form./*from w ww . java 2 s . co m*/ * @return the form component */ public JComponent getForm() { // set sizes; int columnHeight = 0; for (int h : rowsHeight) columnHeight += h; // add space into components (fillers) columnHeight += (rows - 1) * defaultSpace; for (int i = 0; i < columns.size(); i++) { Box box = columns.get(i); int maxWidth = columnsWidth.get(i) == 0 ? Short.MAX_VALUE : columnsWidth.get(i); box.setMaximumSize(new Dimension(maxWidth, columnHeight)); if (maxWidth < Short.MAX_VALUE && columnHeight < Short.MAX_VALUE) { box.setMinimumSize(new Dimension(maxWidth, columnHeight)); box.setPreferredSize(new Dimension(maxWidth, columnHeight)); } } container.setFocusTraversalPolicy(focusTransversal); container.setFocusTraversalPolicyProvider(true); container.setSize(Short.MAX_VALUE, columnHeight); if (isFixedHeight()) { Dimension maxSize = new Dimension(Short.MAX_VALUE, columnHeight); if (container.isMaximumSizeSet()) { maxSize = container.getMaximumSize(); maxSize.height = columnHeight; } container.setMaximumSize(maxSize); } if (isDebug()) container.setBorder(BorderFactory.createLineBorder(Color.BLUE)); if (border != null) container.setBorder(border); return container; }