Example usage for com.jgoodies.forms.builder PanelBuilder addLabel

List of usage examples for com.jgoodies.forms.builder PanelBuilder addLabel

Introduction

In this page you can find the example usage for com.jgoodies.forms.builder PanelBuilder addLabel.

Prototype

public final JLabel addLabel(String textWithMnemonic, CellConstraints labelConstraints, Component component,
        CellConstraints componentConstraints) 

Source Link

Document

Adds a label and component to the panel using the given cell constraints.

Usage

From source file:ca.sqlpower.architect.swingui.KettleDataSourceTypeOptionPanel.java

License:Open Source License

public KettleDataSourceTypeOptionPanel() {
    PanelBuilder pb = new PanelBuilder(new FormLayout("4dlu,pref,4dlu,pref:grow,4dlu",
            "4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu"));

    CellConstraints cc = new CellConstraints();
    CellConstraints cl = new CellConstraints();
    int row = 2;//  w w  w  .j  a  va 2s . c o m
    pb.addLabel("Kettle Connection Type", cl.xy(2, row), kettleConnectionType, cc.xy(4, row));
    List<String> dbConnectionNames = KettleUtils.retrieveKettleConnectionTypes();
    for (String dbConnectionName : dbConnectionNames) {
        kettleConnectionType.addItem(dbConnectionName);
    }
    kettleConnectionType.setSelectedIndex(-1);

    panel = pb.getPanel();
}

From source file:ca.sqlpower.swingui.db.DataSourceTypeEditorPanel.java

License:Open Source License

private void buildPanel() {

    connectionStringTemplate.getDocument().addDocumentListener(new DocumentListener() {

        public void changedUpdate(DocumentEvent e) {
            updateTemplate();/*ww w.j a va  2 s .c o m*/
        }

        public void insertUpdate(DocumentEvent e) {
            updateTemplate();
        }

        public void removeUpdate(DocumentEvent e) {
            updateTemplate();
        }

        /**
         * Updates the template if dsType is not currently null.
         */
        private void updateTemplate() {
            if (dsType != null) {
                dsType.setJdbcUrl(connectionStringTemplate.getText());
                template.setTemplate(dsType);
            }
        }

    });

    tabbedPane = new JTabbedPane();

    PanelBuilder pb = new PanelBuilder(new FormLayout("4dlu,pref,4dlu,pref:grow,4dlu", //$NON-NLS-1$
            "4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu, pref:grow, 4dlu")); //$NON-NLS-1$

    CellConstraints cc = new CellConstraints();
    CellConstraints cl = new CellConstraints();
    int row = 2;
    pb.addLabel(Messages.getString("DataSourceTypeEditorPanel.nameLabel"), cl.xy(2, row), name, cc.xy(4, row)); //$NON-NLS-1$
    row += 2;
    pb.addLabel(Messages.getString("DataSourceTypeEditorPanel.driverClassLabel"), cl.xy(2, row), driverClass, //$NON-NLS-1$
            cc.xy(4, row));
    row += 2;
    pb.addLabel(Messages.getString("DataSourceTypeEditorPanel.connectionStringTemplateLabel"), cl.xy(2, row), //$NON-NLS-1$
            connectionStringTemplate, cc.xy(4, row));
    row += 2;
    connectionStringTemplate.setToolTipText(Messages.getString("DataSourceTypeEditorPanel.templateToolTip")); //$NON-NLS-1$
    pb.addTitle(Messages.getString("DataSourceTypeEditorPanel.optionsEditorPreview"), cl.xyw(2, row, 3)); //$NON-NLS-1$
    row += 2;
    pb.addLabel(Messages.getString("DataSourceTypeEditorPanel.sampleOptions"), cl.xy(2, row), //$NON-NLS-1$
            template.getPanel(), cc.xy(4, row));
    row += 2;
    pb.add(jdbcPanel, cc.xyw(2, row, 3));

    tabbedPane.addTab(Messages.getString("DataSourceTypeEditorPanel.generalTab"), pb.getPanel()); //$NON-NLS-1$

    panel = new JPanel(new BorderLayout());
    panel.add(tabbedPane, BorderLayout.CENTER);

    ButtonBarBuilder copyBar = new ButtonBarBuilder();
    copyBar.addGlue();
    copyBar.addGridded(copyPropertiesButton);
    panel.add(copyBar.getPanel(), BorderLayout.SOUTH);
}

From source file:net.sourceforge.marathon.mpf.MainPanel.java

License:Open Source License

