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:ch.zhaw.ias.dito.ui.MethodPanel.java

License:BSD License

public MethodPanel(HelpArea helpArea) {
    super(ScreenEnum.METHOD, ScreenEnum.QUESTION, ScreenEnum.ANALYSIS);
    comboModel = new MethodComboModel(DistanceMethodEnum.get(Coding.REAL));
    methods = new JComboBox(comboModel);

    FormLayout layout = new FormLayout(
            "pref, 5dlu, max(100dlu; pref), 5dlu, max(100dlu; pref), 5dlu, max(100dlu; pref), pref:grow",
            "pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, fill:pref:grow");
    CellConstraints cc = new CellConstraints();
    DefaultFormBuilder fb = new DefaultFormBuilder(layout, Translation.INSTANCE.getBundle());

    fb.addI15dSeparator("s3.lb.method", cc.xyw(1, 1, 5));
    fb.addI15dLabel("s3.lb.coding", cc.xyw(1, 3, 3));
    fb.add(codingGroup, cc.xy(5, 3));//from  w ww  . ja v a 2s  .  com
    codingGroup.addActionListener(this);

    fb.addI15dLabel("s3.lb.distance", cc.xyw(1, 5, 3));
    fb.add(methods, cc.xy(5, 5));
    methods.addActionListener(this);

    fb.addI15dLabel("s3.lb.parameter", cc.xyw(1, 7, 3));
    fb.add(parameter, cc.xy(5, 7));

    fb.add(formula, cc.xywh(7, 3, 1, 5));

    fb.add(ownDefinition, cc.xyw(1, 9, 3));
    createDefinition.setText("(a+d)/(a+b+c+d)");
    fb.add(createDefinition, cc.xy(5, 9));

    plotButton.addActionListener(this);
    fb.add(plotButton, cc.xy(5, 11));

    fb.addI15dSeparator("s3.lb.calculation", cc.xyw(1, 13, 5));
    fb.add(randomSample, cc.xyw(1, 15, 5));
    fb.addI15dLabel("s3.lb.sampleSize", cc.xy(3, 17));
    fb.add(sampleSize, cc.xy(5, 17));

    fb.add(parallel, cc.xyw(1, 19, 5));
    fb.addI15dLabel("s3.lb.numberOfThreads", cc.xy(3, 21));
    fb.add(numberOfThreads, cc.xy(5, 21));

    Method m = Config.INSTANCE.getDitoConfig().getMethod();
    codingGroup.setSelectedValue(m.getMethod().getCoding());
    methods.setSelectedItem(DistanceMethodEnum.get(m.getName()));

    randomSample.setSelected(m.isUseRandomSample());
    randomSample.addActionListener(this);
    sampleSize.setText(Integer.toString(m.getSampleSize()));

    parallel.setSelected(m.isParallel());
    parallel.addActionListener(this);
    numberOfThreads.setText(Integer.toString(m.getNumberOfThreads()));

    this.setLayout(new BorderLayout());
    this.add(fb.getPanel(), BorderLayout.CENTER);

    //set distance matrix to null. this way it can be garbage collected
    //the distance matrix is probably quite large, and the calculations will need a lot of memory
    Config.INSTANCE.setDistanceMatrix(null);
    updateEnabling();
}

From source file:com.alcatel_lucent.nz.wnmsextract.WNMSTransformGUI.java

License:Open Source License

/**
 * buildPanel. Layout input screen/*from   www . j  a va  2  s. c o  m*/
 * @return
 * r1 | Input Parameters -------------------------------
 * r2 |  XCM Path+Name   [_________]
 * r3 |  XSL Path+Name   [_________]
 * r4 | Logging Outputs---------------------------------
 * r5 |    Log Console   []   Log Level [DEBUG|v]
 * r6 |       Log File   []
 * r6 |   
 * r7 |                  [   START   ][    EXIT    ]
 * ---+-------------------------------------------------
 *    ||c1            |c2|c3  |c4     |c5|c6
 */

private JComponent buildPanel() {

    FormLayout layout = new FormLayout("left:pref", // 2cols
            "pref,pref,3dlu,pref,pref,3dlu,pref"); // 3rows

    PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();

    CellConstraints cc = new CellConstraints();

    builder.addSeparator("Input Parameters", cc.xywh(1, 1, 1, 1));
    builder.add(buildInputPanel(), cc.xy(1, 2));
    builder.addSeparator("Logging Outputs", cc.xywh(1, 4, 1, 1));
    builder.add(buildLogPanel(), cc.xy(1, 5));
    builder.add(buildButtonPanel(), cc.xy(1, 7, "right,center"));

    return builder.getPanel();

}

