Example usage for com.jgoodies.forms.layout Sizes PREFERRED

List of usage examples for com.jgoodies.forms.layout Sizes PREFERRED

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout Sizes PREFERRED.

Prototype

ComponentSize PREFERRED

To view the source code for com.jgoodies.forms.layout Sizes PREFERRED.

Click Source Link

Document

Use the maximum of all component preferred sizes as column or row size.

Usage

From source file:NewLinksDialog.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - unknown
    ResourceBundle bundle = ResourceBundle.getBundle("NewLinksDialog");
    JPanel dialogPane = new JPanel();
    JPanel contentPanel = new JPanel();
    JLabel labelLinks = new JLabel();
    JScrollPane scrollPane1 = new JScrollPane();
    JEditorPane urlsArea = ComponentFactory.getURLsEditorPane();
    JLabel labelSaveTo = new JLabel();
    comboPath = new JComboBox();
    btnSelectPath = new JButton();
    JLabel labelDescription = new JLabel();
    JScrollPane scrollPane2 = new JScrollPane();
    descriptionArea = ComponentFactory.getTextArea();
    JXButtonPanel buttonBar = new JXButtonPanel();
    btnPasteFromClipboard = new JButton();
    okButton = new JButton();
    btnStartPaused = new JButton();
    cancelButton = new JButton();
    CellConstraints cc = new CellConstraints();

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

    //======== dialogPane ========
    {/*w ww  . ja  v  a2  s.  com*/
        dialogPane.setBorder(Borders.DIALOG);
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {

            //---- labelLinks ----
            labelLinks.setText(bundle.getString("labelLinks.text"));
            labelLinks.setLabelFor(urlsArea);

            //======== scrollPane1 ========
            {
                scrollPane1.setViewportView(urlsArea);
            }

            //---- labelSaveTo ----
            labelSaveTo.setText(bundle.getString("labelSaveTo.text"));
            labelSaveTo.setLabelFor(comboPath);

            //---- comboPath ----
            comboPath.setEditable(true);

            //---- btnSelectPath ----
            btnSelectPath.setText(bundle.getString("btnSelectPath.text"));

            //---- labelDescription ----
            labelDescription.setText(bundle.getString("labelDescription.text"));
            labelDescription.setLabelFor(descriptionArea);

            //======== scrollPane2 ========
            {
                scrollPane2.setViewportView(descriptionArea);
            }

            PanelBuilder contentPanelBuilder = new PanelBuilder(new FormLayout(
                    new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(ColumnSpec.FILL, Sizes.PREFERRED, FormSpec.DEFAULT_GROW),
                            FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.MIN_COLSPEC },
                    new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                            new RowSpec(RowSpec.FILL, Sizes.PREFERRED, FormSpec.DEFAULT_GROW),
                            FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                            new RowSpec(RowSpec.FILL,
                                    Sizes.bounded(Sizes.PREFERRED, Sizes.dluY(40), Sizes.dluY(55)),
                                    FormSpec.DEFAULT_GROW) }),
                    contentPanel);

            contentPanelBuilder.add(labelLinks, cc.xy(1, 1));
            contentPanelBuilder.add(scrollPane1, cc.xywh(1, 3, 5, 1));
            contentPanelBuilder.add(labelSaveTo, cc.xy(1, 5));
            contentPanelBuilder.add(comboPath, cc.xy(3, 5));
            contentPanelBuilder.add(btnSelectPath, cc.xy(5, 5));
            contentPanelBuilder.add(labelDescription, cc.xy(1, 7));
            contentPanelBuilder.add(scrollPane2, cc.xywh(3, 7, 3, 1));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));

            //---- btnPasteFromClipboard ----
            btnPasteFromClipboard.setText(bundle.getString("btnPasteFromClipboard.text"));

            //---- okButton ----
            okButton.setText(bundle.getString("okButton.text"));

            //---- btnStartPaused ----
            btnStartPaused.setText(bundle.getString("btnStartPaused.text"));

            //---- cancelButton ----
            cancelButton.setText(bundle.getString("cancelButton.text"));

            PanelBuilder buttonBarBuilder = new PanelBuilder(new FormLayout(
                    new ColumnSpec[] { FormSpecs.PREF_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                            FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.PREF_COLSPEC,
                            FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.PREF_COLSPEC,
                            FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC },
                    RowSpec.decodeSpecs("fill:pref")), buttonBar);
            ((FormLayout) buttonBar.getLayout()).setColumnGroups(new int[][] { { 5, 7, 9 } });

            buttonBarBuilder.add(btnPasteFromClipboard, cc.xy(1, 1));
            buttonBarBuilder.add(okButton, cc.xy(5, 1));
            buttonBarBuilder.add(btnStartPaused, cc.xy(7, 1));
            buttonBarBuilder.add(cancelButton, cc.xy(9, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:InformationDialog.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - unknown
    ResourceBundle bundle = ResourceBundle.getBundle("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 ========
    {//from  w  ww . j ava  2  s . c o  m
        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
}

From source file:MultipleSettingsDialog.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - unknown
    ResourceBundle bundle = ResourceBundle.getBundle("MultipleSettingsDialog");
    JPanel dialogPane = new JPanel();
    JPanel contentPanel = new JPanel();
    JLabel iconLabel = new JLabel();
    titleLabel = new JLabel();
    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();
    JXButtonPanel buttonBar = new JXButtonPanel();
    okButton = new JButton();
    cancelButton = new JButton();
    CellConstraints cc = new CellConstraints();

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

    //======== dialogPane ========
    {/* w w w. ja va2 s  . c  om*/
        dialogPane.setBorder(Borders.DIALOG);
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {

            //---- iconLabel ----
            iconLabel.setText(bundle.getString("iconLabel.text"));

            //---- titleLabel ----
            titleLabel.setText(bundle.getString("titleLabel.text"));
            titleLabel.setFont(new Font("Tahoma", Font.BOLD, 12));

            //---- labelSize ----
            labelSize.setText(bundle.getString("labelSize.text"));

            //---- fieldSize ----
            fieldSize.setBorder(null);
            fieldSize.setOpaque(false);
            fieldSize.setEditable(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));
            }

            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, ColumnSpec.decode("max(min;70dlu)") },
                    new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                            FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC,
                            new RowSpec(RowSpec.TOP, Sizes.PREFERRED, FormSpec.NO_GROW),
                            FormSpecs.RELATED_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 }),
                    contentPanel);

            contentPanelBuilder.add(iconLabel,
                    cc.xywh(1, 1, 1, 5, CellConstraints.DEFAULT, CellConstraints.FILL));
            contentPanelBuilder.add(titleLabel, cc.xywh(3, 1, 5, 1));
            contentPanelBuilder.add(labelSize, cc.xy(3, 3));
            contentPanelBuilder.add(fieldSize, cc.xywh(5, 3, 3, 1));
            contentPanelBuilder.add(labelDescription, cc.xy(1, 7));
            contentPanelBuilder.add(scrollPane1, cc.xywh(1, 9, 7, 1));
            contentPanelBuilder.add(optionsPanel, cc.xywh(1, 11, 7, 1));
        }
        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
}

