List of usage examples for com.jgoodies.forms.layout ColumnSpec DEFAULT
DefaultAlignment DEFAULT
To view the source code for com.jgoodies.forms.layout ColumnSpec DEFAULT.
Click Source Link
From source file:etomica.virial.cluster2.mvc.view.ClusterWizardPageTemplate.java
License:Mozilla Public License
protected JComponent buildGrid(Component c1) { return buildGrid(c1, new ColumnSpec(ColumnSpec.DEFAULT, Sizes.dluX(20), ColumnSpec.DEFAULT_GROW)); }
From source file:org.antlr.works.dialog.NewWizardDialog.java
License:BSD License
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Ryan Paul Talusan dialogPane = new JPanel(); contentPanel = new JPanel(); label1 = new JLabel(); grammarNameField = new JTextField(); label2 = new JLabel(); grammarTypeComboBox = new JComboBox(); lexicalItemPanel = new JPanel(); lexLeftPanel = new JPanel(); cbIdentifier = new JCheckBox(); cbInteger = new JCheckBox(); cbFloat = new JCheckBox(); cbComments = new JCheckBox(); commentsPanel = new JPanel(); cbSingleLine = new JCheckBox(); cbMultiLine = new JCheckBox(); lexRightPanel = new JPanel(); cbString = new JCheckBox(); stringPanel = new JPanel(); singleQuoteRadio = new JRadioButton(); doubleQuoteRadio = new JRadioButton(); cbCharacters = new JCheckBox(); cbWhiteSpace = new JCheckBox(); wsPanel = new JPanel(); cbTabChar = new JCheckBox(); cbNewlineChar = new JCheckBox(); cbCarriageReturnChar = new JCheckBox(); buttonBar = new JPanel(); okButton = new JButton(); cancelButton = new JButton(); CellConstraints cc = new CellConstraints(); //======== this ======== setTitle("New Grammar Wizard"); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== {//from ww w . j av a2 s . co m dialogPane.setBorder(Borders.DIALOG_BORDER); dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { contentPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.RIGHT, Sizes.DEFAULT, FormSpec.NO_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.UNRELATED_GAP_ROWSPEC, new RowSpec(RowSpec.TOP, Sizes.DEFAULT, RowSpec.DEFAULT_GROW) })); //---- label1 ---- label1.setText("Grammar Name:"); contentPanel.add(label1, cc.xy(3, 1)); contentPanel.add(grammarNameField, cc.xywh(5, 1, 3, 1)); //---- label2 ---- label2.setText("Type:"); contentPanel.add(label2, cc.xy(3, 3)); //---- grammarTypeComboBox ---- grammarTypeComboBox.setModel(new DefaultComboBoxModel( new String[] { "Parser", "Lexer", "Tree Grammar", "Combined Grammar" })); grammarTypeComboBox.setSelectedIndex(3); grammarTypeComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { switch (grammarTypeComboBox.getSelectedIndex()) { case GRAMMAR_TYPE_PARSER: case GRAMMAR_TYPE_TREE_GRAMMAR: cbIdentifier.setEnabled(false); cbInteger.setEnabled(false); cbFloat.setEnabled(false); cbComments.setEnabled(false); cbSingleLine.setEnabled(false); cbMultiLine.setEnabled(false); cbString.setEnabled(false); cbCharacters.setEnabled(false); cbWhiteSpace.setEnabled(false); cbTabChar.setEnabled(false); cbNewlineChar.setEnabled(false); cbCarriageReturnChar.setEnabled(false); break; case GRAMMAR_TYPE_LEXER: case GRAMMAR_TYPE_COMBINED_GRAMMAR: cbIdentifier.setEnabled(true); cbInteger.setEnabled(true); cbFloat.setEnabled(true); cbComments.setEnabled(true); if (cbComments.isSelected()) { cbSingleLine.setEnabled(true); cbMultiLine.setEnabled(true); } cbString.setEnabled(true); cbCharacters.setEnabled(true); cbWhiteSpace.setEnabled(true); if (cbWhiteSpace.isSelected()) { cbTabChar.setEnabled(true); cbNewlineChar.setEnabled(true); cbCarriageReturnChar.setEnabled(true); } break; } } }); contentPanel.add(grammarTypeComboBox, cc.xy(5, 3)); //======== lexicalItemPanel ======== { lexicalItemPanel.setBorder(new TitledBorder(null, "Lexical Items", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION)); lexicalItemPanel.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, new RowSpec[] { new RowSpec(RowSpec.TOP, Sizes.DEFAULT, RowSpec.DEFAULT_GROW) })); //======== lexLeftPanel ======== { lexLeftPanel.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.DEFAULT, Sizes.dluX(10), FormSpec.NO_GROW), new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, 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, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- cbIdentifier ---- cbIdentifier.setText("Identifier"); lexLeftPanel.add(cbIdentifier, cc.xywh(1, 1, 2, 1)); //---- cbInteger ---- cbInteger.setText("Integer"); lexLeftPanel.add(cbInteger, cc.xywh(1, 3, 2, 1)); //---- cbFloat ---- cbFloat.setText("Float"); lexLeftPanel.add(cbFloat, cc.xywh(1, 5, 2, 1)); //---- cbComments ---- cbComments.setText("Comments"); lexLeftPanel.add(cbComments, cc.xywh(1, 7, 2, 1)); cbComments.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (cbComments.isSelected()) { cbSingleLine.setEnabled(true); cbMultiLine.setEnabled(true); } else { cbSingleLine.setEnabled(false); cbMultiLine.setEnabled(false); } } }); //======== commentsPanel ======== { commentsPanel.setBorder(new TitledBorder(null, null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION)); commentsPanel.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- cbSingleLine ---- cbSingleLine.setText("Single-line ( //... )"); cbSingleLine.setEnabled(false); cbSingleLine.setSelected(true); commentsPanel.add(cbSingleLine, cc.xy(1, 1)); cbSingleLine.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (!cbSingleLine.isSelected() && !cbMultiLine.isSelected()) { cbComments.setSelected(false); cbSingleLine.setEnabled(false); cbMultiLine.setEnabled(false); cbSingleLine.setSelected(true); cbMultiLine.setSelected(true); } } }); //---- cbMultiLine ---- cbMultiLine.setText("Multi-line ( /* .. */ )"); cbMultiLine.setEnabled(false); cbMultiLine.setSelected(true); commentsPanel.add(cbMultiLine, cc.xy(1, 3)); cbMultiLine.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (!cbSingleLine.isSelected() && !cbMultiLine.isSelected()) { cbComments.setSelected(false); cbSingleLine.setEnabled(false); cbMultiLine.setEnabled(false); cbSingleLine.setSelected(true); cbMultiLine.setSelected(true); } } }); } lexLeftPanel.add(commentsPanel, cc.xy(2, 9)); } lexicalItemPanel.add(lexLeftPanel, cc.xy(1, 1)); //======== lexRightPanel ======== { lexRightPanel.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.DEFAULT, Sizes.dluX(10), FormSpec.NO_GROW), new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, 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, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- cbString ---- cbString.setText("String"); lexRightPanel.add(cbString, cc.xywh(1, 1, 2, 1)); cbString.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (cbString.isSelected()) { singleQuoteRadio.setEnabled(true); doubleQuoteRadio.setEnabled(true); } else { singleQuoteRadio.setEnabled(false); doubleQuoteRadio.setEnabled(false); } } }); //======== stringPanel ======== { stringPanel.setBorder(new EtchedBorder()); stringPanel.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- singleQuoteRadio ---- singleQuoteRadio.setText("Single quotes ( 'sample string' )"); singleQuoteRadio.setEnabled(false); stringPanel.add(singleQuoteRadio, cc.xy(1, 1)); //---- doubleQuoteRadio ---- doubleQuoteRadio.setText("Double quotes ( \"sample string\" )"); doubleQuoteRadio.setEnabled(false); doubleQuoteRadio.setSelected(true); stringPanel.add(doubleQuoteRadio, cc.xy(1, 3)); } lexRightPanel.add(stringPanel, cc.xy(2, 3)); //---- cbCharacters ---- cbCharacters.setText("Character"); lexRightPanel.add(cbCharacters, cc.xywh(1, 5, 2, 1)); //---- cbWhiteSpace ---- cbWhiteSpace.setText("White Space"); lexRightPanel.add(cbWhiteSpace, cc.xywh(1, 7, 3, 1)); //======== wsPanel ======== { wsPanel.setBorder(new EtchedBorder()); wsPanel.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- cbTabChar ---- cbTabChar.setText("Tab character ( /t )"); cbTabChar.setEnabled(false); cbTabChar.setSelected(true); wsPanel.add(cbTabChar, cc.xy(1, 1)); //---- cbNewlineChar ---- cbNewlineChar.setText("Newline character ( /n )"); cbNewlineChar.setEnabled(false); cbNewlineChar.setSelected(true); wsPanel.add(cbNewlineChar, cc.xy(1, 3)); //---- cbCarriageReturnChar ---- cbCarriageReturnChar.setText("Carriage-return character ( /r )"); cbCarriageReturnChar.setEnabled(false); cbCarriageReturnChar.setSelected(true); wsPanel.add(cbCarriageReturnChar, cc.xy(1, 5)); } lexRightPanel.add(wsPanel, cc.xy(2, 9)); } lexicalItemPanel.add(lexRightPanel, cc.xy(3, 1)); } contentPanel.add(lexicalItemPanel, cc.xywh(3, 5, 5, 1)); } dialogPane.add(contentPanel, BorderLayout.CENTER); //======== buttonBar ======== { buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER); buttonBar.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.BUTTON_COLSPEC }, RowSpec.decodeSpecs("pref"))); //---- okButton ---- okButton.setText("OK"); buttonBar.add(okButton, cc.xy(2, 1)); //---- cancelButton ---- cancelButton.setText("Cancel"); buttonBar.add(cancelButton, cc.xy(4, 1)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); pack(); //---- buttonGroup1 ---- ButtonGroup buttonGroup1 = new ButtonGroup(); buttonGroup1.add(singleQuoteRadio); buttonGroup1.add(doubleQuoteRadio); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:org.eclipse.wb.internal.swing.FormLayout.model.FormDimensionInfo.java
License:Open Source License
/** * @return the encoded textual presentation of {@link FormDimensionInfo} for displaying to user. *//*from ww w . ja v a 2 s . c om*/ public String getDisplayString() { String encoded = m_size.getDisplayString(); // add alignment DefaultAlignment defaultAlignment = m_horizontal ? ColumnSpec.DEFAULT : RowSpec.DEFAULT; if (m_alignment != defaultAlignment) { encoded = m_alignment + ":" + encoded; } // add grow if (m_weight != 0.0) { if (m_weight == 1.0) { encoded += ":grow"; } else { encoded += ":grow(" + FORMAT.format(m_weight) + ")"; } } // return final encoded description return encoded; }
From source file:org.eclipse.wb.internal.swing.FormLayout.model.FormDimensionInfo.java
License:Open Source License
/** * @return the source for this {@link FormDimensionInfo}. *//* w w w . jav a2 s.com*/ public final String getSource() { // check for template { Field field = getTemplateField(); if (field != null) { return "com.jgoodies.forms.factories.FormFactory." + field.getName(); } } // new instance String sourceType = m_horizontal ? "com.jgoodies.forms.layout.ColumnSpec" : "com.jgoodies.forms.layout.RowSpec"; if (m_size.isString()) { String encoded = m_size.getSource(); // add alignment DefaultAlignment defaultAlignment = m_horizontal ? ColumnSpec.DEFAULT : RowSpec.DEFAULT; if (m_alignment != defaultAlignment) { encoded = m_alignment + ":" + encoded; } // add grow if (m_weight != 0.0) { if (m_weight == 1.0) { encoded += ":grow"; } else { encoded += ":grow(" + FORMAT.format(m_weight) + ")"; } } // finalize return sourceType + ".decode(\"" + encoded + "\")"; } else { String source = "new " + sourceType + "("; // add alignment source += getAlignmentSource(m_horizontal, m_alignment); // add size source += ", "; source += m_size.getSource(); // add grow source += ", "; source += FORMAT.format(m_weight); // finalize return source + ")"; } }
From source file:org.eclipse.wb.tests.designer.swing.model.layout.FormLayout.FormDimensionInfoTest.java
License:Open Source License
public void test_accessors() throws Exception { FormColumnInfo column = new FormColumnInfo(FormFactory.DEFAULT_COLSPEC); assertEquals("default", column.getDisplayString()); // check initial state assertSame(Sizes.DEFAULT, column.getSize().getSize()); assertSame(ColumnSpec.DEFAULT, column.getAlignment()); assertEquals(0.0, column.getWeight(), 0.001); assertFalse(column.hasGrow());/*w ww .jav a 2s . c om*/ // modify column.setAlignment(ColumnSpec.LEFT); column.setWeight(0.2); assertEquals("left:default:grow(0.2)", column.getDisplayString()); assertTrue(column.hasGrow()); }