From source file:com.alternatecomputing.jschnizzle.action.AboutAction.java

License:Apache License

/**
 * create the about panel// w  w w. j av a 2s .c o  m
 *
 * @param dialog component that will contain this panel
 * @return about panel
 */
private JPanel createAboutPanel(final JDialog dialog) {
    FormLayout layout = new FormLayout("fill:min:grow, pref", "pref, 4dlu, fill:min:grow, 4dlu, pref");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();
    JXHeader header = new JXHeader("JSchnizzle", "");
    builder.add(header, cc.xywh(1, 1, 2, 1));
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Version", createVersionPanel());
    tabbedPane.addTab("About", createNoticePanel());
    tabbedPane.addTab("License", createLicensePanel());
    tabbedPane.addTab("Acknowledgements", createAcknowledgementsPanel());
    builder.add(tabbedPane, cc.xywh(1, 3, 2, 1));
    JButton okButton = new JButton("OK");
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dialog.dispose();
        }
    });
    builder.add(ButtonBarFactory.buildOKBar(okButton), cc.xy(2, 5));
    return builder.getPanel();
}

From source file:com.alternatecomputing.jschnizzle.action.AboutAction.java

License:Apache License

/**
 * create the panel containing the version information
 *
 * @return version panel// ww w.j  av a  2  s .co m
 */
private Component createVersionPanel() {
    JPanel p = createBasicPanel();
    FormLayout layout = new FormLayout("fill:min:grow, pref, 10dlu, pref, 4dlu, pref, fill:min:grow",
            "fill:min:grow, 20dlu, pref, 4dlu, pref, 4dlu, pref, 20dlu, fill:min:grow");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    CellConstraints cc = new CellConstraints();
    JXImagePanel imagePanel = new JXImagePanel();
    imagePanel.setBackground(Color.WHITE);
    try {
        BufferedImage image = ImageIO
                .read(Thread.currentThread().getContextClassLoader().getResource("logo.jpg"));
        imagePanel.setImage(image);
        imagePanel.setPreferredSize(new Dimension(image.getWidth(), image.getHeight()));
    } catch (IOException e) {
        LOGGER.error("Error reading logo image from classpath.", e);
    }
    builder.add(imagePanel, cc.xywh(2, 2, 1, 7));
    Properties buildInfo = getBuildInfo();
    builder.add(new JLabel("Version:"), cc.xy(4, 3));
    builder.add(new JLabel(buildInfo.getProperty("Implementation-Version")), cc.xy(6, 3));
    builder.add(new JLabel("Build Rev:"), cc.xy(4, 5));
    builder.add(new JLabel(buildInfo.getProperty("Implementation-Build")), cc.xy(6, 5));
    builder.add(new JLabel("Build Date:"), cc.xy(4, 7));
    builder.add(new JLabel(buildInfo.getProperty("Implementation-Build-Date").replace("\"", "")), cc.xy(6, 7));
    JPanel panel = builder.getPanel();
    panel.setBackground(Color.WHITE);
    panel.setBorder(BorderFactory.createEtchedBorder());
    p.add(panel, cc.xy(1, 1));
    return p;
}

From source file:com.alternatecomputing.jschnizzle.ui.ImagePanel.java

License:Apache License

public ImagePanel() {
    super();/*from ww  w .  j  a  v a  2 s .c  o m*/
    this.setLayout(new FormLayout("fill:min:grow, pref, 4dlu, pref, 4dlu", "fill:min:grow, 4dlu, pref, 4dlu"));
    CellConstraints cc = new CellConstraints();
    this.diagramPanel = new JPanel();
    this.diagramPanel.setLayout(new BorderLayout());
    this.diagramPanel.setBackground(Color.WHITE);
    JScrollPane jScrollPane = new JScrollPane(diagramPanel);
    add(jScrollPane, cc.xywh(1, 1, 5, 1));
    add(new JLabel("Scale:"), cc.xy(2, 3));
    scaleSlider = createScaleSlider(this);
    add(scaleSlider, cc.xy(4, 3));
}

From source file:com.alternatecomputing.jschnizzle.util.UIUtils.java

License:Apache License

/**
 * create a diagram panel/*  ww w. j a va 2 s . co m*/
 *
 * @param header header for the panel
 * @param diagram model to be bound to the UI
 * @param dialog component that this panel will be embedded into
 * @param isNew whether this will be used for a new diagram or to update an existing one
 * @return diagram panel
 */