From source file:ConnectDialog.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - unknown
    ResourceBundle bundle = ResourceBundle.getBundle("ConnectDialog");
    dialogPane = new JPanel();
    JPanel contentPanel = new JPanel();
    JLabel labelHostName = new JLabel();
    fieldHostName = new JTextField();
    JLabel labelPortNumber = new JLabel();
    fieldPort = new JTextField();
    checkAuthentification = new JCheckBox();
    labelLoginName = new JLabel();
    fieldUserName = new JTextField();
    labelPassword = new JLabel();
    fieldPassword = new JPasswordField();
    checkStorePassword = new JCheckBox();
    labelWarning = new JLabel();
    JXButtonPanel buttonBar = new JXButtonPanel();
    btnOk = new JButton();
    btnCancel = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setTitle(bundle.getString("this.title"));
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {/*from w  w w .j a  va  2 s . c  om*/
        dialogPane.setBorder(Borders.DIALOG);
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            contentPanel.setLayout(new FormLayout(
                    new ColumnSpec[] { FormSpecs.PREF_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(ColumnSpec.FILL, Sizes.PREFERRED, FormSpec.DEFAULT_GROW),
                            FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                            FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC },
                    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,
                            FormSpecs.DEFAULT_ROWSPEC }));

            //---- labelHostName ----
            labelHostName.setText(bundle.getString("labelHostName.text"));
            labelHostName.setLabelFor(fieldHostName);
            contentPanel.add(labelHostName, cc.xy(1, 1));

            //---- fieldHostName ----
            fieldHostName.setColumns(8);
            contentPanel.add(fieldHostName, cc.xy(3, 1));

            //---- labelPortNumber ----
            labelPortNumber.setText(bundle.getString("labelPortNumber.text"));
            labelPortNumber.setLabelFor(fieldPort);
            contentPanel.add(labelPortNumber, cc.xy(5, 1));

            //---- fieldPort ----
            fieldPort.setColumns(6);
            contentPanel.add(fieldPort, cc.xy(7, 1));

            //---- checkAuthentification ----
            checkAuthentification.setText(bundle.getString("checkAuthentification.text"));
            contentPanel.add(checkAuthentification, new CellConstraints(1, 3, 3, 1, CellConstraints.DEFAULT,
                    CellConstraints.DEFAULT, new Insets(0, 7, 0, 0)));

            //---- labelLoginName ----
            labelLoginName.setText(bundle.getString("labelLoginName.text"));
            labelLoginName.setLabelFor(fieldUserName);
            contentPanel.add(labelLoginName, cc.xy(1, 5));
            contentPanel.add(fieldUserName, cc.xy(3, 5));

            //---- labelPassword ----
            labelPassword.setText(bundle.getString("labelPassword.text"));
            labelPassword.setLabelFor(fieldPassword);
            contentPanel.add(labelPassword, cc.xy(1, 7));
            contentPanel.add(fieldPassword, cc.xy(3, 7));

            //---- checkStorePassword ----
            checkStorePassword.setText(bundle.getString("checkStorePassword.text"));
            contentPanel.add(checkStorePassword, cc.xywh(5, 7, 3, 1));

            //---- labelWarning ----
            labelWarning.setText(bundle.getString("labelWarning.text"));
            labelWarning.setForeground(Color.red);
            contentPanel.add(labelWarning, cc.xywh(1, 9, 7, 1));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_PAD);
            buttonBar.setLayout(new FormLayout(
                    new ColumnSpec[] { FormSpecs.GLUE_COLSPEC, FormSpecs.BUTTON_COLSPEC,
                            FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.BUTTON_COLSPEC },
                    RowSpec.decodeSpecs("pref")));
            ((FormLayout) buttonBar.getLayout()).setColumnGroups(new int[][] { { 2, 4 } });

            //---- btnOk ----
            btnOk.setText(bundle.getString("btnOk.text"));
            buttonBar.add(btnOk, cc.xy(2, 1));

            //---- btnCancel ----
            btnCancel.setText(bundle.getString("btnCancel.text"));
            buttonBar.add(btnCancel, cc.xy(4, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:anl.verdi.gui.LayerPanel.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance();
    chkEnable = new JCheckBox();
    label1 = compFactory.createLabel("Min:");
    minSpinner = new JSpinner();
    label2 = compFactory.createLabel("Max:");
    maxSpinner = new JSpinner();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setBorder(new TitledBorder("Layers"));

    // 2014 - underlying jgoodies class changed
    ColumnSpec[] aColumnSpec = ColumnSpec.decodeSpecs("max(default;10dlu)");
    ColumnSpec[] bColumnSpec = ColumnSpec.decodeSpecs("max(pref;30dlu)");
    ColumnSpec cColumnSpec = new ColumnSpec(ColumnSpec.FILL, Sizes.PREFERRED, FormSpec.DEFAULT_GROW);
    setLayout(new FormLayout(
            new ColumnSpec[] { aColumnSpec[0], FormFactory.DEFAULT_COLSPEC,
                    FormFactory.LABEL_COMPONENT_GAP_COLSPEC, bColumnSpec[0],
                    FormFactory.LABEL_COMPONENT_GAP_COLSPEC, cColumnSpec },
            new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                    FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));
    //      setLayout(new FormLayout(
    //            new ColumnSpec[] {
    //               new ColumnSpec("max(default;10dlu)"),
    //               FormFactory.DEFAULT_COLSPEC,
    //               FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
    //               new ColumnSpec("max(pref;30dlu)"),
    //               FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
    //               new ColumnSpec(ColumnSpec.FILL, Sizes.PREFERRED, FormSpec.DEFAULT_GROW)
    //            },
    //            new RowSpec[] {
    //               FormFactory.DEFAULT_ROWSPEC,
    //               FormFactory.LINE_GAP_ROWSPEC,
    //               FormFactory.DEFAULT_ROWSPEC,
    //               FormFactory.LINE_GAP_ROWSPEC,
    //               FormFactory.DEFAULT_ROWSPEC
    //            }));

    //---- chkEnable ----
    chkEnable.setText("Use Layer Range");
    add(chkEnable, cc.xywh(1, 1, 6, 1));
    add(label1, cc.xy(2, 3));//from  w w  w.  ja v a 2 s .co  m
    add(minSpinner, cc.xy(4, 3));
    add(label2, cc.xy(2, 5));
    add(maxSpinner, cc.xy(4, 5));
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:anl.verdi.plot.anim.MultiPlotAnimation.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance();
    separator1 = compFactory.createSeparator("Select Plots");
    scrollPane1 = new JScrollPane();
    plotList = new CheckBoxList();
    panel1 = new JPanel();
    label1 = new JLabel();
    startSpinner = new JSpinner();
    startLbl = new JLabel();
    label2 = new JLabel();
    endSpinner = new JSpinner();
    endLbl = new JLabel();
    panel2 = new JPanel();
    gifChk = new JCheckBox();
    gifFileLbl = new JLabel();
    gifFileBtn = new JButton();
    separator2 = compFactory.createSeparator("");
    CellConstraints cc = new CellConstraints();

    //======== this ========
    // 2014// w  w w  . j ava 2 s  . co m
    ColumnSpec[] aColumnSpec = ColumnSpec.decodeSpecs("default:grow");
    RowSpec aRowSpec = new RowSpec(RowSpec.TOP, Sizes.dluY(84), 0.5);
    RowSpec bRowSpec = new RowSpec(RowSpec.FILL, Sizes.PREFERRED, 0.5);
    setLayout(new FormLayout(aColumnSpec,
            new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, aRowSpec,
                    FormFactory.RELATED_GAP_ROWSPEC, bRowSpec, FormFactory.RELATED_GAP_ROWSPEC,
                    FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));
    //      setLayout(new FormLayout(
    //            ColumnSpec.decodeSpecs("default:grow"),
    //            new RowSpec[] {
    //               FormFactory.DEFAULT_ROWSPEC,
    //               FormFactory.RELATED_GAP_ROWSPEC,
    //               new RowSpec(RowSpec.TOP, Sizes.dluY(84), 0.5),
    //               FormFactory.RELATED_GAP_ROWSPEC,
    //               new RowSpec(RowSpec.FILL, Sizes.PREFERRED, 0.5),
    //               FormFactory.RELATED_GAP_ROWSPEC,
    //               FormFactory.DEFAULT_ROWSPEC,
    //               FormFactory.LINE_GAP_ROWSPEC,
    //               FormFactory.DEFAULT_ROWSPEC
    //            }));
    add(separator1, cc.xy(1, 1));

    //======== scrollPane1 ========
    {
        scrollPane1.setViewportView(plotList);
    }
    add(scrollPane1, cc.xy(1, 3));

    //======== panel1 ========
    {
        // 2014
        ColumnSpec[] dColumnSpec = ColumnSpec.decodeSpecs("max(pref;40dlu)");
        ColumnSpec[] eColumnSpec = ColumnSpec.decodeSpecs("max(pref;40dlu):grow");
        panel1.setLayout(new FormLayout(
                new ColumnSpec[] { new ColumnSpec(Sizes.dluX(71)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        dColumnSpec[0], FormFactory.UNRELATED_GAP_COLSPEC, eColumnSpec[0] },
                new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                        FormFactory.DEFAULT_ROWSPEC }));
        //         panel1.setLayout(new FormLayout(
        //               new ColumnSpec[] {
        //                  new ColumnSpec(Sizes.dluX(71)),
        //                  FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
        //                  new ColumnSpec("max(pref;40dlu)"),
        //                  FormFactory.UNRELATED_GAP_COLSPEC,
        //                  new ColumnSpec("max(pref;40dlu):grow")
        //               },
        //               new RowSpec[] {
        //                  FormFactory.DEFAULT_ROWSPEC,
        //                  FormFactory.LINE_GAP_ROWSPEC,
        //                  FormFactory.DEFAULT_ROWSPEC
        //               }));

        //---- label1 ----
        label1.setText("Starting Time Step:");
        panel1.add(label1, cc.xy(1, 1));
        panel1.add(startSpinner, cc.xy(3, 1));

        //---- startLbl ----
        startLbl.setFont(new Font("Tahoma", Font.BOLD, 11));
        panel1.add(startLbl, cc.xy(5, 1));

        //---- label2 ----
        label2.setText("Ending Time Step:");
        panel1.add(label2, cc.xy(1, 3));
        panel1.add(endSpinner, cc.xy(3, 3));

        //---- endLbl ----
        endLbl.setFont(new Font("Tahoma", Font.BOLD, 11));
        panel1.add(endLbl, cc.xy(5, 3));
    }
    add(panel1, cc.xywh(1, 5, 1, 1, CellConstraints.DEFAULT, CellConstraints.TOP));

    //======== panel2 ========
    {
        // 2014
        ColumnSpec fColumnSpec = new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW);
        RowSpec[] fRowSpec = RowSpec.decodeSpecs("default");
        panel2.setLayout(new FormLayout(
                new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                        fColumnSpec, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC },
                fRowSpec));
        //         panel2.setLayout(new FormLayout(
        //               new ColumnSpec[] {
        //                  FormFactory.DEFAULT_COLSPEC,
        //                  FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
        //                  new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
        //                  FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
        //                  FormFactory.DEFAULT_COLSPEC
        //               },
        //               RowSpec.decodeSpecs("default")));

        //---- gifChk ----
        gifChk.setText("Make Animated GIF(s)");
        panel2.add(gifChk, cc.xy(1, 1));
        panel2.add(gifFileLbl, cc.xy(3, 1));

        //---- gifFileBtn ----
        gifFileBtn.setText("...");
        gifFileBtn.setMaximumSize(new Dimension(23, 23));
        gifFileBtn.setMinimumSize(new Dimension(23, 23));
        gifFileBtn.setPreferredSize(new Dimension(23, 23));
        gifFileBtn.setEnabled(false);
        panel2.add(gifFileBtn, cc.xy(5, 1));
    }
    add(panel2, cc.xy(1, 7));
    add(separator2, cc.xy(1, 9));
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:anl.verdi.plot.gui.FastObsOverlayDialog.java

