Example usage for com.jgoodies.forms.layout FormLayout FormLayout

List of usage examples for com.jgoodies.forms.layout FormLayout FormLayout

Introduction

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

Prototype

public FormLayout(ColumnSpec[] colSpecs, RowSpec[] rowSpecs) 

Source Link

Document

Constructs a FormLayout using the given column and row specifications.

Usage

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   w  w w  . j a  v  a 2  s . com
    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.atlassian.theplugin.idea.ToolWindowConfigPanel.java

License:Apache License

public ToolWindowConfigPanel(final Project project) {
    super(new GridBagLayout());

    JPanel panel = new JPanel(new FormLayout("c:p:g", "p, p, 8dlu, p, p"));

    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.CENTER;
    this.add(panel, c);

    CellConstraints cc = new CellConstraints();
    JLabel l1 = new JLabel("No enabled JIRA or Bamboo servers found");
    l1.setFont(l1.getFont().deriveFont(Font.BOLD, 16));
    panel.add(l1, cc.xy(1, 1));/*from w  ww .j  av  a 2 s .  c  o m*/
    panel.add(new JLabel("(Fisheye and Crucible servers do not have their own tool windows)"), cc.xy(1, 2));

    HyperlinkLabel projectSettingsLink = new HyperlinkLabel("Configure Plugin Project Settings");
    projectSettingsLink.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {

            Configurable component = project.getComponent(ProjectConfigurationComponent.class);
            ShowSettingsUtil.getInstance().editConfigurable(project, component);
        }
    });

    projectSettingsLink.setIcon(IconLoader.getIcon("/general/ideOptions.png"));

    panel.add(projectSettingsLink, cc.xy(1, 4));

    HyperlinkLabel globalSettingsLink = new HyperlinkLabel("Configure Plugin IDE Settings");
    globalSettingsLink.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(final HyperlinkEvent e) {
            ShowSettingsUtil.getInstance().editConfigurable(
                    IdeaHelper.getCurrentProject(
                            DataManager.getInstance().getDataContext(ToolWindowConfigPanel.this)),
                    IdeaHelper.getAppComponent());
        }
    });

    globalSettingsLink.setIcon(IconLoader.getIcon("/general/ideOptions.png"));

    panel.add(globalSettingsLink, cc.xy(1, 5));
}

From source file:com.audiveris.installer.BasicCompanionView.java

License:Open Source License

private JPanel defineLayout() {
    // Prepare layout elements
    final boolean optional = companion.getNeed() != Need.MANDATORY;
    final CellConstraints cst = new CellConstraints();
    final String colSpec = optional ? "pref,1dlu,center:pref" : "center:pref";
    final FormLayout layout = new FormLayout(colSpec, "center:20dlu");
    final JPanel panel = new MyPanel();
    final PanelBuilder builder = new PanelBuilder(layout, panel);

    // Now add the desired components, using provided order
    if (optional) {
        builder.add(needBox, cst.xy(1, 1));
        builder.add(titleLabel, cst.xy(3, 1));
    } else {/* w w w .  j a  va2  s  .c o  m*/
        builder.add(titleLabel, cst.xy(1, 1));
    }

    panel.setPreferredSize(new Dimension(width, HEIGHT));
    panel.setOpaque(true);

    return panel;
}

From source file:com.audiveris.installer.BundleView.java

License:Open Source License

/**
 * Build the sub-panel that displays the sequence of companions.
 *
 * @return the companion panel/*from   www.j  a va2 s  . co m*/
 */
private JPanel buildCompPanel() {
    // Prepare layout elements
    final String hGap = "$lcgap";
    final StringBuilder sbcol = new StringBuilder();

    for (Companion companion : bundle.getCompanions()) {
        sbcol.append("pref,").append(hGap).append(",");
    }

    final CellConstraints cst = new CellConstraints();
    final FormLayout layout = new FormLayout(sbcol.toString(), "pref");
    final JPanel panel = new JPanel();
    final PanelBuilder builder = new PanelBuilder(layout, panel);

    // Now add the desired components, using provided order
    int col = 1;

    for (Companion companion : bundle.getCompanions()) {
        CompanionView view = companion.getView();
        builder.add(view.getComponent(), cst.xy(col, 1));
        col += 2;
    }

    return panel;
}

From source file:com.audiveris.installer.BundleView.java

License:Open Source License

/**
 * Build the top panel that displays the sequence of companions,
 * the language selector and the install folder selector.
 *
 * @return the top panel//from  www . ja v  a 2 s  . c  o m
 */