public JPanel createPanel() {
    initComponents();/*from   w  ww .ja v a2s  .  c  om*/
    PanelBuilder builder = new PanelBuilder(new FormLayout("left:pref, 3dlu, fill:pref:grow, 3dlu, fill:pref",
            "pref, 3dlu, pref, 3dlu, fill:pref:grow, 3dlu, fill:pref:grow, 3dlu, pref, 3dlu, pref, 3dlu, pref"));
    builder.setDefaultDialogBorder();
    CellConstraints labelConstraints = new CellConstraints();
    CellConstraints compConstraints = new CellConstraints();
    builder.addLabel("Class &Name: ", labelConstraints.xy(1, 1), mainClassField,
            compConstraints.xywh(3, 1, 3, 1));
    JScrollPane scrollPane = new JScrollPane(programArgsField, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    JLabel label = builder.addLabel("Pro&gram Arguments: ",
            labelConstraints.xy(1, 5, CellConstraints.LEFT, CellConstraints.TOP), scrollPane,
            compConstraints.xywh(3, 5, 3, 1));
    label.setLabelFor(programArgsField);
    scrollPane = new JScrollPane(vmArgsField, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    label = builder.addLabel("&VM Arguments: ",
            labelConstraints.xy(1, 7, CellConstraints.LEFT, CellConstraints.TOP), scrollPane,
            compConstraints.xywh(3, 7, 3, 1));
    label.setLabelFor(vmArgsField);
    builder.addLabel("&Working Directory: ", labelConstraints.xy(1, 9), workingDirField,
            compConstraints.xy(3, 9));
    builder.add(browse, labelConstraints.xy(5, 9));
    browse.setMnemonic(KeyEvent.VK_B);
    builder.addLabel("&Java Executable: ", labelConstraints.xy(1, 11), vmCommandField,
            compConstraints.xy(3, 11));
    builder.add(browseVM, labelConstraints.xy(5, 11));
    return builder.getPanel();
}

From source file:net.sourceforge.marathon.mpf.MPFSelection.java

License:Open Source License

/**
 * Get the selection panel populated with the controls.
 * //from   w  w  w  .  j  a  v  a 2s  .c o m
 * @return panel, the selection panel.
 */
private JPanel getSelectionPanel() {
    PanelBuilder builder = new PanelBuilder(new FormLayout("left:p:none, 3dlu, fill:p:grow, 3dlu, d", "pref"));
    builder.setDefaultDialogBorder();
    CellConstraints cc1 = new CellConstraints();
    CellConstraints cc2 = new CellConstraints();
    loadFileNames();
    if (dirName.getItemCount() == 0)
        dirName.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    builder.addLabel("&Project directory:", cc1.xy(1, 1), dirName, cc2.xy(3, 1));
    builder.add(browseButton, cc1.xy(5, 1));
    browseButton.setMnemonic(KeyEvent.VK_R);
    FileSelectionListener fsl = new FileSelectionListener(this,
            new ProjectDirectoryFilter("Marathon Project Directories"), this, null,
            "Select Marathon Project Directory");
    fsl.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    browseButton.addActionListener(fsl);
    return builder.getPanel();
}

From source file:net.sourceforge.marathon.mpf.ProjectPanel.java

License:Open Source License

public JPanel createPanel() {
    initComponents();//w  w w.  ja va 2s. co  m
    PanelBuilder builder = new PanelBuilder(new FormLayout("left:pref, 3dlu, pref:grow, 3dlu, fill:pref",
            "pref, 3dlu, pref, 3dlu, fill:pref:grow, 3dlu, pref, 3dlu, pref"));
    builder.setDefaultDialogBorder();
    CellConstraints labelConstraints = new CellConstraints();
    CellConstraints compConstraints = new CellConstraints();
    builder.addLabel("&Name: ", labelConstraints.xy(1, 1), nameField, compConstraints.xywh(3, 1, 3, 1));
    builder.addLabel("Directory: ", labelConstraints.xy(1, 3), dirField, compConstraints.xy(3, 3));
    builder.add(browse, compConstraints.xy(5, 3));
    JScrollPane scrollPane = new JScrollPane(descriptionField, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    JLabel label = builder.addLabel("&Description: ",
            labelConstraints.xy(1, 5, CellConstraints.LEFT, CellConstraints.TOP), scrollPane,
            compConstraints.xywh(3, 5, 3, 1));
    label.setLabelFor(descriptionField);
    builder.add(useToolkitMenumask, labelConstraints.xyw(2, 7, 2));
    builder.add(useDevelopmentMode, labelConstraints.xyw(2, 9, 2));
    return builder.getPanel();
}

From source file:net.sourceforge.marathon.python.PythonPathPanel.java

License:Open Source License

private JPanel getHomePanel() {
    FormLayout layout = new FormLayout("pref, 3dlu, fill:pref:grow", "fill:p:grow, 3dlu, pref");
    PanelBuilder builder = new PanelBuilder(layout);
    CellConstraints constraints = new CellConstraints();
    builder.addLabel("P&ython Home:", new CellConstraints().xyw(1, 3, 1), home, constraints.xyw(3, 3, 1));
    return builder.getPanel();
}

From source file:net.sourceforge.marathon.ruby.RubyPathPanel.java

License:Open Source License

private JPanel getHomePanel() {
    FormLayout layout = new FormLayout("pref, 3dlu, fill:pref:grow", "fill:p:grow, 3dlu, pref");
    PanelBuilder builder = new PanelBuilder(layout);
    CellConstraints constraints = new CellConstraints();
    builder.addLabel("Ru&by Home:", new CellConstraints().xyw(1, 3, 1), home, constraints.xyw(3, 3, 1));
    return builder.getPanel();
}

From source file:org.jdesktop.swingx.demos.calendarext.CalendarBaseDemo.java

License:Open Source License

/**
 * @return//  w ww  .j  a va2 s  .co  m
 */
private JComponent createConfigPanel() {
    JXCollapsiblePane painterControl = new JXCollapsiblePane();
    FormLayout formLayout = new FormLayout("5dlu, r:d:n, l:4dlu:n, f:m:g, l:4dlu:n, f:m:g", // columns
            "c:d:n " + ", t:4dlu:n, c:d:n " + ", t:4dlu:n, c:d:n" + ", t:4dlu:n, c:d:n" + ", t:4dlu:n, c:d:n"); // rows
    PanelBuilder builder = new PanelBuilder(formLayout, painterControl);
    builder.setBorder(Borders.DLU4_BORDER);
    CellConstraints cl = new CellConstraints();
    CellConstraints cc = new CellConstraints();

    JXTitledSeparator areaSeparator = new JXTitledSeparator();
    areaSeparator.setName("configurationSeparator");
    builder.add(areaSeparator, cc.xywh(1, 1, 6, 1));

    int labelColumn = 2;
    int widgetColumn = labelColumn + 2;
    int currentRow = 3;

    dayOfWeekComboBox = new JComboBox();
    JLabel dayOfWeekLabel = builder.addLabel("", cl.xywh(labelColumn, currentRow, 1, 1), dayOfWeekComboBox,
            cc.xywh(widgetColumn, currentRow, 3, 1));
    dayOfWeekLabel.setName("dayOfWeekLabel");
    getLabelHandler().add(dayOfWeekLabel, dayOfWeekComboBox);
    currentRow += 2;

    //        selectionModes = new JComboBox();
    //        JLabel insets = builder.addLabel("", cl.xywh(labelColumn, currentRow, 1, 1), 
    //                selectionModes, cc.xywh(widgetColumn, currentRow, 3, 1));
    //        currentRow += 2;
    //        insets.setName("selectionModesLabel");
    //        getLabelHandler().add(insets, selectionModes);

    unselectableDates = new JXDateChooser();
    JLabel unselectables = builder.addLabel("", cl.xywh(labelColumn, currentRow, 1, 1), unselectableDates,
            cc.xywh(widgetColumn, currentRow, 1, 1));
    unselectables.setName("unselectableDatesLabel");
    getLabelHandler().add(unselectables, unselectableDates);
    flaggedDates = new JXDateChooser();
    builder.add(flaggedDates, cc.xywh(widgetColumn + 2, currentRow, 1, 1));
    currentRow += 2;

    upperBound = new JXDateChooser();
    lowerBound = new JXDateChooser();

    JLabel lower = builder.addLabel("", cl.xywh(labelColumn, currentRow, 1, 1), lowerBound,
            cc.xywh(widgetColumn, currentRow, 1, 1));
    lower.setName("lowerBoundsLabel");
    getLabelHandler().add(lower, lowerBound);

    builder.add(upperBound, cc.xywh(widgetColumn + 2, currentRow, 1, 1));
    currentRow += 2;

    return painterControl;
}

From source file:org.jdesktop.swingx.demos.calendarext.CalendarBaseDemo.java

License:Open Source License

/**
 * @return//from w  w w  . j a va  2  s.  co  m
 */
private JComponent createBoxPropertiesPanel() {
    JXCollapsiblePane painterControl = new JXCollapsiblePane();
    FormLayout formLayout = new FormLayout("5dlu, r:d:n, l:4dlu:n, f:d:n", //l:4dlu:n, f:d:n", // columns
            "c:d:n " + ", t:4dlu:n, c:d:n " + ", t:4dlu:n, c:d:n " + ", t:4dlu:n, c:d:n" + ", t:4dlu:n, c:d:n"
                    + ", t:4dlu:n, c:d:n"); // rows
    PanelBuilder builder = new PanelBuilder(formLayout, painterControl);
    builder.setBorder(Borders.DLU4_BORDER);
    CellConstraints cl = new CellConstraints();
    CellConstraints cc = new CellConstraints();

    JXTitledSeparator areaSeparator = new JXTitledSeparator();
    areaSeparator.setName("monthBoxSeparator");
    builder.add(areaSeparator, cc.xywh(1, 1, 4, 1));

    int labelColumn = 2;
    int widgetColumn = labelColumn + 2;
    int currentRow = 3;

    highlighterCombo = new JComboBox();
    highlighterCombo.setName("highlighterCombo");
    JLabel insets = builder.addLabel("", cl.xywh(labelColumn, currentRow, 1, 1), highlighterCombo,
            cc.xywh(widgetColumn, currentRow, 1, 1));
    insets.setName("highlighterLabel");
    getLabelHandler().add(insets, highlighterCombo);
    //        builder.add(prefColumnSlider,
    //                cc.xywh(widgetColumn + 2, currentRow, 1, 1));
    currentRow += 2;

    //        leadingDaysBox = new JCheckBox();
    //        leadingDaysBox.setName("leadingDaysBox");
    //        
    //        JLabel leadingLabel = builder.addLabel("", cl.xywh(labelColumn, currentRow, 1, 1),
    //                leadingDaysBox, cc.xywh(widgetColumn, currentRow, 1, 1));
    //        leadingLabel.setName("leadingDaysLabel");
    //        getLabelHandler().add(leadingLabel, leadingDaysBox);
    //        
    //        trailingDaysBox = new JCheckBox();
    //        trailingDaysBox.setName("trailingDaysBox");
    //        builder.add(trailingDaysBox, cc.xywh(widgetColumn + 2, currentRow, 1, 1));
    //        currentRow += 2;

    weekNumberBox = new JCheckBox();
    weekNumberBox.setName("weekNumberBox");
    JLabel leadingLabel = builder.addLabel("", cl.xywh(labelColumn, currentRow, 1, 1), weekNumberBox,
            cc.xywh(widgetColumn, currentRow, 1, 1));
    //            leadingLabel.setName("leadingDaysLabel");
    //            getLabelHandler().add(leadingLabel, weekNumberBox);

    currentRow += 2;

    customDayHeader = new JCheckBox();
    customDayHeader.setName("customDayHeaderBox");
    builder.add(customDayHeader, cc.xywh(widgetColumn, currentRow, 1, 1));
    currentRow += 2;

    return painterControl;
}

From source file:org.jdesktop.swingx.demos.calendarext.CalendarViewDemo.java

License:Open Source License

/**
 * @return/*from  w  w w .j  av a2 s  . c  om*/
 */
private JComponent createExtendedConfigPanel() {
    JXCollapsiblePane painterControl = new JXCollapsiblePane();
    FormLayout formLayout = new FormLayout("5dlu, r:d:n, l:4dlu:n, f:d:n, l:4dlu:n, f:d:n", // columns
            "c:d:n " + ", t:4dlu:n, c:d:n " + ", t:4dlu:n, c:d:n" + ", t:4dlu:n, c:d:n" + ", t:4dlu:n, c:d:n"); // rows
    PanelBuilder builder = new PanelBuilder(formLayout, painterControl);
    builder.setBorder(Borders.DLU4_BORDER);
    CellConstraints cl = new CellConstraints();
    CellConstraints cc = new CellConstraints();

    JXTitledSeparator areaSeparator = new JXTitledSeparator();
    areaSeparator.setName("extendedSeparator");
    builder.add(areaSeparator, cc.xywh(1, 1, 4, 1));

    int labelColumn = 2;
    int widgetColumn = labelColumn + 2;
    int currentRow = 3;

    calendarBox = new JCheckBox();
    calendarBox.setName("calendarBox");
    builder.add(calendarBox, cc.xywh(labelColumn, currentRow, 3, 1));
    currentRow += 2;

    zoomableBox = new JCheckBox();
    zoomableBox.setName("zoomableBox");
    builder.add(zoomableBox, cc.xywh(labelColumn, currentRow, 3, 1));
    currentRow += 2;

    highlighterBox = new JComboBox();
    highlighterBox.setName("customHeaderBox");
    JLabel headerBoxLabel = builder.addLabel("", cl.xywh(labelColumn, currentRow, 1, 1), highlighterBox,
            cc.xywh(widgetColumn, currentRow, 1, 1));
    headerBoxLabel.setName("customHeaderBoxLabel");
    getLabelHandler().add(headerBoxLabel, highlighterBox);
    currentRow += 2;

    return painterControl;
}