public void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance();
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    statusLbl = new JLabel();
    separator1 = compFactory.createSeparator("Observation Details");
    separator2 = compFactory.createSeparator("Selected Observation Variable(s)");
    scrollPane1 = new JScrollPane();
    varList = new JList();
    label1 = new JLabel();
    showLegend = new JCheckBox("Show symbols legend", true);
    strokeSpn = new JSpinner();
    strokeSpn.addChangeListener(new ChangeListener() {

        @Override// ww  w.ja  v  a  2s .  c om
        public void stateChanged(ChangeEvent e) {
            editOverlayObject();
        }

    });
    label2 = new JLabel();
    shapeSpn = new JSpinner();
    shapeSpn.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            editOverlayObject();
        }

    });
    buttonBar = new JPanel();
    okButton = new JButton();
    cancelButton = new JButton();
    overlayListPanel = new VerdiListPanel("Variable");
    overlayListPanel.addPropertyChangeListener(VerdiConstants.VERDI_LIST_OBJECT, this);
    overlayListPanel.addPropertyChangeListener(VerdiConstants.VERDI_LIST_OBJECT_NUMBER, this);
    String verdiHome = Tools.getVerdiHome(); // 2014 new method for reading in an image file
    String separator = "/"; // use forward slash only for constructor ImageIcon(String filename);
    String pathName = verdiHome + separator + "plugins" + separator + "core" + separator + "icons" + separator;
    String fileCircle = new String(pathName + "circle.png");
    String fileDiamond = new String(pathName + "diamond.png");
    String fileSquare = new String(pathName + "square.png");
    String fileStar = new String(pathName + "star.png");
    String fileSun = new String(pathName + "sun.png");
    String fileTriangle = new String(pathName + "triangle.png");

    names = new Symbol[] { Symbol.CIRCLE, Symbol.DIAMOND, Symbol.SQUARE, Symbol.STAR, Symbol.SUN,
            Symbol.TRIANGLE };
    symbols = new Icon[] { new ImageIcon(fileCircle), new ImageIcon(fileDiamond), new ImageIcon(fileSquare),
            new ImageIcon(fileStar), new ImageIcon(fileSun), new ImageIcon(fileTriangle)
            //            new ImageIcon(getClass().getResource("/circle.png")),
            //            new ImageIcon(getClass().getResource("/diamond.png")),
            //            new ImageIcon(getClass().getResource("/square.png")),
            //            new ImageIcon(getClass().getResource("/star.png")),
            //            new ImageIcon(getClass().getResource("/sun.png")),
            //            new ImageIcon(getClass().getResource("/triangle.png"))
    };
    symList = new JComboBox(names);

    label3 = new JLabel();
    symPanel = new JPanel(new BorderLayout());
    selectedImg = new JLabel();
    selectedImg.setIcon(symbols[0]);

    symPanel.add(selectedImg, BorderLayout.LINE_START);
    symPanel.add(symList, BorderLayout.LINE_END);

    symList.addActionListener(new AbstractAction() {
        private static final long serialVersionUID = -5121239000837587642L;

        @Override
        public void actionPerformed(ActionEvent e) {
            int index = ((JComboBox) e.getSource()).getSelectedIndex();
            selectedImg.setIcon(symbols[index]);
            editOverlayObject();
        }

    });

    CellConstraints cc = new CellConstraints();

    //======== this ========
    setTitle("Observation Dialog");
    setModal(true);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            // 2014
            ColumnSpec aColumnSpec = new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, 0.6);
            ColumnSpec bColumnSpec = new ColumnSpec(ColumnSpec.FILL, Sizes.PREFERRED, 0.5);
            contentPanel.setLayout(new FormLayout(
                    new ColumnSpec[] { aColumnSpec, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            FormFactory.RELATED_GAP_COLSPEC, bColumnSpec },
                    new RowSpec[] { FormFactory.PREF_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 }));
            //            contentPanel.setLayout(new FormLayout(
            //                  new ColumnSpec[] {
            //                     new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, 0.6),
            //                     FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
            //                     FormFactory.RELATED_GAP_COLSPEC,
            //                     new ColumnSpec(ColumnSpec.FILL, Sizes.PREFERRED, 0.5)
            //                  },
            //                  new RowSpec[] {
            //                     FormFactory.PREF_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
            //                  }));

            //---- statusLbl ----
            statusLbl.setForeground(Color.red);
            contentPanel.add(statusLbl, cc.xywh(1, 1, 4, 1));
            contentPanel.add(separator1, cc.xywh(1, 3, 4, 1));

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

                //---- varList ----
                varList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                scrollPane1.setViewportView(varList);
            }
            contentPanel.add(scrollPane1, cc.xywh(1, 5, 1, 11));

            //---- label1 ----
            label1.setText("Stroke Size:");
            contentPanel.add(label1, cc.xywh(3, 5, 2, 1));

            //---- strokeSpn ----
            strokeSpn.setModel(new SpinnerNumberModel(1, 1, null, 1));
            contentPanel.add(strokeSpn, cc.xy(4, 7));

            //---- label2 ----
            label2.setText("Shape Size:");
            contentPanel.add(label2, cc.xywh(3, 9, 2, 1));

            //---- shapeSpn ----
            shapeSpn.setModel(new SpinnerNumberModel(8, 1, null, 1));
            contentPanel.add(shapeSpn, cc.xy(4, 11));

            //---- label3 ----
            label3.setText("Symbol:");
            contentPanel.add(label3, cc.xywh(3, 13, 2, 1));

            //---- symPanel ----
            contentPanel.add(symPanel, cc.xy(4, 15));

            //---- separator2 ----
            contentPanel.add(separator2, cc.xywh(1, 17, 4, 1));

            //---- overlayListPanel ----
            contentPanel.add(overlayListPanel, cc.xywh(1, 19, 4, 1));

            //---- showLegend ----
            contentPanel.add(showLegend, cc.xy(1, 21));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

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

            //---- 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(520, 520);
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:anl.verdi.plot.gui.ObsOverlayDialog.java

