List of usage examples for com.jgoodies.forms.layout CellConstraints xy
public CellConstraints xy(int col, int row)
Examples:
cc.xy(1, 1); cc.xy(1, 3);
From source file:com.isencia.passerelle.hmi.specific.HMITest.java
License:Open Source License
private JPanel getRockingCurvePanel() { // Initialization rockingCurveTextField = new JTextField("100"); registerBinding("rockingCurveField", rockingCurveTextField, (ParameterToWidgetBinder) new ParameterToTextFieldBinder()); // Create panel final FormLayout layout = new FormLayout("p, 3dlu, p", // cols "pref, 3dlu, p"); // rows // Specify that columns 1 & 5 as well as 3 & 7 have equal widths. layout.setColumnGroups(new int[][] { { 1, 3 } }); // Create a builder that assists in adding components to the container. // Wrap the panel with a standardized border. final PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder();/*from w w w . j a va 2 s. c o m*/ // Obtain a reusable constraints object to place components in the grid. final CellConstraints cc = new CellConstraints(); builder.addSeparator("Rocking curve", cc.xyw(1, 1, 3)); builder.addLabel("Rocking curve (%)", cc.xy(1, 3)); builder.add(rockingCurveTextField, cc.xy(3, 3)); return builder.getPanel(); }
From source file:com.jeta.swingbuilder.codegen.gui.editor.SourceView.java
License:Open Source License
/** * Adds fill components to empty cells in the first row and first column of * the grid. This ensures that the grid spacing will be the same as shown in * the designer./*from www . j a va 2 s . c o m*/ * * @param cols * an array of column indices in the first row where fill * components should be added. * @param rows * an array of row indices in the first column where fill * components should be added. */ void addFillComponents(Container panel, int[] cols, int[] rows) { Dimension filler = new Dimension(10, 10); boolean filled_cell_11 = false; CellConstraints cc = new CellConstraints(); if (cols.length > 0 && rows.length > 0) { if (cols[0] == 1 && rows[0] == 1) { /** add a rigid area */ panel.add(Box.createRigidArea(filler), cc.xy(1, 1)); filled_cell_11 = true; } } for (int index = 0; index < cols.length; index++) { if (cols[index] == 1 && filled_cell_11) { continue; } panel.add(Box.createRigidArea(filler), cc.xy(cols[index], 1)); } for (int index = 0; index < rows.length; index++) { if (rows[index] == 1 && filled_cell_11) { continue; } panel.add(Box.createRigidArea(filler), cc.xy(1, rows[index])); } }
From source file:com.jeta.swingbuilder.codegen.gui.editor.SourceView.java
License:Open Source License
public JPanel createPanel(Component editor) { JPanel jpanel1 = new JPanel(); FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE", "CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),CENTER:DEFAULT:NONE"); CellConstraints cc = new CellConstraints(); jpanel1.setLayout(formlayout1);/*from www .jav a 2s . c om*/ jpanel1.add(createPanel1(), cc.xy(2, 2)); jpanel1.add(editor, cc.xy(2, 3)); addFillComponents(jpanel1, new int[] { 1, 2, 3 }, new int[] { 1, 2, 3, 4 }); return jpanel1; }
From source file:com.jeta.swingbuilder.codegen.gui.editor.SourceView.java
License:Open Source License
public JPanel createPanel1() { JPanel jpanel1 = new JPanel(); jpanel1.setOpaque(false);/*from w ww . j a va 2 s .com*/ FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE", "CENTER:DEFAULT:NONE,CENTER:2DLU:NONE"); CellConstraints cc = new CellConstraints(); jpanel1.setLayout(formlayout1); m_codegen_label.setFont(new Font("Dialog", Font.BOLD, 12)); m_codegen_label.setAntiAliased(true); m_codegen_label.setName("codegen.label"); m_codegen_label.setText("Code Generation"); jpanel1.add(m_codegen_label, cc.xy(1, 1)); m_options_btn.setText(I18N.getLocalizedMessage("Options...")); m_options_btn.setName("options.btn"); jpanel1.add(m_options_btn, cc.xy(3, 1)); addFillComponents(jpanel1, new int[] { 2 }, new int[0]); return jpanel1; }
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 )./*from w ww. j a va 2s . c o m*/ * * @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; }
From source file:com.jeta.swingbuilder.gui.components.GridSizePanel.java
License:Open Source License
/** * ctor//from w w w . j a v a 2s . com */ public GridSizePanel() { FormLayout layout = new FormLayout("12px,pref,4dlu,pref,32px", "12px,pref,2dlu,pref,24px"); setLayout(layout); CellConstraints cc = new CellConstraints(); JTextField tf = new JTextField(5); tf.setDocument(new IntegerDocument(false)); tf.setName(ID_COLS_FIELD); add(new JLabel(I18N.getLocalizedMessage("Columns")), cc.xy(2, 2)); add(tf, cc.xy(4, 2)); tf = new JTextField(5); tf.setDocument(new IntegerDocument(false)); tf.setName(ID_ROWS_FIELD); add(new JLabel(I18N.getLocalizedMessage("Rows")), cc.xy(2, 4)); add(tf, cc.xy(4, 4)); setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10)); }
From source file:com.jeta.swingbuilder.gui.editor.FormEditor.java
License:Open Source License
/** * Creates the status bar for this editor *///w w w .j a v a2s. c o m private JETAPanel createStatusBar() { if (FormDesignerUtils.isDebug()) { JETAPanel panel = new JETAPanel(new FormLayout("pref:grow", "pref,pref")); CellConstraints cc = new CellConstraints(); panel.add(createStandardStatusBar(), cc.xy(1, 1)); panel.add(createDebugStatusBar(), cc.xy(1, 2)); return panel; } else { return createStandardStatusBar(); } }
From source file:com.jeta.swingbuilder.gui.editor.FormEditor.java
License:Open Source License
/** * Creates a debug bar for this editor. Shows extra information such as form * id./*from ww w . jav a2 s .c o m*/ */ private JETAPanel createDebugStatusBar() { JETAPanel panel = new JETAPanel(); FormLayout layout = new FormLayout("pref:grow", "pref,pref"); panel.setLayout(layout); m_formcell = new TSCell("formcell", "left:pref:nogrow"); m_formcell.setFont(javax.swing.UIManager.getFont("Table.font")); m_formcell.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); m_parentcell = new TSCell("parentcell", "left:pref:nogrow"); m_parentcell.setFont(javax.swing.UIManager.getFont("Table.font")); m_parentcell.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); CellConstraints cc = new CellConstraints(); panel.add(m_formcell, cc.xy(1, 1)); panel.add(m_parentcell, cc.xy(1, 2)); return panel; }
From source file:com.jeta.swingbuilder.gui.editor.FormEditor.java
License:Open Source License
/** * Creates the status bar for this editor *//* ww w . ja v a2 s . co m*/ private JETAPanel createStandardStatusBar() { JETAPanel panel = new JETAPanel(); FormLayout layout = new FormLayout("20px:nogrow,2px,pref:grow(0.5),2px,pref:grow(0.5)", "pref"); panel.setLayout(layout); m_formtype_cell = new TSCell("formtypecell", "center:pref:nogrow"); m_rowcell = new TSCell("rowcell", "center:pref:nogrow"); m_rowcell.setFont(javax.swing.UIManager.getFont("Table.font")); m_rowcell.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); m_colcell = new TSCell("colcell", "center:pref:nogrow"); m_colcell.setFont(javax.swing.UIManager.getFont("Table.font")); m_colcell.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); CellConstraints cc = new CellConstraints(); panel.add(m_formtype_cell, cc.xy(1, 1)); panel.add(m_colcell, cc.xy(3, 1)); panel.add(m_rowcell, cc.xy(5, 1)); return panel; }
From source file:com.jeta.swingbuilder.gui.effects.ImageFillView.java
License:Open Source License
/** * ctor/* w ww. j a v a 2s . com*/ */ public ImageFillView(GridView preview, PaintProperty pp) { super("com/jeta/swingbuilder/gui/images/imageProperties.frm", null); FormPanel view = getView(); Container form = view.getFormContainer(); FormLayout layout = (FormLayout) form.getLayout(); layout.appendRow(new RowSpec("2dlu")); layout.appendRow(new RowSpec("pref")); CellConstraints cc = new CellConstraints(); JComboBox hbox = new JComboBox(new Object[] { "LEFT", "CENTER", "RIGHT" }); hbox.setName(ImageFillNames.ID_HORIZONTAL_ALIGNMENT); form.add(new JLabel("Horizontal Alignment"), cc.xy(1, layout.getRowCount())); form.add(hbox, cc.xy(3, layout.getRowCount())); layout.appendRow(new RowSpec("2dlu")); layout.appendRow(new RowSpec("pref")); JComboBox vbox = new JComboBox(new Object[] { "TOP", "CENTER", "BOTTOM" }); vbox.setName(ImageFillNames.ID_VERTICAL_ALIGNMENT); form.add(new JLabel("Vertical Alignment"), cc.xy(1, layout.getRowCount())); form.add(vbox, cc.xy(3, layout.getRowCount())); m_preview = preview; setController(new ImageFillController(this)); if (pp != null) { setPaintProperty(pp); } }