Example usage for com.jgoodies.forms.layout CellConstraints xywh

List of usage examples for com.jgoodies.forms.layout CellConstraints xywh

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout CellConstraints xywh.

Prototype

public CellConstraints xywh(int col, int row, int colSpan, int rowSpan) 

Source Link

Document

Sets the column, row, width, and height; uses default alignments.

Examples:

 cc.xywh(1, 3, 2, 1); cc.xywh(1, 3, 7, 3); 

Usage

From source file:org.antlr.works.dialog.DialogPersonalInfo.java

License:BSD License

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - ANTLR (www.antlr.org)
    dialogPane = new JPanel();
    contentPane = new JPanel();
    iconButton = new JButton();
    label6 = new JLabel();
    textArea1 = new JTextArea();
    whoCombo = new JComboBox();
    label1 = new JLabel();
    sectorCombo = new JComboBox();
    label7 = new JLabel();
    label8 = new JLabel();
    devtoolCombo = new JComboBox();
    languageExperienceSpinner = new JSpinner();
    label2 = new JLabel();
    programmingExperienceSpinner = new JSpinner();
    label3 = new JLabel();
    countryField = new JTextField();
    label4 = new JLabel();
    funField = new JTextField();
    label5 = new JLabel();
    buttonBar = new JPanel();
    cancelButton = new JButton();
    okButton = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setTitle("ANTLRWorks early access 1");
    Container contentPane2 = getContentPane();
    contentPane2.setLayout(new BorderLayout());

    //======== dialogPane ========
    {//from  w ww .  ja va  2s.  c  o m
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setPreferredSize(new Dimension(750, 500));
        dialogPane.setLayout(new BorderLayout());

        //======== contentPane ========
        {
            contentPane.setLayout(new FormLayout(
                    new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(50)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec("max(min;100dlu):grow"), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec("max(default;30dlu)"), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            FormFactory.DEFAULT_COLSPEC },
                    new RowSpec[] { new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.NO_GROW),
                            FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.DLUY5),
                            FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                            FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.DLUY5),
                            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,
                            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,
                            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,
                            new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }));

            //---- iconButton ----
            iconButton.setBorder(null);
            iconButton.setIcon(null);
            iconButton.setEnabled(true);
            iconButton.setFocusable(false);
            iconButton.setFocusPainted(false);
            iconButton.setBorderPainted(false);
            iconButton.setContentAreaFilled(false);
            iconButton.setDefaultCapable(false);
            iconButton.setRequestFocusEnabled(false);
            iconButton.setOpaque(false);
            iconButton.setVerifyInputWhenFocusTarget(false);
            iconButton.setVerticalAlignment(SwingConstants.TOP);
            contentPane.add(iconButton, cc.xywh(1, 1, 1, 37));

            //---- label6 ----
            label6.setText("Welcome to ANTLRWorks!");
            label6.setFont(new Font("Lucida Grande", Font.PLAIN, 20));
            contentPane.add(label6, cc.xywh(3, 1, 5, 1));

            //---- textArea1 ----
            textArea1.setText(
                    "Please take a few seconds to fill out some information about yourself to help us improve our products.  Thank you!");
            textArea1.setEditable(false);
            textArea1.setOpaque(false);
            textArea1.setWrapStyleWord(true);
            textArea1.setLineWrap(true);
            textArea1.setBackground(UIManager.getColor("window"));
            contentPane.add(textArea1, cc.xywh(3, 5, 5, 1));

            //---- whoCombo ----
            whoCombo.setModel(new DefaultComboBoxModel(new String[] { "Professional programmer", "Researcher",
                    "Graduate student", "Undergraduate student", "Professor" }));
            contentPane.add(whoCombo, cc.xywh(3, 11, 3, 1));

            //---- label1 ----
            label1.setText("Who are you?");
            label1.setHorizontalAlignment(SwingConstants.LEFT);
            contentPane.add(label1, cc.xywh(3, 9, 3, 1));

            //---- sectorCombo ----
            sectorCombo.setModel(new DefaultComboBoxModel(
                    new String[] { "Industry", "Government", "Academia", "Military", "Other" }));
            contentPane.add(sectorCombo, cc.xywh(3, 15, 3, 1));

            //---- label7 ----
            label7.setText("What is your sector of activity?");
            label7.setHorizontalAlignment(SwingConstants.LEFT);
            contentPane.add(label7, cc.xywh(3, 13, 3, 1));

            //---- label8 ----
            label8.setText("What is your primary development environment?");
            contentPane.add(label8, cc.xywh(3, 17, 3, 1));

            //---- devtoolCombo ----
            devtoolCombo.setModel(new DefaultComboBoxModel(new String[] { "Eclipse", "IntelliJ",
                    "Microsoft Visual Studio", "Borland JBuilder", "Xcode",
                    "Text Editor (vi, emacs) - hardcore old-school \"I don't need no stinkin' IDE coder\"",
                    "Other" }));
            contentPane.add(devtoolCombo, cc.xywh(3, 19, 3, 1));

            //---- languageExperienceSpinner ----
            languageExperienceSpinner.setModel(new SpinnerNumberModel(0, 0, null, 1));
            contentPane.add(languageExperienceSpinner, cc.xy(3, 23));

            //---- label2 ----
            label2.setText("How many years of experience with language translation/implementation?");
            label2.setHorizontalAlignment(SwingConstants.LEFT);
            contentPane.add(label2, cc.xywh(3, 21, 3, 1));

            //---- programmingExperienceSpinner ----
            programmingExperienceSpinner.setModel(new SpinnerNumberModel(0, 0, null, 1));
            contentPane.add(programmingExperienceSpinner, cc.xy(3, 27));

            //---- label3 ----
            label3.setText("How many years of programming experience?");
            label3.setHorizontalAlignment(SwingConstants.LEFT);
            contentPane.add(label3, cc.xywh(3, 25, 3, 1));
            contentPane.add(countryField, cc.xywh(3, 31, 3, 1));

            //---- label4 ----
            label4.setText("In which country do you currently live?");
            label4.setHorizontalAlignment(SwingConstants.LEFT);
            contentPane.add(label4, cc.xywh(3, 29, 3, 1));
            contentPane.add(funField, cc.xywh(3, 35, 3, 1));

            //---- label5 ----
            label5.setText("What is your preferred caffeinated beverage?");
            label5.setHorizontalAlignment(SwingConstants.LEFT);
            contentPane.add(label5, cc.xywh(3, 33, 3, 1));
        }
        dialogPane.add(contentPane, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
            buttonBar.setLayout(new FormLayout(
                    new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            FormFactory.DEFAULT_COLSPEC, FormFactory.BUTTON_COLSPEC },
                    RowSpec.decodeSpecs("pref")));

            //---- cancelButton ----
            cancelButton.setText("Don't Send");
            buttonBar.add(cancelButton, cc.xy(3, 1));

            //---- okButton ----
            okButton.setText("Send");
            buttonBar.add(okButton, cc.xy(4, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane2.add(dialogPane, BorderLayout.CENTER);
    pack();
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:org.antlr.works.dialog.DialogReports.java

License:BSD License

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - ANTLR (www.antlr.org)
    dialogPane = new JPanel();
    contentPane = new JPanel();
    label1 = new JLabel();
    typeCombo = new JComboBox();
    label22 = new JLabel();
    humanFormatCheck = new JCheckBox();
    currentSpinner = new JSpinner();
    label2 = new JLabel();
    infoLabel = new JLabel();
    scrollPane1 = new JScrollPane();
    statsTextArea = new JTextArea();
    buttonBar = new JPanel();
    submitButton = new JButton();
    cancelButton = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setTitle("Review reports before submission");
    Container contentPane2 = getContentPane();
    contentPane2.setLayout(new BorderLayout());

    //======== dialogPane ========
    {/*from ww w. j a  v a  2  s  .  co  m*/
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setPreferredSize(new Dimension(500, 500));
        dialogPane.setLayout(new BorderLayout());

        //======== contentPane ========
        {
            contentPane.setLayout(new FormLayout(
                    new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec("max(min;30dlu)"), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            FormFactory.RELATED_GAP_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec("max(min;30dlu):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,
                            new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }));

            //---- label1 ----
            label1.setText("View report for:");
            label1.setHorizontalAlignment(SwingConstants.RIGHT);
            contentPane.add(label1, cc.xy(1, 1));

            //---- typeCombo ----
            typeCombo.setModel(new DefaultComboBoxModel(
                    new String[] { "ANTLRWorks", "ANTLR - grammar", "ANTLR - runtime" }));
            contentPane.add(typeCombo, cc.xywh(3, 1, 5, 1));

            //---- label22 ----
            label22.setText("Format:");
            label22.setHorizontalAlignment(SwingConstants.RIGHT);
            contentPane.add(label22, cc.xy(1, 3));

            //---- humanFormatCheck ----
            humanFormatCheck.setText("Human readable");
            humanFormatCheck.setSelected(true);
            contentPane.add(humanFormatCheck, cc.xywh(3, 3, 7, 1));

            //---- currentSpinner ----
            currentSpinner
                    .setModel(new SpinnerNumberModel(new Integer(1), new Integer(1), null, new Integer(1)));
            contentPane.add(currentSpinner, cc.xywh(3, 5, 2, 1));

            //---- label2 ----
            label2.setText("Report:");
            label2.setHorizontalAlignment(SwingConstants.RIGHT);
            contentPane.add(label2, cc.xy(1, 5));

            //---- infoLabel ----
            infoLabel.setText("of 999");
            contentPane.add(infoLabel, cc.xywh(7, 5, 3, 1));

            //======== scrollPane1 ========
            {

                //---- statsTextArea ----
                statsTextArea.setEditable(false);
                statsTextArea.setLineWrap(false);
                statsTextArea.setWrapStyleWord(false);
                statsTextArea.setTabSize(2);
                scrollPane1.setViewportView(statsTextArea);
            }
            contentPane.add(scrollPane1, cc.xywh(1, 7, 9, 3));
        }
        dialogPane.add(contentPane, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
            buttonBar
                    .setLayout(
                            new FormLayout(
                                    new ColumnSpec[] {
                                            new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT,
                                                    FormSpec.DEFAULT_GROW),
                                            FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.BUTTON_COLSPEC,
                                            FormFactory.RELATED_GAP_COLSPEC, FormFactory.BUTTON_COLSPEC },
                                    RowSpec.decodeSpecs("pref")));

            //---- submitButton ----
            submitButton.setText("Submit");
            buttonBar.add(submitButton, cc.xy(3, 1));

            //---- cancelButton ----
            cancelButton.setText("Cancel");
            buttonBar.add(cancelButton, cc.xy(5, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane2.add(dialogPane, BorderLayout.CENTER);
    pack();
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:org.antlr.works.dialog.DialogTestTemplate.java

License:BSD License

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - RP Talusan
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    textTestRadio = new JRadioButton();
    scrollPane1 = new JScrollPane();
    testTextArea = new JTextPane();
    classTestRadio = new JRadioButton();
    testClassField = new JTextField();
    buttonBar = new JPanel();
    okButton = new JButton();
    cancelButton = new JButton();
    testClassHiddenField = new JTextField();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    String title = "Edit Test Rig";
    if (qualifiedFileName != null && !"".equals(qualifiedFileName))
        title = "Edit " + XJUtils.getLastPathComponent(qualifiedFileName) + " Test Rig";
    if (grammarLanguage != null && !"".equals(grammarLanguage))
        title += " for " + grammarLanguage;
    setTitle(title);/*from w  ww  .j av a2s  .c o m*/

    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setMinimumSize(new Dimension(340, 250));
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            contentPanel.setLayout(new FormLayout(
                    new ColumnSpec[] { 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.LINE_GAP_ROWSPEC,
                            new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                            FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));

            //---- textTestRadio ----
            textTestRadio.setText("Text:");
            contentPanel.add(textTestRadio, cc.xy(1, 1));

            //======== scrollPane1 ========
            {
                scrollPane1.setPreferredSize(new Dimension(300, 200));
                scrollPane1.setViewportView(testTextArea);
            }
            contentPanel.add(scrollPane1, cc.xywh(3, 1, 3, 5));

            //---- classTestRadio ----
            classTestRadio.setText("Class:");
            contentPanel.add(classTestRadio, cc.xy(1, 7));

            //---- testClassField ----
            testClassField.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    if (TEXT_FULLY_QUALIFIED_CLASS_NAME.equals(testClassField.getText())) {
                        testClassField.setForeground(Color.BLACK);
                        testClassField.setText("");
                    }
                }

                @Override
                public void focusLost(FocusEvent e) {
                    testClassHiddenField.setText(testClassField.getText());
                    if ("".equals(testClassField.getText())) {
                        testClassField.setForeground(Color.LIGHT_GRAY);
                        testClassField.setText(TEXT_FULLY_QUALIFIED_CLASS_NAME);
                    }
                }
            });
            contentPanel.add(testClassField, cc.xywh(3, 7, 3, 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);
    setSize(625, 395);

    //---- buttonGroup1 ----
    ButtonGroup buttonGroup1 = new ButtonGroup();
    buttonGroup1.add(textTestRadio);
    buttonGroup1.add(classTestRadio);
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:org.antlr.works.dialog.FindAndReplaceDialog.java

License:BSD License

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - ANTLR (www.antlr.org)
    label1 = new JLabel();
    findField = new JTextField();
    label2 = new JLabel();
    replaceField = new JTextField();
    ignoreCaseButton = new JCheckBox();
    regexButton = new JCheckBox();
    optionsCombo = new JComboBox();
    replaceAllButton = new JButton();
    replaceButton = new JButton();
    replaceAndFindButton = new JButton();
    previousButton = new JButton();
    nextButton = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new FormLayout(
            new ColumnSpec[] { new ColumnSpec(Sizes.DLUX5), 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, 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,
                    FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.DLUX5) },
            new RowSpec[] { new RowSpec(Sizes.DLUY5), 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,
                    new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                    FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                    new RowSpec(Sizes.DLUY5) }));

    //---- label1 ----
    label1.setText("Find:");
    contentPane.add(label1, cc.xy(3, 3));
    contentPane.add(findField, cc.xywh(5, 3, 9, 1));

    //---- label2 ----
    label2.setText("Replace by:");
    contentPane.add(label2, cc.xy(3, 5));
    contentPane.add(replaceField, cc.xywh(5, 5, 9, 1));

    //---- ignoreCaseButton ----
    ignoreCaseButton.setText("Ignore case");
    contentPane.add(ignoreCaseButton, cc.xy(5, 7));

    //---- regexButton ----
    regexButton.setText("Regular expression");
    contentPane.add(regexButton, cc.xy(7, 7));

    //---- optionsCombo ----
    optionsCombo.setModel(//from   w w  w .  j  av a 2 s . co  m
            new DefaultComboBoxModel(new String[] { "Contains", "Starts with", "Whole words", "Ends with" }));
    contentPane.add(optionsCombo, cc.xywh(11, 7, 3, 1));

    //---- replaceAllButton ----
    replaceAllButton.setText("Replace All");
    contentPane.add(replaceAllButton, cc.xy(3, 11));

    //---- replaceButton ----
    replaceButton.setText("Replace");
    contentPane.add(replaceButton, cc.xy(5, 11));

    //---- replaceAndFindButton ----
    replaceAndFindButton.setText("Replace & Find");
    contentPane.add(replaceAndFindButton, cc.xy(7, 11));

    //---- previousButton ----
    previousButton.setText("Previous");
    contentPane.add(previousButton, cc.xy(11, 11));

    //---- nextButton ----
    nextButton.setText("Next");
    contentPane.add(nextButton, cc.xy(13, 11));
    pack();
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

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 ========
    {/*  w  w w. j  a va2  s.  com*/
        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.apache.cayenne.modeler.dialog.db.DBGeneratorOptionsView.java

License:Apache License

public DBGeneratorOptionsView(Component tables) {
    // create widgets
    this.generateButton = new JButton("Generate");
    this.cancelButton = new JButton("Close");
    this.saveSqlButton = new JButton("Save SQL");
    this.dropTables = new JCheckBox("Drop Tables");
    this.createTables = new JCheckBox("Create Tables");
    this.createFK = new JCheckBox("Create FK Support");
    this.createPK = new JCheckBox("Create Primary Key Support");
    this.dropPK = new JCheckBox("Drop Primary Key Support");
    this.tables = tables;
    this.tabs = new JTabbedPane(SwingConstants.TOP);
    this.adapters = new JComboBox();
    adapters.setEditable(true);//from  w w w.java 2s .  c  o  m
    this.sql = new JTextArea();
    sql.setEditable(false);
    sql.setLineWrap(true);
    sql.setWrapStyleWord(true);

    // assemble...
    JPanel optionsPane = new JPanel(new GridLayout(3, 2));
    optionsPane.add(dropTables);
    optionsPane.add(createTables);
    optionsPane.add(new JLabel());
    optionsPane.add(createFK);
    optionsPane.add(dropPK);
    optionsPane.add(createPK);

    JPanel sqlTextPanel = new JPanel(new BorderLayout());
    sqlTextPanel.add(new JScrollPane(sql, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);

    JPanel adapterPanel = new JPanel(new BorderLayout());
    adapterPanel.add(adapters);

    CellConstraints cc = new CellConstraints();
    PanelBuilder builder = new PanelBuilder(new FormLayout("fill:min(50dlu;pref):grow",
            "p, 3dlu, p, 9dlu, p, 3dlu, p, 3dlu, p, 3dlu, fill:40dlu:grow"));
    builder.setDefaultDialogBorder();
    builder.addSeparator("Options", cc.xywh(1, 1, 1, 1));
    builder.add(optionsPane, cc.xy(1, 3, "left,fill"));
    builder.addSeparator("Adapter", cc.xywh(1, 5, 1, 1));
    builder.add(adapterPanel, cc.xy(1, 7));
    builder.addSeparator("Generated SQL", cc.xywh(1, 9, 1, 1));
    builder.add(sqlTextPanel, cc.xy(1, 11));

    tabs.addTab("SQL Options", builder.getPanel());
    tabs.addTab("Tables", new JScrollPane(tables, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED));

    // we need the right preferred size so that dialog "pack()" produces decent
    // default size...
    tabs.setPreferredSize(new Dimension(450, 500));

    JPanel buttons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttons.add(saveSqlButton);
    buttons.add(Box.createHorizontalStrut(20));
    buttons.add(cancelButton);
    buttons.add(generateButton);

    Container contentPane = this.getContentPane();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(tabs, BorderLayout.CENTER);
    contentPane.add(buttons, BorderLayout.SOUTH);
}

From source file:org.apache.cayenne.modeler.dialog.db.gen.DBGeneratorOptionsView.java

License:Apache License

public DBGeneratorOptionsView(Component tables) {
    // create widgets
    this.generateButton = new JButton("Generate");
    getRootPane().setDefaultButton(generateButton);
    this.cancelButton = new JButton("Cancel");
    this.saveSqlButton = new JButton("Save SQL");
    this.dropTables = new JCheckBox("Drop Tables");
    this.createTables = new JCheckBox("Create Tables");
    this.createFK = new JCheckBox("Create FK Support");
    this.createPK = new JCheckBox("Create Primary Key Support");
    this.dropPK = new JCheckBox("Drop Primary Key Support");
    this.tables = tables;
    this.tabs = new JTabbedPane(SwingConstants.TOP);
    this.adapters = new JComboBox<>();
    adapters.setEditable(true);//from   w  w w. j a  v  a  2 s  .c  om
    this.sql = new JTextArea();
    sql.setEditable(false);
    sql.setLineWrap(true);
    sql.setWrapStyleWord(true);

    // assemble...
    JPanel optionsPane = new JPanel(new GridLayout(3, 2));
    optionsPane.add(dropTables);
    optionsPane.add(createTables);
    optionsPane.add(new JLabel());
    optionsPane.add(createFK);
    optionsPane.add(dropPK);
    optionsPane.add(createPK);

    JPanel sqlTextPanel = new JPanel(new BorderLayout());
    sqlTextPanel.add(new JScrollPane(sql, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);

    JPanel adapterPanel = new JPanel(new BorderLayout());
    adapterPanel.add(adapters);

    CellConstraints cc = new CellConstraints();
    PanelBuilder builder = new PanelBuilder(new FormLayout("fill:min(50dlu;pref):grow",
            "p, 3dlu, p, 9dlu, p, 3dlu, p, 3dlu, p, 3dlu, fill:40dlu:grow"));
    builder.addSeparator("Options", cc.xywh(1, 1, 1, 1));
    builder.add(optionsPane, cc.xy(1, 3, "left,fill"));
    builder.addSeparator("Adapter", cc.xywh(1, 5, 1, 1));
    builder.add(adapterPanel, cc.xy(1, 7));
    builder.addSeparator("Generated SQL", cc.xywh(1, 9, 1, 1));
    builder.add(sqlTextPanel, cc.xy(1, 11));
    builder.setBorder(
            BorderFactory.createCompoundBorder(UIManager.getBorder("ToolBar.border"), Borders.DIALOG_BORDER));

    tabs.addTab("SQL Options", builder.getPanel());
    tabs.addTab("Tables", new JScrollPane(tables, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED));

    // we need the right preferred size so that dialog "pack()" produces decent
    // default size...
    tabs.setPreferredSize(new Dimension(450, 500));
    tabs.setFocusable(false);

    JPanel buttons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttons.add(saveSqlButton);
    buttons.add(Box.createHorizontalStrut(20));
    buttons.add(cancelButton);
    buttons.add(generateButton);
    buttons.setBorder(TopBorder.create());

    Container contentPane = this.getContentPane();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(tabs, BorderLayout.CENTER);
    contentPane.add(buttons, BorderLayout.SOUTH);
}

From source file:org.apache.cayenne.modeler.dialog.db.merge.MergerOptionsView.java

License:Apache License

public MergerOptionsView(Component tables) {
    super(Application.getFrame());

    // create widgets
    this.generateButton = new JButton("Migrate");
    getRootPane().setDefaultButton(generateButton);
    this.cancelButton = new JButton("Cancel");
    this.saveSqlButton = new JButton("Save SQL");

    this.tables = tables;
    this.tabs = new JTabbedPane(SwingConstants.TOP);
    this.tabs.setFocusable(false);
    this.sql = new JTextArea();
    sql.setEditable(false);//from  www  . ja va  2  s.  co m
    sql.setLineWrap(true);
    sql.setWrapStyleWord(true);

    getRootPane().setDefaultButton(generateButton);
    JPanel sqlTextPanel = new JPanel(new BorderLayout());
    sqlTextPanel.add(new JScrollPane(sql, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);

    CellConstraints cc = new CellConstraints();
    PanelBuilder builder = new PanelBuilder(
            new FormLayout("fill:min(50dlu;pref):grow", "p, 9dlu, p, 3dlu, fill:40dlu:grow"));
    builder.addSeparator("Generated SQL", cc.xywh(1, 3, 1, 1));
    builder.add(sqlTextPanel, cc.xy(1, 5));
    builder.setBorder(
            BorderFactory.createCompoundBorder(UIManager.getBorder("ToolBar.border"), Borders.DIALOG_BORDER));

    tabs.addTab("Operations", new JScrollPane(tables, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED));
    tabs.addTab("Generated SQL", builder.getPanel());

    // we need the right preferred size so that dialog "pack()" produces decent
    // default size...
    tabs.setPreferredSize(new Dimension(600, 350));

    JPanel buttons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttons.add(saveSqlButton);
    buttons.add(Box.createHorizontalStrut(20));
    buttons.add(cancelButton);
    buttons.add(generateButton);
    buttons.setBorder(TopBorder.create());

    Container contentPane = this.getContentPane();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(tabs, BorderLayout.CENTER);
    contentPane.add(buttons, BorderLayout.SOUTH);
}

From source file:org.apache.cayenne.modeler.dialog.db.MergerOptionsView.java

License:Apache License

public MergerOptionsView(Component tables) {
    super(Application.getFrame());

    // create widgets
    this.generateButton = new JButton("Migrate");
    this.cancelButton = new JButton("Close");
    this.saveSqlButton = new JButton("Save SQL");

    this.tables = tables;
    this.tabs = new JTabbedPane(SwingConstants.TOP);
    this.sql = new JTextArea();
    sql.setEditable(false);//from w  w  w  .  j  a  v a 2s.co  m
    sql.setLineWrap(true);
    sql.setWrapStyleWord(true);

    JPanel sqlTextPanel = new JPanel(new BorderLayout());
    sqlTextPanel.add(new JScrollPane(sql, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);

    CellConstraints cc = new CellConstraints();
    PanelBuilder builder = new PanelBuilder(
            new FormLayout("fill:min(50dlu;pref):grow", "p, 9dlu, p, 3dlu, fill:40dlu:grow"));
    builder.setDefaultDialogBorder();
    builder.addSeparator("Generated SQL", cc.xywh(1, 3, 1, 1));
    builder.add(sqlTextPanel, cc.xy(1, 5));

    tabs.addTab("Operations", new JScrollPane(tables, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED));
    tabs.addTab("Generated SQL", builder.getPanel());

    // we need the right preferred size so that dialog "pack()" produces decent
    // default size...
    tabs.setPreferredSize(new Dimension(600, 350));

    JPanel buttons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttons.add(saveSqlButton);
    buttons.add(Box.createHorizontalStrut(20));
    buttons.add(cancelButton);
    buttons.add(generateButton);

    Container contentPane = this.getContentPane();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(tabs, BorderLayout.CENTER);
    contentPane.add(buttons, BorderLayout.SOUTH);
}

From source file:org.apache.cayenne.modeler.dialog.objentity.DbRelationshipTargetView.java

License:Apache License

public DbRelationshipTargetView(DbEntity source1, DbEntity source2) {
    super(Application.getFrame());

    widgetFactory = new DefaultWidgetFactory();

    // create widgets
    saveButton = new JButton("Continue");
    saveButton.setEnabled(true);//from  w w  w  .  ja  v  a 2  s  . co m

    cancelButton = new JButton("Cancel");
    cancelButton.setEnabled(true);

    targetCombo = widgetFactory.createComboBox();
    targetCombo.setVisible(true);

    source1Button = new JRadioButton();
    source2Button = new JRadioButton();
    source2Button.setEnabled(source2 != null);

    getRootPane().setDefaultButton(saveButton);

    ButtonGroup bg = new ButtonGroup();
    bg.add(source1Button);
    bg.add(source2Button);

    toManyCheckBox = new JCheckBox();

    setTitle("Create New DbRelationship");
    setLayout(new BorderLayout());

    CellConstraints cc = new CellConstraints();
    PanelBuilder builder = new PanelBuilder(
            new FormLayout("right:max(100dlu;pref), 3dlu, fill:min(150dlu;pref)",
                    "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, top:p:grow"));
    builder.setDefaultDialogBorder();

    builder.addLabel("Source: " + source1.getName(), cc.xy(1, 1));
    builder.add(source1Button, cc.xy(3, 1));

    builder.addLabel("Source: " + (source2 == null ? "" : source2.getName()), cc.xy(1, 3));
    builder.add(source2Button, cc.xy(3, 3));

    builder.addLabel("Target:", cc.xy(1, 5));
    builder.add(targetCombo, cc.xywh(3, 5, 1, 1));

    builder.addLabel("To Many:", cc.xy(1, 7));
    builder.add(toManyCheckBox, cc.xywh(3, 7, 1, 1));

    add(builder.getPanel(), BorderLayout.CENTER);
    JButton[] buttons = { cancelButton, saveButton };
    add(PanelFactory.createButtonPanel(buttons), BorderLayout.SOUTH);
}