protected void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance();
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    statusLbl = new JLabel();
    separator1 = compFactory.createSeparator("Observation Details");
    scrollPane1 = new JScrollPane();
    varList = new JList();
    label1 = new JLabel();
    strokeSpn = new JSpinner();
    label2 = new JLabel();
    shapeSpn = new JSpinner();
    buttonBar = new JPanel();
    okButton = new JButton();
    cancelButton = new JButton();

    String verdiHome = Tools.getVerdiHome(); // 2014 new method for reading in an image file
    String separator = "/"; // use forward slash only for constructor ImageIcon(String filename);
    String pathName = verdiHome + separator + "plugins" + separator + "core" + separator + "icons" + separator;
    String fileCircle = new String(pathName + "circle.png");
    String fileDiamond = new String(pathName + "diamond.png");
    String fileSquare = new String(pathName + "square.png");
    String fileStar = new String(pathName + "star.png");
    String fileSun = new String(pathName + "sun.png");
    String fileTriangle = new String(pathName + "triangle.png");

    names = new Symbol[] { Symbol.CIRCLE, Symbol.DIAMOND, Symbol.SQUARE, Symbol.STAR, Symbol.SUN,
            Symbol.TRIANGLE };/*from w w w .  j  a v  a  2s  . co m*/
    symbols = new Icon[] { new ImageIcon(fileCircle), new ImageIcon(fileDiamond), new ImageIcon(fileSquare),
            new ImageIcon(fileStar), new ImageIcon(fileSun), new ImageIcon(fileTriangle)
            //            new ImageIcon(getClass().getResource("/circle.png")),
            //            new ImageIcon(getClass().getResource("/diamond.png")),
            //            new ImageIcon(getClass().getResource("/square.png")),
            //            new ImageIcon(getClass().getResource("/star.png")),
            //            new ImageIcon(getClass().getResource("/sun.png")),
            //            new ImageIcon(getClass().getResource("/triangle.png"))
    };
    symList = new JComboBox(names);

    label3 = new JLabel();
    symPanel = new JPanel(new BorderLayout());
    selectedImg = new JLabel();
    selectedImg.setIcon(symbols[0]);

    symPanel.add(selectedImg, BorderLayout.LINE_START);
    symPanel.add(symList, BorderLayout.LINE_END);

    symList.addActionListener(new AbstractAction() {
        private static final long serialVersionUID = -5121239000837587642L;

        @Override
        public void actionPerformed(ActionEvent e) {
            int index = ((JComboBox) e.getSource()).getSelectedIndex();
            selectedImg.setIcon(symbols[index]);
        }

    });

    CellConstraints cc = new CellConstraints();

    //======== this ========
    setTitle("Observation Dialog");
    setModal(true);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            // 2014
            ColumnSpec aColumnSpec = new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, 0.6);
            ColumnSpec bColumnSpec = new ColumnSpec(ColumnSpec.FILL, Sizes.PREFERRED, 0.5);
            contentPanel.setLayout(new FormLayout(
                    new ColumnSpec[] { aColumnSpec, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            FormFactory.RELATED_GAP_COLSPEC, bColumnSpec },
                    new RowSpec[] { FormFactory.PREF_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 }));
            //            new ColumnSpec[] {
            //                  new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, 0.6),
            //                  FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
            //                  FormFactory.RELATED_GAP_COLSPEC,
            //                  new ColumnSpec(ColumnSpec.FILL, Sizes.PREFERRED, 0.5)
            //               },
            //               new RowSpec[] {
            //                  FormFactory.PREF_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
            //               }));

            //---- statusLbl ----
            statusLbl.setForeground(Color.red);
            contentPanel.add(statusLbl, cc.xywh(1, 1, 4, 1));
            contentPanel.add(separator1, cc.xywh(1, 3, 4, 1));

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

                //---- varList ----
                varList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                scrollPane1.setViewportView(varList);
            }
            contentPanel.add(scrollPane1, cc.xywh(1, 5, 1, 11));

            //---- label1 ----
            label1.setText("Stroke Size:");
            contentPanel.add(label1, cc.xywh(3, 5, 2, 1));

            //---- strokeSpn ----
            strokeSpn.setModel(new SpinnerNumberModel(1, 1, null, 1));
            contentPanel.add(strokeSpn, cc.xy(4, 7));

            //---- label2 ----
            label2.setText("Shape Size:");
            contentPanel.add(label2, cc.xywh(3, 9, 2, 1));

            //---- shapeSpn ----
            shapeSpn.setModel(new SpinnerNumberModel(8, 1, null, 1));
            contentPanel.add(shapeSpn, cc.xy(4, 11));

            //---- label3 ----
            label3.setText("Symbol:");
            contentPanel.add(label3, cc.xywh(3, 13, 2, 1));

            //---- symPanel ----
            contentPanel.add(symPanel, cc.xy(4, 15));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
            RowSpec[] aRowSpec = RowSpec.decodeSpecs("pref");
            buttonBar
                    .setLayout(
                            new FormLayout(
                                    new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC,
                                            FormFactory.RELATED_GAP_COLSPEC, FormFactory.BUTTON_COLSPEC },
                                    aRowSpec));
            //            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(400, 260);
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:com.devdaily.justwrite.view.ColorChooserDialog.java