public static JPanel createDiagramPanel(JXHeader header, final Diagram diagram, final JDialog dialog,
        final boolean isNew) {
    final String originalScript = diagram.getScript();
    final DiagramStyle originalStyle = diagram.getStyle();
    FormLayout layout = new FormLayout("right:max(40dlu;pref), 4dlu, fill:min:grow",
            "pref, 4dlu, pref, 4dlu, pref, 4dlu, pref, 4dlu, pref, fill:pref:grow, 4dlu, pref");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();
    builder.add(header, cc.xywh(1, 1, 3, 1));
    builder.add(new JLabel("Name:"), cc.xy(1, 3));
    final JTextField nameTextField = new JTextField(diagram.getName() == null ? "" : diagram.getName());
    builder.add(nameTextField, cc.xy(3, 3));

    builder.add(new JLabel("Note:"), cc.xy(1, 5));
    final JTextField noteTextField = new JTextField(diagram.getNote() == null ? "" : diagram.getNote());
    builder.add(noteTextField, cc.xy(3, 5));

    builder.add(new JLabel("Style:"), cc.xy(1, 7));
    Renderer renderer = RendererFactory.getRendererForDiagram(diagram);
    final JComboBox<DiagramStyle> styleComboBox = new JComboBox<DiagramStyle>(
            renderer.getStylesForType(diagram.getType()));
    if (originalScript != null) {
        styleComboBox.setSelectedItem(originalStyle);
    } else {
        styleComboBox.setSelectedIndex(0);
    }
    builder.add(styleComboBox, cc.xy(3, 7));

    builder.add(new JLabel("Script:"), cc.xy(1, 9));
    final JTextArea scriptTextArea = new JTextArea(diagram.getScript() == null ? "" : diagram.getScript());
    builder.add(new JScrollPane(scriptTextArea), cc.xywh(3, 9, 1, 2));

    JButton okButton = new JButton("OK");
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            diagram.setName(nameTextField.getText());
            diagram.setNote(noteTextField.getText());
            diagram.setStyle((DiagramStyle) styleComboBox.getSelectedItem());
            diagram.setScript(scriptTextArea.getText());
            Dispatcher.dispatchEvent(new JSEvent(EventType.ProgressStarted, null, null));
            Thread t = new Thread() {
                public void run() {
                    try {
                        if (needsRendering()) {
                            LOGGER.info("Rendering diagram '" + diagram.getName() + "'...");
                            Renderer renderer = RendererFactory.getRendererForDiagram(diagram);
                            BufferedImage image = renderer.render(diagram);
                            diagram.nonBeanImage(image);
                            LOGGER.info("Diagram '" + diagram.getName() + "' successfully rendered.");
                        }
                        if (isNew) {
                            LOGGER.info("Diagram '" + diagram.getName() + "' created.");
                            Dispatcher.dispatchEvent(new JSEvent(EventType.DiagramAdded, this, diagram));
                            Dispatcher.dispatchEvent(new JSEvent(EventType.SelectDiagram, this, diagram));
                        } else {
                            LOGGER.info("Diagram '" + diagram.getName() + "' modified.");
                            Dispatcher.dispatchEvent(new JSEvent(EventType.DiagramModified, this, diagram));
                        }
                    } catch (Exception e) {
                        LOGGER.error("Error processing user action.", e);
                    } finally {
                        Dispatcher.dispatchEvent(new JSEvent(EventType.ProgressCompleted, null, null));
                    }
                }

                private boolean needsRendering() {
                    return (!diagram.getScript().equals(originalScript))
                            || (!diagram.getStyle().equals(originalStyle));
                }
            };
            t.start();
            dialog.dispose();
        }
    });
    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dialog.dispose();
        }
    });
    builder.add(ButtonBarFactory.buildOKCancelBar(okButton, cancelButton), cc.xy(3, 12));
    return builder.getPanel();
}

From source file:com.atlassian.theplugin.idea.jira.WorkLogCreateAndMaybeDeactivateDialog.java

License:Apache License