private JPanel buildNorthPanel() {
    // Prepare layout elements
    final FormLayout layout = new FormLayout("$lcgap, fill:0:grow, $lcgap", "$rgap, pref, $rgap, pref, $rgap");
    final JPanel panel = new JPanel();
    final PanelBuilder builder = new PanelBuilder(layout, panel);
    final CellConstraints cst = new CellConstraints();

    int iRow = 0;

    // FolderSelector is currently disabled
    //        iRow +=2;
    //        // Add the folder selector
    //        FolderSelector dirSelector = new FolderSelector(bundle);
    //        builder.add(dirSelector.getComponent(), cst.xy(2, iRow));

    // Add the languages component
    iRow += 2;

    LangSelector langSelector = bundle.getOcrCompanion().getSelector();
    builder.add(langSelector.getComponent(), cst.xy(2, iRow));

    // Add the companions component
    iRow += 2;
    builder.add(buildCompPanel(), cst.xy(2, iRow));

    return panel;
}

From source file:com.audiveris.installer.FolderSelector.java

License:Open Source License

private JComponent defineLayout() {
    final JPanel comp = new JPanel();
    final FormLayout layout = new FormLayout("right:36dlu, $lcgap, fill:0:grow, $lcgap, 31dlu", "pref");
    final CellConstraints cst = new CellConstraints();
    final PanelBuilder builder = new PanelBuilder(layout, comp);

    // Label on left side
    builder.addROLabel("Folder", cst.xy(1, 1));

    // Path to folder
    builder.add(path, cst.xy(3, 1));//  w  ww  .j a  v a  2s  . c o m

    // "Select" button on left side
    builder.add(new JButton(new BrowseAction()), cst.xy(5, 1));

    return comp;
}

From source file:com.audiveris.installer.LangSelector.java

License:Open Source License

private JPanel defineLayout() {
    final JPanel comp = new JPanel();
    final FormLayout layout = new FormLayout("right:40dlu, $lcgap, fill:0:grow, $lcgap, 33dlu", "pref");
    final CellConstraints cst = new CellConstraints();
    final PanelBuilder builder = new PanelBuilder(layout, comp);

    // Label on left side
    builder.addROLabel("Languages", cst.xy(1, 1));

    // "Banner" for the center of the line
    banner = new Banner();
    builder.add(banner.getComponent(), cst.xy(3, 1));

    // "Add" button on right side
    JButton button = new JButton(new AddAction());
    builder.add(button, cst.xy(5, 1));/*from w  w  w .j  av a  2 s.  c o m*/

    return comp;
}

From source file:com.autoupdater.gui.client.window.GuiClientWindow.java

License:Apache License

private void initializeControlPanel() {
    JPanel controlPanel = new JPanel();
    GridBagConstraints gbc_controlPanel = new GridBagConstraints();
    gbc_controlPanel.fill = GridBagConstraints.BOTH;
    gbc_controlPanel.gridx = 0;// w  ww  . j a v a2  s.c om
    gbc_controlPanel.gridy = 1;
    contentPane.add(controlPanel, gbc_controlPanel);
    controlPanel.setLayout(new FormLayout(
            new ColumnSpec[] { ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC,
                    FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, }));

    checkUpdatesButton = new JButton("Check updates");
    controlPanel.add(checkUpdatesButton, "3, 2, left, fill");

    installUpdatesButton = new JButton("Install all updates");
    controlPanel.add(installUpdatesButton, "5, 2, fill, fill");

    cancelDownloadButton = new JButton("Cancel downloads");
    controlPanel.add(cancelDownloadButton, "7, 2, fill, fill");

    statusLabel = new JLabel("Welcome to AutoUpdater\r\n");
    controlPanel.add(statusLabel, "1, 4, 7, 1");

    progressBar = new JProgressBar();
    controlPanel.add(progressBar, "1, 6, 7, 1, fill, fill");
}

From source file:com.autoupdater.gui.client.window.tabs.installed.tabs.information.InformationPreview.java

License:Apache License

private void initialize(Program program) {
    this.program = program;

    setLayout(new FormLayout(
            new ColumnSpec[] { ColumnSpec.decode("18px"), ColumnSpec.decode("143px"),
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:200px:grow"),
                    ColumnSpec.decode("max(5dlu;default)"), },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("14px"),
                    FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("14px"), FormFactory.RELATED_GAP_ROWSPEC,
                    RowSpec.decode("14px"), FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("235px:grow"),
                    RowSpec.decode("max(5dlu;default)"), }));

    add(new JLabel("Program name:"), "2, 2, right, top");
    programNameLabel = new JLabel();
    add(programNameLabel, "4, 2, left, top");

    add(new JLabel("Path to program directory:"), "2, 4, right, top");
    programPathLabel = new JLabel();
    add(programPathLabel, "4, 4, left, top");

    add(new JLabel("Server repo address:"), "2, 6, right, top");
    serverAddressLabel = new JLabel();
    add(serverAddressLabel, "4, 6, left, top");

    add(new JLabel("Packages:"), "2, 8, right, top");

    packagesLabel = new JTextArea();
    packagesLabel.setWrapStyleWord(true);
    packagesLabel.setLineWrap(true);//from w  w  w .j a  va  2  s .c o  m
    packagesLabel.setEditable(false);

    JScrollPane scrollPane = new JScrollPane(packagesLabel);
    add(scrollPane, "4, 8, fill, fill");

    refresh();
}