License:Open Source License

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    fontColorSwatch = new JLabel();
    fontColorLabel = new JLabel();
    backgroundColorSwatch = new JLabel();
    backgroundColorLabel = new JLabel();
    textAreaScrollPane = new JScrollPane();
    sampleTextArea = new JTextPane();
    buttonBar = new JPanel();
    resetButton = new JButton();
    okButton = new JButton();
    cancelButton = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setTitle("Modify the Editor Colors");
    setResizable(false);//w ww.  j a  v a  2s .  co m
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setPreferredSize(new Dimension(388, 237));
        dialogPane.setLayout(new BorderLayout());

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

            //---- fontColorSwatch ----
            fontColorSwatch.setPreferredSize(new Dimension(60, 20));
            fontColorSwatch.setForeground(Color.green);
            fontColorSwatch.setBackground(Color.green);
            fontColorSwatch.setOpaque(true);
            fontColorSwatch.setBorder(new EtchedBorder());
            fontColorSwatch.setToolTipText("Click to change the font color");
            contentPanel.add(fontColorSwatch, cc.xy(3, 3));

            //---- fontColorLabel ----
            fontColorLabel.setText("Font Color");
            fontColorLabel.setToolTipText("Click to change the font color");
            contentPanel.add(fontColorLabel, cc.xy(5, 3));

            //---- backgroundColorSwatch ----
            backgroundColorSwatch.setPreferredSize(new Dimension(60, 20));
            backgroundColorSwatch.setBackground(Color.black);
            backgroundColorSwatch.setOpaque(true);
            backgroundColorSwatch.setBorder(new MatteBorder(1, 1, 1, 1, Color.black));
            backgroundColorSwatch.setToolTipText("Click to change the background color");
            contentPanel.add(backgroundColorSwatch, cc.xy(3, 5));

            //---- backgroundColorLabel ----
            backgroundColorLabel.setText("Background Color");
            backgroundColorLabel.setToolTipText("Click to change the background color");
            contentPanel.add(backgroundColorLabel, cc.xy(5, 5));

            //======== textAreaScrollPane ========
            {
                textAreaScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
                textAreaScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
                textAreaScrollPane.setToolTipText("This is an example of your colors with the current font.");
                textAreaScrollPane.setPreferredSize(new Dimension(300, 60));

                //---- sampleTextArea ----
                sampleTextArea.setText("Four score and seven years ago");
                sampleTextArea.setEditable(false);
                sampleTextArea.setPreferredSize(new Dimension(200, 60));
                sampleTextArea.setToolTipText("Sample area to demonstrate your color choices");
                textAreaScrollPane.setViewportView(sampleTextArea);
            }
            contentPanel.add(textAreaScrollPane, cc.xywh(3, 7, 3, 2));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

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

            //---- resetButton ----
            resetButton.setText("Reset");
            resetButton.setToolTipText("Reset to the system default colors");
            buttonBar.add(resetButton, cc.xy(2, 1));

            //---- okButton ----
            okButton.setText("OK");
            okButton.setToolTipText("Accept your color changes");
            buttonBar.add(okButton, cc.xy(4, 1));

            //---- cancelButton ----
            cancelButton.setText("Cancel");
            cancelButton.setToolTipText("Cancel your color changes");
            buttonBar.add(cancelButton, cc.xy(6, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:com.intellij.uiDesigner.radComponents.FormLayoutColumnProperties.java

License:Apache License

private Size getSelectedSize() {
    Size size;/*from  ww  w . ja  va  2s.  c om*/
    if (myDefaultRadioButton.isSelected()) {
        size = Sizes.DEFAULT;
    } else if (myPreferredRadioButton.isSelected()) {
        size = Sizes.PREFERRED;
    } else if (myMinimumRadioButton.isSelected()) {
        size = Sizes.MINIMUM;
    } else {
        size = getConstantSize(myConstantSizeUnitsCombo, myConstantSizeSpinner);
    }

    if (myMinimumCheckBox.isSelected() || myMaximumCheckBox.isSelected()) {
        Size minSize = null;
        Size maxSize = null;
        if (myMinimumCheckBox.isSelected()) {
            minSize = getConstantSize(myMinSizeUnitsCombo, myMinSizeSpinner);
        }
        if (myMaximumCheckBox.isSelected()) {
            maxSize = getConstantSize(myMaxSizeUnitsCombo, myMaxSizeSpinner);
        }
        size = Sizes.bounded(size, minSize, maxSize);
    }
    return size;
}