private JPanel createTimePanel() {
    CellConstraints cc = new CellConstraints();
    timePanel = new JPanel(new FormLayout(
            "3dlu, right:pref, 3dlu, left:pref, 3dlu, 10dlu, left:pref, 3dlu, left:pref:grow, 3dlu",
            "3dlu, pref, 3dlu, pref, pref, pref, 3dlu, pref, 10dlu, 40dlu, 3dlu"));

    timePanel.add(new JLabel("Time Spent:"), cc.xy(2, 2));

    timeSpentField = createFixedTextField(120, 28);
    timePanel.add(timeSpentField, cc.xy(4, 2));

    explanationText = new JTextPane();
    explanationText.setText("An estimate of how much time you have spent working."
            + "\nThe format of this is ' *w *d *h *m ' (representing weeks,"
            + "\ndays, hours and minutes - where * can be any number)" + "\nExamples: 4d, 5h 30m, 60m and 3w.");

    explanationText.setEditable(false);//from ww  w . j  a  v  a 2 s  . co m
    explanationText.setEnabled(true);
    explanationText
            .setFont(new Font(explanationText.getFont().getName(), explanationText.getFont().getStyle(), 10));
    explanationText.setOpaque(false);

    timePanel.add(explanationText, cc.xywh(4, 4, 1, 4));

    timePanel.add(new JLabel("Remaining Estimate:"), cc.xyw(6, 2, 2));

    btnAutoUpdate = new JRadioButton("Auto Update", true);
    btnLeaveUnchanged = new JRadioButton("Leave Unchanged");
    btnUpdateManually = new JRadioButton("Update Manually:");

    timePanel.add(btnAutoUpdate, cc.xy(7, 4));
    timePanel.add(btnLeaveUnchanged, cc.xy(7, 5));
    timePanel.add(btnUpdateManually, cc.xy(7, 6));

    remainingEstimateField = createFixedTextField(120, 28);
    timePanel.add(remainingEstimateField, cc.xy(9, 6));

    ButtonGroup group = new ButtonGroup();
    group.add(btnUpdateManually);
    group.add(btnAutoUpdate);
    group.add(btnLeaveUnchanged);

    endTimePanel = new JPanel(new FormLayout("fill:pref:grow, 3dlu, pref", "pref"));
    endDateLabel = new JLabel("1/01/08 12:00");
    endTimePanel.add(endDateLabel, cc.xy(1, 1, CellConstraints.CENTER, CellConstraints.DEFAULT));
    endDateChange = new JButton("Change");
    endTimePanel.add(endDateChange, cc.xy(3, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));

    if (!deactivateActiveIssue) {
        timePanel.add(new JLabel("End Time:"), cc.xy(2, 8));
        timePanel.add(endTimePanel, cc.xy(4, 8));
    }

    timePanel.add(new JLabel("Comment:"), cc.xy(2, 10, CellConstraints.RIGHT, CellConstraints.TOP));
    issueComment = new JTextArea();
    issueComment.setLineWrap(true);
    final JScrollPane scroll = new JScrollPane();
    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scroll.setViewportView(issueComment);

    timePanel.add(scroll, cc.xyw(4, 10, 6, CellConstraints.FILL, CellConstraints.FILL));

    UIUtil.setEnabled(timePanel, chkLogWork.isSelected() || !deactivateActiveIssue, true);
    remainingEstimateField.setEnabled(false);
    return timePanel;
}

