private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Open Source Project license - unknown ResourceBundle bundle = ResourceBundle.getBundle("InformationDialog"); JPanel dialogPane = new JPanel(); JPanel contentPanel = new JPanel(); iconLabel = new JLabel(); pathLabel = new JLabel(); JLabel labelFrom = new JLabel(); fieldFrom = new JTextField(); JLabel labelSize = new JLabel(); fieldSize = new JTextField(); JLabel labelDescription = new JLabel(); JScrollPane scrollPane1 = new JScrollPane(); descriptionArea = ComponentFactory.getTextArea(); JPanel optionsPanel = new JPanel(); JLabel saveToLabel = new JLabel(); comboPath = new JComboBox(); btnSelectPath = new JButton(); progressBar = new JProgressBar(); JLabel labelRemaining = new JLabel(); remainingLabel = new JLabel(); JLabel labelEstimateTime = new JLabel(); estTimeLabel = new JLabel(); JLabel labelCurrentSpeed = new JLabel(); currentSpeedLabel = new JLabel(); JLabel labelAverageSpeed = new JLabel(); avgSpeedLabel = new JLabel(); JXButtonPanel buttonBar = new JXButtonPanel(); okButton = new JButton(); cancelButton = new JButton(); CellConstraints cc = new CellConstraints(); // ======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); // ======== dialogPane ======== { dialogPane.setBorder(Borders.DIALOG); dialogPane.setLayout(new BorderLayout()); // ======== contentPanel ======== { // ---- iconLabel ---- iconLabel.setText(bundle.getString("iconLabel.text")); // ---- pathLabel ---- pathLabel.setText(bundle.getString("pathLabel.text")); pathLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); // ---- labelFrom ---- labelFrom.setText(bundle.getString("labelFrom.text")); // ---- fieldFrom ---- fieldFrom.setBorder(null); fieldFrom.setOpaque(false); fieldFrom.setText(bundle.getString("fieldFrom.text")); // ---- labelSize ---- labelSize.setText(bundle.getString("labelSize.text")); // ---- fieldSize ---- fieldSize.setBorder(null); fieldSize.setOpaque(false); // ---- labelDescription ---- labelDescription.setText(bundle.getString("labelDescription.text")); // ======== scrollPane1 ======== { scrollPane1.setViewportView(descriptionArea); } // ======== optionsPanel ======== { // ---- saveToLabel ---- saveToLabel.setText(bundle.getString("saveToLabel.text")); saveToLabel.setLabelFor(comboPath); // ---- comboPath ---- comboPath.setEditable(true); // ---- btnSelectPath ---- btnSelectPath.setText(bundle.getString("btnSelectPath.text")); PanelBuilder optionsPanelBuilder = new PanelBuilder( new FormLayout( new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("default")), optionsPanel); optionsPanelBuilder.add(saveToLabel, cc.xy(1, 1)); optionsPanelBuilder.add(comboPath, cc.xy(3, 1)); optionsPanelBuilder.add(btnSelectPath, cc.xy(5, 1)); } // ---- progressBar ---- progressBar.setFont(new Font("Tahoma", Font.BOLD, 16)); // ---- labelRemaining ---- labelRemaining.setText(bundle.getString("labelRemaining.text")); // ---- remainingLabel ---- remainingLabel.setText(bundle.getString("remainingLabel.text")); remainingLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); // ---- labelEstimateTime ---- labelEstimateTime.setText(bundle.getString("labelEstimateTime.text")); // ---- estTimeLabel ---- estTimeLabel.setText(bundle.getString("estTimeLabel.text")); estTimeLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); // ---- labelCurrentSpeed ---- labelCurrentSpeed.setText(bundle.getString("labelCurrentSpeed.text")); // ---- currentSpeedLabel ---- currentSpeedLabel.setText(bundle.getString("currentSpeedLabel.text")); currentSpeedLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); // ---- labelAverageSpeed ---- labelAverageSpeed.setText(bundle.getString("labelAverageSpeed.text")); // ---- avgSpeedLabel ---- avgSpeedLabel.setText(bundle.getString("avgSpeedLabel.text")); avgSpeedLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); PanelBuilder contentPanelBuilder = new PanelBuilder( new FormLayout( new ColumnSpec[] { new ColumnSpec(Sizes.dluX(49)), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("max(min;70dlu)") }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, new RowSpec( RowSpec.FILL, Sizes.bounded(Sizes.PREFERRED, Sizes.dluY(40), Sizes.dluY(50)), FormSpec.DEFAULT_GROW), FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("fill:max(pref;20dlu)"), FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC }), contentPanel); contentPanelBuilder.add(iconLabel, cc.xywh(1, 1, 1, 5)); contentPanelBuilder.add(pathLabel, cc.xywh(3, 1, 7, 1)); contentPanelBuilder.add(labelFrom, cc.xy(3, 3)); contentPanelBuilder.add(fieldFrom, cc.xywh(5, 3, 5, 1)); contentPanelBuilder.add(labelSize, cc.xy(3, 5)); contentPanelBuilder.add(fieldSize, cc.xywh(5, 5, 3, 1)); contentPanelBuilder.add(labelDescription, cc.xy(1, 7)); contentPanelBuilder.add(scrollPane1, cc.xywh(1, 9, 9, 1)); contentPanelBuilder.add(optionsPanel, cc.xywh(1, 11, 9, 1)); contentPanelBuilder.add(progressBar, cc.xywh(1, 13, 9, 1)); contentPanelBuilder.add(labelRemaining, cc.xy(1, 15)); contentPanelBuilder.add(remainingLabel, cc.xywh(3, 15, 3, 1)); contentPanelBuilder.add(labelEstimateTime, cc.xy(7, 15)); contentPanelBuilder.add(estTimeLabel, cc.xy(9, 15)); contentPanelBuilder.add(labelCurrentSpeed, cc.xy(1, 17)); contentPanelBuilder.add(currentSpeedLabel, cc.xywh(3, 17, 3, 1)); contentPanelBuilder.add(labelAverageSpeed, cc.xy(7, 17)); contentPanelBuilder.add(avgSpeedLabel, cc.xy(9, 17)); } dialogPane.add(contentPanel, BorderLayout.CENTER); // ======== buttonBar ======== { buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); // ---- okButton ---- okButton.setText(bundle.getString("okButton.text")); // ---- cancelButton ---- cancelButton.setText(bundle.getString("cancelButton.text")); PanelBuilder buttonBarBuilder = new PanelBuilder( new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormSpecs.UNRELATED_GAP_COLSPEC, ColumnSpec.decode("max(pref;55dlu)"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("fill:pref")), buttonBar); ((FormLayout) buttonBar.getLayout()).setColumnGroups(new int[][] {{3, 5}}); buttonBarBuilder.add(okButton, cc.xy(3, 1)); buttonBarBuilder.add(cancelButton, 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 }
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 ======== { 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 }