List of usage examples for com.jgoodies.forms.layout ColumnSpec ColumnSpec
private ColumnSpec(String encodedDescription)
From source file:DownloadHistoryDialog.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Open Source Project license - unknown ResourceBundle bundle = ResourceBundle.getBundle("DownloadHistoryDialog"); JPanel dialogPane = new JPanel(); JPanel contentPanel = new JPanel(); JPanel panel1 = new JPanel(); combobox = new JComboBox(); JLabel labelFilter = new JLabel(); fieldFilter = new JTextField(); JScrollPane scrollPane2 = new JScrollPane(); table = new JXTable(); JXButtonPanel buttonBar = new JXButtonPanel(); clearHistoryBtn = new JButton(); okButton = new JButton(); CellConstraints cc = new CellConstraints(); //======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== {/*www . j av a 2 s . c o m*/ dialogPane.setBorder(Borders.DIALOG); dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { //======== panel1 ======== { panel1.setBorder(new TitledBorder(bundle.getString("panel1.border"))); //---- labelFilter ---- labelFilter.setText(bundle.getString("labelFilter.text")); labelFilter.setLabelFor(fieldFilter); PanelBuilder panel1Builder = new PanelBuilder(new FormLayout( new ColumnSpec[] { ColumnSpec.decode("max(pref;80dlu)"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(100)), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, RowSpec.decodeSpecs("default")), panel1); panel1Builder.add(combobox, cc.xy(1, 1)); panel1Builder.add(labelFilter, cc.xy(3, 1)); panel1Builder.add(fieldFilter, cc.xy(5, 1)); } //======== scrollPane2 ======== { scrollPane2.setViewportView(table); } PanelBuilder contentPanelBuilder = new PanelBuilder( new FormLayout(ColumnSpec.decodeSpecs("default:grow"), new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }), contentPanel); contentPanelBuilder.add(panel1, cc.xy(1, 1)); contentPanelBuilder.add(scrollPane2, cc.xy(1, 3)); } dialogPane.add(contentPanel, BorderLayout.CENTER); //======== buttonBar ======== { buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); //---- clearHistoryBtn ---- clearHistoryBtn.setText(bundle.getString("clearHistoryBtn.text")); //---- okButton ---- okButton.setText(bundle.getString("okButton.text")); PanelBuilder buttonBarBuilder = new PanelBuilder(new FormLayout( new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormSpecs.UNRELATED_GAP_COLSPEC, ColumnSpec.decode("max(pref;55dlu)") }, RowSpec.decodeSpecs("fill:pref")), buttonBar); buttonBarBuilder.add(clearHistoryBtn, cc.xy(1, 1)); buttonBarBuilder.add(okButton, cc.xy(5, 1)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:JPFamiliaGenerico.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Open Source Project license - unknown lblCodigo = new JLabel(); txtCodigo = new JTextField(); lblNombre = new JLabel(); txtNombre = new JTextField(); spTblFamiliaGenerico = new JScrollPane(); tblFamiliaGenerico = new JTable(); CellConstraints cc = new CellConstraints(); //======== this ======== setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(Sizes.dluX(10)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(50)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(150)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.dluX(60), FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(10)) }, new RowSpec[] { new RowSpec(Sizes.dluY(10)), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(15)), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(15)), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(10)), FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(10)) })); //---- lblCodigo ---- lblCodigo.setText("C\u00f3digo:"); lblCodigo.setHorizontalAlignment(SwingConstants.RIGHT); add(lblCodigo, cc.xywh(3, 3, 1, 1, CellConstraints.RIGHT, CellConstraints.FILL)); add(txtCodigo, cc.xywh(5, 3, 1, 1, CellConstraints.DEFAULT, CellConstraints.FILL)); //---- lblNombre ---- lblNombre.setText("Nombre:"); lblNombre.setHorizontalAlignment(SwingConstants.RIGHT); add(lblNombre, cc.xywh(3, 5, 1, 1, CellConstraints.RIGHT, CellConstraints.FILL)); add(txtNombre, cc.xywh(5, 5, 3, 1, CellConstraints.DEFAULT, CellConstraints.FILL)); //======== spTblFamiliaGenerico ======== {/*from ww w .j ava 2s . c om*/ //---- tblFamiliaGenerico ---- tblFamiliaGenerico .setModel(new DefaultTableModel(new Object[][] {}, new String[] { "C\u00f3digo", "Nombre" }) { boolean[] columnEditable = new boolean[] { false, false }; @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return columnEditable[columnIndex]; } }); spTblFamiliaGenerico.setViewportView(tblFamiliaGenerico); } add(spTblFamiliaGenerico, cc.xywh(3, 9, 7, 5)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:anl.verdi.plot.anim.MultiPlotAnimation.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance(); separator1 = compFactory.createSeparator("Select Plots"); scrollPane1 = new JScrollPane(); plotList = new CheckBoxList(); panel1 = new JPanel(); label1 = new JLabel(); startSpinner = new JSpinner(); startLbl = new JLabel(); label2 = new JLabel(); endSpinner = new JSpinner(); endLbl = new JLabel(); panel2 = new JPanel(); gifChk = new JCheckBox(); gifFileLbl = new JLabel(); gifFileBtn = new JButton(); separator2 = compFactory.createSeparator(""); CellConstraints cc = new CellConstraints(); //======== this ======== // 2014/* w ww.ja va 2s .com*/ ColumnSpec[] aColumnSpec = ColumnSpec.decodeSpecs("default:grow"); RowSpec aRowSpec = new RowSpec(RowSpec.TOP, Sizes.dluY(84), 0.5); RowSpec bRowSpec = new RowSpec(RowSpec.FILL, Sizes.PREFERRED, 0.5); setLayout(new FormLayout(aColumnSpec, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, aRowSpec, FormFactory.RELATED_GAP_ROWSPEC, bRowSpec, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); // setLayout(new FormLayout( // ColumnSpec.decodeSpecs("default:grow"), // new RowSpec[] { // FormFactory.DEFAULT_ROWSPEC, // FormFactory.RELATED_GAP_ROWSPEC, // new RowSpec(RowSpec.TOP, Sizes.dluY(84), 0.5), // FormFactory.RELATED_GAP_ROWSPEC, // new RowSpec(RowSpec.FILL, Sizes.PREFERRED, 0.5), // FormFactory.RELATED_GAP_ROWSPEC, // FormFactory.DEFAULT_ROWSPEC, // FormFactory.LINE_GAP_ROWSPEC, // FormFactory.DEFAULT_ROWSPEC // })); add(separator1, cc.xy(1, 1)); //======== scrollPane1 ======== { scrollPane1.setViewportView(plotList); } add(scrollPane1, cc.xy(1, 3)); //======== panel1 ======== { // 2014 ColumnSpec[] dColumnSpec = ColumnSpec.decodeSpecs("max(pref;40dlu)"); ColumnSpec[] eColumnSpec = ColumnSpec.decodeSpecs("max(pref;40dlu):grow"); panel1.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(Sizes.dluX(71)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, dColumnSpec[0], FormFactory.UNRELATED_GAP_COLSPEC, eColumnSpec[0] }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); // panel1.setLayout(new FormLayout( // new ColumnSpec[] { // new ColumnSpec(Sizes.dluX(71)), // FormFactory.LABEL_COMPONENT_GAP_COLSPEC, // new ColumnSpec("max(pref;40dlu)"), // FormFactory.UNRELATED_GAP_COLSPEC, // new ColumnSpec("max(pref;40dlu):grow") // }, // new RowSpec[] { // FormFactory.DEFAULT_ROWSPEC, // FormFactory.LINE_GAP_ROWSPEC, // FormFactory.DEFAULT_ROWSPEC // })); //---- label1 ---- label1.setText("Starting Time Step:"); panel1.add(label1, cc.xy(1, 1)); panel1.add(startSpinner, cc.xy(3, 1)); //---- startLbl ---- startLbl.setFont(new Font("Tahoma", Font.BOLD, 11)); panel1.add(startLbl, cc.xy(5, 1)); //---- label2 ---- label2.setText("Ending Time Step:"); panel1.add(label2, cc.xy(1, 3)); panel1.add(endSpinner, cc.xy(3, 3)); //---- endLbl ---- endLbl.setFont(new Font("Tahoma", Font.BOLD, 11)); panel1.add(endLbl, cc.xy(5, 3)); } add(panel1, cc.xywh(1, 5, 1, 1, CellConstraints.DEFAULT, CellConstraints.TOP)); //======== panel2 ======== { // 2014 ColumnSpec fColumnSpec = new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW); RowSpec[] fRowSpec = RowSpec.decodeSpecs("default"); panel2.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, fColumnSpec, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, fRowSpec)); // panel2.setLayout(new FormLayout( // new ColumnSpec[] { // FormFactory.DEFAULT_COLSPEC, // FormFactory.LABEL_COMPONENT_GAP_COLSPEC, // new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), // FormFactory.LABEL_COMPONENT_GAP_COLSPEC, // FormFactory.DEFAULT_COLSPEC // }, // RowSpec.decodeSpecs("default"))); //---- gifChk ---- gifChk.setText("Make Animated GIF(s)"); panel2.add(gifChk, cc.xy(1, 1)); panel2.add(gifFileLbl, cc.xy(3, 1)); //---- gifFileBtn ---- gifFileBtn.setText("..."); gifFileBtn.setMaximumSize(new Dimension(23, 23)); gifFileBtn.setMinimumSize(new Dimension(23, 23)); gifFileBtn.setPreferredSize(new Dimension(23, 23)); gifFileBtn.setEnabled(false); panel2.add(gifFileBtn, cc.xy(5, 1)); } add(panel2, cc.xy(1, 7)); add(separator2, cc.xy(1, 9)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:com.allenstudio.ir.ui.NoteOperationsPane.java
License:Open Source License
private void initComponents() { CellConstraints cc = new CellConstraints(); JLabel typeLabel = new JLabel(UIResources.getString("typeLabel") + ":"); JLabel featureLabel = new JLabel(UIResources.getString("featureLabel") + ":"); JLabel repetitionLabel = new JLabel(UIResources.getString("repetitionLabel") + ":"); JLabel moveLabel = new JLabel(UIResources.getString("moveLabel") + ":"); //======== Panel building ======== {// w ww . ja va 2 s .c om this.setContentPaneBorder(BorderFactory.createEmptyBorder(8, 2, 8, 3)); Container thisContentPane = this.getContentPane(); thisContentPane.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec("right:max(default;40dlu)"), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec("max(default;40dlu)") }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- typeLabel ---- thisContentPane.add(typeLabel, cc.xy(1, 1)); thisContentPane.add(typeBox, cc.xy(3, 1)); //---- featureLabel ---- thisContentPane.add(featureLabel, cc.xy(1, 3)); //---- featureButton ---- featureButton.setText("F:\\Setup.exe"); thisContentPane.add(featureButton, cc.xy(3, 3)); //---- repetitionLabel ---- thisContentPane.add(repetitionLabel, cc.xy(1, 5)); thisContentPane.add(repetitionBox, cc.xy(3, 5)); //---- moveLabel ---- thisContentPane.add(moveLabel, cc.xy(1, 7)); //---- datePickButton ---- datePickButton.setText(UIResources.getString("datePickLabel")); thisContentPane.add(datePickButton, cc.xy(3, 7)); } }
From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManager.java
License:Apache License
@Override protected void changeLayoutFromGrid(final RadContainer container, final List<RadComponent> contents, final List<Boolean> canRowsGrow, final List<Boolean> canColumnsGrow) { int rowCount = canRowsGrow.size(); int columnCount = canColumnsGrow.size(); int rowCountWithGaps = (rowCount == 0) ? 0 : rowCount * 2 - 1; int columnCountWithGaps = (columnCount == 0) ? 0 : columnCount * 2 - 1; RowSpec[] rowSpecs = new RowSpec[rowCountWithGaps]; ColumnSpec[] colSpecs = new ColumnSpec[columnCountWithGaps]; for (int i = 0; i < rowCount; i++) { rowSpecs[i * 2] = canRowsGrow.get(i).booleanValue() ? RowSpec.decode(ENCODED_FORMSPEC_GROW) : new RowSpec(DEFAULT_NOGROW_SIZE); if (i * 2 + 1 < rowSpecs.length) { rowSpecs[i * 2 + 1] = FormSpecs.RELATED_GAP_ROWSPEC; }/*w w w . j a va 2s .c o m*/ } for (int i = 0; i < columnCount; i++) { colSpecs[i * 2] = canColumnsGrow.get(i).booleanValue() ? ColumnSpec.decode(ENCODED_FORMSPEC_GROW) : new ColumnSpec(DEFAULT_NOGROW_SIZE); if (i * 2 + 1 < colSpecs.length) { colSpecs[i * 2 + 1] = FormSpecs.RELATED_GAP_COLSPEC; } } container.setLayoutManager(this, new FormLayout(colSpecs, rowSpecs)); }
From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManager.java
License:Apache License
@Override public int insertGridCells(final RadContainer grid, final int cellIndex, final boolean isRow, final boolean isBefore, final boolean grow) { FormSpec formSpec;/* w w w.j a v a 2s . co m*/ if (isRow) { formSpec = grow ? RowSpec.decode(ENCODED_FORMSPEC_GROW) : new RowSpec(DEFAULT_NOGROW_SIZE); } else { formSpec = grow ? ColumnSpec.decode(ENCODED_FORMSPEC_GROW) : new ColumnSpec(DEFAULT_NOGROW_SIZE); } insertGridCells(grid, cellIndex, isRow, isBefore, formSpec); return getGridCellCount(grid, isRow) == 1 ? 1 : 2; }
From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManagerTest.java
License:Apache License
public void testMoveColumnRight() { myManager.insertGridCells(myContainer, 0, false, false, true); final ConstantSize colSize = new ConstantSize(17, ConstantSize.MM); myLayout.setColumnSpec(1, new ColumnSpec(colSize)); RadComponent c = newComponent(0, 0, 1, 1); myContainer.addComponent(c);/*from w w w .j av a 2 s .com*/ myManager.processCellsMoved(myContainer, false, new int[] { 0 }, 3); assertEquals(colSize, myLayout.getColumnSpec(3).getSize()); assertEquals(3, myLayout.getConstraints(c.getDelegee()).gridX); }
From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManagerTest.java
License:Apache License
public void testMoveColumnLeft() { myManager.insertGridCells(myContainer, 0, false, false, true); final ConstantSize colSize = new ConstantSize(17, ConstantSize.MM); myLayout.setColumnSpec(3, new ColumnSpec(colSize)); RadComponent c = newComponent(0, 2, 1, 1); myContainer.addComponent(c);//from w ww .j a va 2 s. c o m myManager.processCellsMoved(myContainer, false, new int[] { 2 }, 0); assertEquals(colSize, myLayout.getColumnSpec(1).getSize()); assertEquals(1, myLayout.getConstraints(c.getDelegee()).gridX); }
From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManagerTest.java
License:Apache License
public void testMoveMultipleColumnsRight() { myManager.insertGridCells(myContainer, 0, false, false, true); myManager.insertGridCells(myContainer, 0, false, false, true); final ConstantSize colSize1 = new ConstantSize(17, ConstantSize.MM); final ConstantSize colSize2 = new ConstantSize(19, ConstantSize.MM); myLayout.setColumnSpec(1, new ColumnSpec(colSize1)); myLayout.setColumnSpec(3, new ColumnSpec(colSize2)); RadComponent c1 = newComponent(0, 0, 1, 1); myContainer.addComponent(c1);// ww w. j av a 2s . c om RadComponent c2 = newComponent(0, 2, 1, 1); myContainer.addComponent(c2); myManager.processCellsMoved(myContainer, false, new int[] { 0, 2 }, 5); assertEquals(colSize1, myLayout.getColumnSpec(3).getSize()); assertEquals(colSize2, myLayout.getColumnSpec(5).getSize()); assertEquals(3, myLayout.getConstraints(c1.getDelegee()).gridX); assertEquals(5, myLayout.getConstraints(c2.getDelegee()).gridX); }
From source file:com.jeta.swingbuilder.gui.components.DefaultContainedFormFactory.java
License:Open Source License
/** * This method creates a top-level parent form that is used to contain a * form that we can edit. This is used in two cases. In the first, we use a * top level form in the FormEditor. In the second, we use the top-level * form in contained forms (e.g. a form that is contained in a JTabbedPane * tab )./* w ww .j a v a2s . com*/ * * @param parent * the object that will contain the top-level parent * @param compsrc * the component source * @param form * the form that will be contained by the top-level parent */ public FormComponent createTopParent(Container container, ComponentSource compsrc, FormComponent form) throws FormException { EmbeddedFormComponentFactory factory = new EmbeddedFormComponentFactory(compsrc); FormComponent parent = (FormComponent) factory.create(compsrc, "formeditor.top.parent", null, 1, 1, true); parent.setTopLevelForm(true); parent.setControlButtonsVisible(false); form.setControlButtonsVisible(true); GridView view = parent.getChildView(); view.setGridVisible(false); view.setRowSpec(1, new RowSpec("fill:pref:grow")); view.setColumnSpec(1, new ColumnSpec("fill:pref:grow")); CellConstraints cc = new CellConstraints(); view.addComponent(form, cc.xy(1, 1)); parent.setBorder(javax.swing.BorderFactory.createEmptyBorder(8, 8, 8, 8)); /** * Now get the FormContainerComponent instance and add it as a listener * to the newly created form. This is needed so that GridComponent * events such as cell_selected and cell_changed are properly propagated * up the form hierarchy. */ FormContainerComponent fcc = getFormContainerComponent(container); if (fcc != null) { assert (fcc.getBeanDelegate() instanceof javax.swing.JTabbedPane); view.addListener(fcc); } if ((container instanceof javax.swing.JTabbedPane) && FormUtils.isDesignMode()) { if (fcc == null) { System.err.println("DefaultContainedFormFactory encountered invalid container: " + container); } FormUtils.safeAssert(fcc != null); } return parent; }