From source file:com.devdaily.heidi.ApplyLicenseDialog.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    headerTitle = new JLabel();
    headerHelpText = new JLabel();
    fileTextfieldLabel = new JLabel();
    fileTextField = new JTextField();
    browseButton = new JButton();
    ////from w w w  . j  a va2s. c  o  m
    // AJA
    // 
    //needALicenseLabel = new JLabel();
    buttonBar = new JPanel();
    cancelButton = new JButton();
    applyLicenseButton = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    //
    // AJA
    //
    setTitle("Hyde Licensing");
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

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

        //======== contentPanel ========
        {
            contentPanel.setLayout(new FormLayout(
                    new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                            FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC },
                    new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.PARAGRAPH_GAP_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.PARAGRAPH_GAP_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.PARAGRAPH_GAP_ROWSPEC }));

            //---- headerTitle ----
            headerTitle.setText("Licensing");
            headerTitle.setFont(new Font("Lucida Grande", Font.BOLD, 14));
            contentPanel.add(headerTitle, cc.xywh(1, 1, 5, 1));

            //---- headerHelpText ----
            headerHelpText.setText("Select the license file from your system, and click \"Apply License\".");
            contentPanel.add(headerHelpText, cc.xywh(1, 3, 5, 1));

            //---- fileTextfieldLabel ----
            fileTextfieldLabel.setText("Choose license file:");
            contentPanel.add(fileTextfieldLabel, cc.xywh(1, 7, 5, 1));
            contentPanel.add(fileTextField, cc.xywh(1, 9, 4, 1));

            //---- browseButton ----
            browseButton.setText("Browse...");
            contentPanel.add(browseButton, cc.xy(5, 9));

            //---- needALicenseLabel ----
            //
            // AJA
            // 
            //needALicenseLabel.setText("Need a license? Click here to get started.");
            needALicenseLabel.setForeground(Color.gray);
            contentPanel.add(needALicenseLabel, cc.xywh(1, 13, 5, 1));
        }
        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.MIN_COLSPEC, FormFactory.BUTTON_COLSPEC }, RowSpec.decodeSpecs("pref")));

            //---- cancelButton ----
            cancelButton.setText("Cancel");
            buttonBar.add(cancelButton, cc.xy(4, 1));

            //---- applyLicenseButton ----
            applyLicenseButton.setText("Apply License");
            buttonBar.add(applyLicenseButton, 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.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 w  w  .  j  a  v a2  s.  c  om*/
    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.gui.account.AccountEditorDialog.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    ResourceBundle bundle = ResourceBundle.getBundle("com.resource.locale");
    DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance();
    editorPane = new JPanel();
    editorContent = new JPanel();
    separator1 = compFactory.createSeparator(bundle.getString("AccountEditorDialog.separator1.text"));
    label1 = new JLabel();
    textField1 = BasicComponentFactory/*  w w w. j a v  a2s  .c o  m*/
            .createTextField(this.accountPresentationModel.getBufferedModel("pseudo"));
    label2 = new JLabel();
    textField2 = BasicComponentFactory
            .createTextField(this.accountPresentationModel.getBufferedModel("password"));
    separator2 = compFactory.createSeparator(bundle.getString("AccountEditorDialog.separator2.text"));
    label3 = new JLabel();
    textField3 = BasicComponentFactory
            .createTextField(this.accountPresentationModel.getBufferedModel("description"));
    label4 = new JLabel();
    textField4 = BasicComponentFactory
            .createTextField(this.accountPresentationModel.getBufferedModel("initDate"));
    label5 = new JLabel();
    textField5 = new JTextField();
    editorButtons = new JPanel();
    editorOk = new JButton();
    editorCancel = new JButton();
    actionOk = new EditorOk();
    actionCancel = new EditorCancel();
    CellConstraints cc = new CellConstraints();

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

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

        //======== editorContent ========
        {
            editorContent.setBorder(Borders.DLU4_BORDER);
            editorContent.setLayout(new FormLayout("right:[50dlu,default], $lcgap, [100dlu,default]",
                    "6*(default, $lgap), default"));
            editorContent.add(separator1, cc.xywh(1, 1, 3, 1));

            //---- label1 ----
            label1.setText(bundle.getString("AccountEditorDialog.label1.text"));
            editorContent.add(label1, cc.xy(1, 3));
            editorContent.add(textField1, cc.xy(3, 3));

            //---- label2 ----
            label2.setText(bundle.getString("AccountEditorDialog.label2.text"));
            editorContent.add(label2, cc.xy(1, 5));
            editorContent.add(textField2, cc.xy(3, 5));
            editorContent.add(separator2, cc.xywh(1, 7, 3, 1));

            //---- label3 ----
            label3.setText(bundle.getString("AccountEditorDialog.label3.text"));
            editorContent.add(label3, cc.xy(1, 9));
            editorContent.add(textField3, cc.xy(3, 9));

            //---- label4 ----
            label4.setText(bundle.getString("AccountEditorDialog.label4.text"));
            editorContent.add(label4, cc.xy(1, 11));

            //---- textField4 ----
            textField4.setEditable(false);
            editorContent.add(textField4, cc.xy(3, 11));

            //---- label5 ----
            label5.setText(bundle.getString("AccountEditorDialog.label5.text"));
            editorContent.add(label5, cc.xy(1, 13));

            //---- textField5 ----
            textField5.setEditable(false);
            editorContent.add(textField5, cc.xy(3, 13));
        }
        editorPane.add(editorContent, BorderLayout.CENTER);

        //======== editorButtons ========
        {
            editorButtons.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
            editorButtons.setLayout(new FormLayout("$glue, $button, $rgap, $button", "pref"));

            //---- editorOk ----
            editorOk.setMnemonic(bundle.getString("AccountEditorDialog.editorOk.mnemonic").charAt(0));
            editorOk.setAction(actionOk);
            editorButtons.add(editorOk, cc.xy(2, 1));

            //---- editorCancel ----
            editorCancel.setMnemonic(bundle.getString("AccountEditorDialog.editorCancel.mnemonic").charAt(0));
            editorCancel.setAction(actionCancel);
            editorButtons.add(editorCancel, cc.xy(4, 1));
        }
        editorPane.add(editorButtons, BorderLayout.SOUTH);
    }
    contentPane.add(editorPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}