From source file:com.aw.swing.mvp.cmp.pick.FrmPick.java

License:Open Source License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL/*from   www  . j  a  v a  2 s.  co m*/
 */
private void $$$setupUI$$$() {
    createUIComponents();
    pnlMain = new JPanel();
    pnlMain.setLayout(new FormLayout(
            "left:25dlu:noGrow,fill:52dlu:noGrow,left:8dlu:noGrow,fill:85dlu:noGrow,left:58dlu:noGrow,fill:10px:noGrow,fill:50dlu:noGrow,left:22dlu:noGrow",
            "center:12dlu:noGrow,top:4dlu:noGrow,center:12dlu:noGrow,top:5dlu:noGrow,center:18px:noGrow,top:4dlu:noGrow,top:12dlu:noGrow,center:188dlu:noGrow,top:4dlu:noGrow,top:12dlu:noGrow,center:max(d;4dlu):noGrow,center:12dlu:noGrow"));
    pnlMain.setMinimumSize(new Dimension(501, 425));
    pnlMain.setOpaque(true);
    pnlMain.setPreferredSize(new Dimension(501, 425));
    lblSearch = new JLabel();
    lblSearch.setText("Descripcin");
    lblSearch.setDisplayedMnemonic('D');
    lblSearch.setDisplayedMnemonicIndex(0);
    CellConstraints cc = new CellConstraints();
    pnlMain.add(lblSearch, cc.xy(2, 3, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    btnSearch = new JButton();
    btnSearch.setText("Buscar");
    btnSearch.setMnemonic('B');
    btnSearch.setDisplayedMnemonicIndex(0);
    pnlMain.add(btnSearch, cc.xy(7, 3));
    footerPanel.setLayout(
            new FormLayout("fill:73dlu:noGrow,left:191dlu:noGrow,fill:48dlu:noGrow", "center:12dlu:noGrow"));
    pnlMain.add(footerPanel, cc.xyw(1, 12, 8, CellConstraints.DEFAULT, CellConstraints.FILL));
    lblF10 = new JLabel();
    lblF10.setText(" [F10] Aceptar");
    footerPanel.add(lblF10, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    lblEsc = new JLabel();
    lblEsc.setText(" [Esc] Salir");
    footerPanel.add(lblEsc, cc.xy(3, 1));
    sepCriterioBusqueda.setSeparatorTitle("Criterio de Bsqueda");
    pnlMain.add(sepCriterioBusqueda, cc.xyw(1, 1, 8, CellConstraints.FILL, CellConstraints.FILL));
    pnlTitGrid.setLayout(
            new FormLayout("fill:204dlu:noGrow,left:88dlu:noGrow,fill:15dlu:noGrow", "center:12dlu:noGrow"));
    pnlMain.add(pnlTitGrid, cc.xyw(1, 7, 8, CellConstraints.FILL, CellConstraints.FILL));
    lblTitGrid = new JLabel();
    lblTitGrid.setText(" Relacin :");
    lblTitGrid.setDisplayedMnemonic('R');
    lblTitGrid.setDisplayedMnemonicIndex(1);
    pnlTitGrid.add(lblTitGrid, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    chkSel = new JCheckBox();
    chkSel.setBackground(new Color(-16747105));
    chkSel.setText("");
    pnlTitGrid.add(chkSel, cc.xy(3, 1));
    final JScrollPane scrollPane1 = new JScrollPane();
    scrollPane1.setMinimumSize(new Dimension(454, 418));
    pnlMain.add(scrollPane1, cc.xyw(1, 8, 8, CellConstraints.FILL, CellConstraints.FILL));
    tblGrid = new JTable();
    tblGrid.setMinimumSize(new Dimension(450, 400));
    scrollPane1.setViewportView(tblGrid);
    final JLabel label1 = new JLabel();
    label1.setText(" Nmero de Registros:");
    pnlMain.add(label1, cc.xyw(1, 10, 3));
    lblNumRegistros = new JLabel();
    lblNumRegistros.setText("Label");
    pnlMain.add(lblNumRegistros, cc.xyw(4, 10, 3));
    txtSearch = new JTextField();
    pnlMain.add(txtSearch, cc.xyw(4, 3, 2, CellConstraints.FILL, CellConstraints.DEFAULT));
    lblSearch2 = new JLabel();
    lblSearch2.setText("Descripcin2");
    lblSearch2.setDisplayedMnemonic('D');
    lblSearch2.setDisplayedMnemonicIndex(0);
    pnlMain.add(lblSearch2, cc.xy(2, 5, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    cmbAlmacen = new JComboBox();
    pnlMain.add(cmbAlmacen, cc.xy(4, 5));
    lblSearch.setLabelFor(txtSearch);
    lblSearch2.setLabelFor(txtSearch);
}