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

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

Introduction

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

Prototype

public CellConstraints xyw(int col, int row, int colSpan) 

Source Link

Document

Sets the column, row, width, and height; uses a height (row span) of 1 and the horizontal and vertical default alignments.

Examples:

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

Usage

From source file:aconsole.config.PropertyPanel.java

License:Open Source License

public int addColorButton(ColorProperty src, String label, String tooltip, FormLayout layout,
        PanelBuilder panelBuilder, CellConstraints cc, int row) {
    ColorLink cl = new ColorLink();
    cl.prop = src;/*from   w w  w. ja  va  2s.com*/
    cl.btn = new ColorButton();
    cl.btn.setToolTipText(tooltip);
    cl.reset();
    layout.insertRow(row, RowSpec.decode("pref"));
    layout.insertRow(row + 1, RowSpec.decode("5dlu"));
    panelBuilder.add(new JLabel(label), cc.xyw(2, row, 1));
    panelBuilder.add(cl.btn, cc.xyw(3, row, 1));
    linklist.add(cl);
    return 2;
}

From source file:aconsole.config.PropertyPanel.java

License:Open Source License

public PropertyPanel() {
    CellConstraints cc = new CellConstraints();
    FormLayout layout = new FormLayout("5dlu, pref, pref,default:grow", "pref, 5dlu");
    PanelBuilder panelBuilder = new PanelBuilder(layout);
    panelBuilder.add(new JLabel(mLocalizer.msg("title", "setup appearance of TVBConsole")), cc.xyw(2, 1, 2));
    int row = 2;//from w w  w.  j  ava2s.  com
    row += addColorButton(AConsole.getBg(), mLocalizer.msg("Bg.label", "background:"),
            mLocalizer.msg("Bg.tooltip", "select the color for the console background"), layout, panelBuilder,
            cc, row);

    row += addColorButton(AConsole.getSelection(),
            mLocalizer.msg("Selection.label", "background for selected rows:"),
            mLocalizer.msg("Selection.tooltip", ""), layout, panelBuilder, cc, row);
    row += addColorButton(AConsole.getSelectionText(),
            mLocalizer.msg("SelectionText.label", "color for selected text:"),
            mLocalizer.msg("SelectionText.tooltip", ""), layout, panelBuilder, cc, row);
    row += addColorButton(AConsole.getSystemOutText(),
            mLocalizer.msg("SystemOutText.label", "color for text send to System.out:"),
            mLocalizer.msg("SystemOutText.tooltip", ""), layout, panelBuilder, cc, row);
    row += addColorButton(AConsole.getSystemErrText(),
            mLocalizer.msg("SystemErrText.label", "color for text send to System.err:"),
            mLocalizer.msg("SystemErrText.tooltip", ""), layout, panelBuilder, cc, row);
    row += addColorButton(AConsole.getLevelSevereText(),
            mLocalizer.msg("LevelSevereText.label", "text with logger-level of severe or higher:"),
            mLocalizer.msg("LevelSevereText.tooltip", ""), layout, panelBuilder, cc, row);
    row += addColorButton(AConsole.getLevelWarningText(),
            mLocalizer.msg("LevelWarningText.label", "text with logger-level between warning and severe:"),
            mLocalizer.msg("LevelWarningText.tooltip", ""), layout, panelBuilder, cc, row);
    row += addColorButton(AConsole.getLevelInfoText(),
            mLocalizer.msg("LevelInfoText.label", "text with logger-level between info and warning:"),
            mLocalizer.msg("LevelInfoText.tooltip", ""), layout, panelBuilder, cc, row);
    row += addColorButton(AConsole.getLevelOtherText(),
            mLocalizer.msg("LevelOtherText.label", "text with logger-level less than warning:"),
            mLocalizer.msg("LevelOtherText.tooltip", ""), layout, panelBuilder, cc, row);

    panel = panelBuilder.getPanel();

}

From source file:action.About.java

License:Open Source License

private JPanel getaboutPanel() {
    FormLayout lay = new FormLayout("left:pref, 3dlu, left:pref, max(200dlu;pref)",
            "p, p, 10dlu, p, 3dlu, p, 10dlu, p, 10dlu, p, p");// rows
    CellConstraints cc = new CellConstraints();
    PanelBuilder build = new PanelBuilder(lay);

    ImageIcon ii = TResourceUtils.getIcon("appIcon", 80);
    JLabel jl = new JLabel(ii);
    jl.setHorizontalAlignment(JLabel.LEFT);
    build.add(jl, cc.xyw(1, 1, 4));
    build.add(new JLabel(TStringUtils.getBundleString("about.app")), cc.xyw(1, 2, 4));

    build.add(new JLabel(TStringUtils.getBundleString("about.version")), cc.xy(1, 4));
    build.add(new JLabel(SystemVariables.getStringVar("versionID")), cc.xy(3, 4));

    build.add(new JLabel(TStringUtils.getBundleString("about.update")), cc.xy(1, 6));
    build.add(new JLabel(SystemVariables.getStringVar("updateID")), cc.xy(3, 6));

    build.add(new JLabel(TStringUtils.getBundleString("about.msg1")), cc.xyw(1, 8, 4));

    build.add(new JLabel(TStringUtils.getBundleString("about.msg2")), cc.xyw(1, 10, 4));
    build.add(getOpenSourcePanel(), cc.xyw(1, 11, 4));
    // build.add(Box.createVerticalStrut(4), cc.xy(1, 7));
    JPanel jp = build.getPanel();
    jp.setBorder(new EmptyBorder(4, 4, 4, 4));
    return jp;/*  w w w  . j a v  a 2 s. co m*/
}

From source file:ambit2.ui.editors.BeanEditor.java

License:Open Source License

public void buildFields(PanelBuilder builder, CellConstraints cc) {

    builder.addLabel(detailsCaption, cc.xyw(1, 1, 3));
    int row = 3;//from  w  w w.  jav a  2  s .c o m
    for (int i = 0; i < columns.length; i++) {
        if (null == columns[i]) {
            builder.addSeparator(captions[i], cc.xyw(1, row, 3));
            row++;
        } else {
            builder.addLabel(capitalizeFirstLetter(captions[i]), cc.xy(1, row));
            builder.add(fields[i], cc.xy(3, row));
            row += 2;
        }
    }
}

From source file:at.lame.hellonzb.preferences.tabs.PrefDownloadTab.java

License:Open Source License

private void createPanel() {
    String sepString = null;//from ww w  .ja v a2  s.com
    CompContainer compc = new CompContainer(null, null);

    par2CmdLineAppButton = new JButton(localer.getBundleText("DownloadSettingsPar2ChooseButton"));
    par2CmdLineAppButton.setName("DownloadSettingsPar2ExeLocation-Button");
    unrarCmdLineAppButton = new JButton(localer.getBundleText("DownloadSettingsPar2ChooseButton"));
    unrarCmdLineAppButton.setName("DownloadSettingsUnrarExeLocation-Button");

    // create layout for this tab/panel
    FormLayout layout = new FormLayout("right:pref, 3dlu, [100dlu,pref]:grow, 3dlu, pref", // cols
            "p, 3dlu, p, 9dlu, p, 3dlu, p, 3dlu, p, 9dlu, p, 3dlu, p, 3dlu, p"); // rows

    // create builder
    PanelBuilder builder = new PanelBuilder(layout, panel);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();

    // fill the grid with components

    //////////////////////////////////////////////////////////////////////
    // group "connection"
    sepString = localer.getBundleText("DownloadSettingsGroupConnection");
    builder.addSeparator(sepString, cc.xyw(1, 1, 5));

    // max connection speed
    createTextfield(compc, "DownloadSettingsMaxConnectionSpeed", "NumericTextField");
    compc.label.setText(compc.label.getText() + " (KB/s)");
    builder.add(compc.label, cc.xy(1, 3));
    builder.add(compc.comp, cc.xy(3, 3));

    //////////////////////////////////////////////////////////////////////
    // group "par2 check"
    sepString = localer.getBundleText("DownloadSettingsGroupPar2Check");
    builder.addSeparator(sepString, cc.xyw(1, 5, 5));

    // par2 check after download
    createCheckbox(compc, "DownloadSettingsPar2Check", false);
    par2ExtractCheckbox = (JCheckBox) compc.comp;
    builder.add(compc.label, cc.xy(1, 7));
    builder.add(compc.comp, cc.xy(3, 7));

    // path to par2 command line tool
    createTextfield(compc, "DownloadSettingsPar2ExeLocation", "JTextField");
    par2LocationTextField = (JTextField) compc.comp;
    builder.add(compc.label, cc.xy(1, 9));
    builder.add(compc.comp, cc.xy(3, 9));
    builder.add(par2CmdLineAppButton, cc.xy(5, 9));

    if (!par2ExtractCheckbox.isSelected()) {
        par2LocationTextField.setEnabled(false);
        par2CmdLineAppButton.setEnabled(false);
    }

    //////////////////////////////////////////////////////////////////////
    // group "RAR archives"
    sepString = localer.getBundleText("DownloadSettingsGroupArcExtract");
    builder.addSeparator(sepString, cc.xyw(1, 11, 5));

    // automatically extract (RAR) archive files
    createCheckbox(compc, "DownloadSettingsExtractRARArchives", false);
    rarExtractCheckbox = (JCheckBox) compc.comp;
    builder.add(compc.label, cc.xy(1, 13));
    builder.add(compc.comp, cc.xy(3, 13));

    // path to unrar command line tool
    createTextfield(compc, "DownloadSettingsUnrarExeLocation", "JTextField");
    unrarLocationTextField = (JTextField) compc.comp;
    builder.add(compc.label, cc.xy(1, 15));
    builder.add(compc.comp, cc.xy(3, 15));
    builder.add(unrarCmdLineAppButton, cc.xy(5, 15));

    if (!rarExtractCheckbox.isSelected()) {
        unrarLocationTextField.setEnabled(false);
        unrarCmdLineAppButton.setEnabled(false);
    }
}

From source file:at.lame.hellonzb.preferences.tabs.PrefExtendedTab.java

License:Open Source License

private void createPanel() {
    CompContainer compc = new CompContainer(null, null);
    String sepString = null;/*from ww w.j a v a2 s  .c o  m*/

    // create layout for this tab/panel
    FormLayout layout = new FormLayout("right:pref, 3dlu, pref:grow", // cols
            "p, 3dlu, p, 9dlu, p, 3dlu, p, 9dlu, p, 9dlu, p"); // rows

    // create builder
    PanelBuilder builder = new PanelBuilder(layout, panel);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();

    // fill the grid with components

    //////////////////////////////////////////////////////////////////////
    // group "locale settings"
    sepString = localer.getBundleText("ExtendedSettingsGroupLocaleSettings");
    builder.addSeparator(sepString, cc.xyw(1, 1, 3));

    // choose language
    String[] boxvalues = new String[] { "-default-", "English", "German", "Dutch", "Turkish" };
    createCombobox(compc, "ExtendedSettingsChooseLanguage", boxvalues, 0);
    builder.add(compc.label, cc.xy(1, 3));
    builder.add(compc.comp, cc.xy(3, 3));

    //////////////////////////////////////////////////////////////////////
    // group "console output"
    sepString = localer.getBundleText("ExtendedSettingsGroupConsole");
    builder.addSeparator(sepString, cc.xyw(1, 5, 3));

    // activate console output 
    createCheckbox(compc, "ExtendedSettingsConsoleOutput", true);
    builder.add(compc.label, cc.xy(1, 7));
    builder.add(compc.comp, cc.xy(3, 7));

    //////////////////////////////////////////////////////////////////////
    // group "program settings"
    sepString = localer.getBundleText("GeneralSettingsGroupProgramSettings");
    builder.addSeparator(sepString, cc.xyw(1, 9, 3));

    // reset all hidden messages
    resetAllMsg = new JButton(localer.getBundleText("ExtendedSettingsResetMessages"));
    builder.add(resetAllMsg, cc.xyw(1, 11, 3));
}

From source file:at.lame.hellonzb.preferences.tabs.PrefGeneralTab.java

License:Open Source License

private void createPanel() {
    String sepString = null;/* w w  w . ja  v  a  2s . c o  m*/
    CompContainer compc = new CompContainer(null, null);
    downloadDirChooseButton = new JButton(localer.getBundleText("GeneralSettingsChooseDownloadDir"));
    downloadDirChooseButton.setName("GeneralSettingsChooseDownloadDir-Button");
    autoLoadDirChooseButton = new JButton(localer.getBundleText("GeneralSettingsChooseAutoLoadDir"));
    autoLoadDirChooseButton.setName("GeneralSettingsChooseAutoLoadDir-Button");

    // create layout for this tab/panel
    FormLayout layout = new FormLayout("right:pref, 3dlu, [200dlu,pref]:grow, 3dlu, pref", // cols
            "p, 3dlu, p, 3dlu, p, 9dlu, p, 3dlu, p, 9dlu, p, 3dlu, p, 3dlu, p"); // rows

    // create builder
    PanelBuilder builder = new PanelBuilder(layout, panel);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();

    // fill the grid with components

    //////////////////////////////////////////////////////////////////////
    // group "general settings"
    sepString = localer.getBundleText("GeneralSettingsGroupGeneralSettings");
    builder.addSeparator(sepString, cc.xyw(1, 1, 5));

    // download directory
    createTextfield(compc, "GeneralSettingsDownloadDir", "JTextField");
    builder.add(compc.label, cc.xy(1, 3));
    builder.add(compc.comp, cc.xy(3, 3));
    builder.add(downloadDirChooseButton, cc.xy(5, 3));

    // auto-load directory
    createTextfield(compc, "GeneralSettingsAutoLoadDir", "JTextField");
    builder.add(compc.label, cc.xy(1, 5));
    builder.add(compc.comp, cc.xy(3, 5));
    builder.add(autoLoadDirChooseButton, cc.xy(5, 5));

    //////////////////////////////////////////////////////////////////////
    // group "nzb file loading"
    sepString = localer.getBundleText("GeneralSettingsGroupNzbLoadBehaviour");
    builder.addSeparator(sepString, cc.xyw(1, 7, 5));

    // delete nzb file after loading
    createCheckbox(compc, "GeneralSettingsDelNzbAfterLoading", true);
    builder.add(compc.label, cc.xy(1, 9));
    builder.add(compc.comp, cc.xy(3, 9));

    //////////////////////////////////////////////////////////////////////
    // group "program settings"
    sepString = localer.getBundleText("GeneralSettingsGroupProgramSettings");
    builder.addSeparator(sepString, cc.xyw(1, 11, 5));

    // show system tray icon
    createCheckbox(compc, "GeneralSettingsShowTrayIcon", false);
    builder.add(compc.label, cc.xy(1, 13));
    builder.add(compc.comp, cc.xy(3, 13));

    // check for new progarm version
    createCheckbox(compc, "GeneralSettingsCheckForUpdates", true);
    builder.add(compc.label, cc.xy(1, 15));
    builder.add(compc.comp, cc.xy(3, 15));
}

From source file:at.lame.hellonzb.preferences.tabs.PrefServerTab.java

License:Open Source License

private void createPanel() {
    String sepString = null;//from   w  w  w .  ja v  a2s. c o  m
    CompContainer compc = new CompContainer(null, null);

    // create layout for this tab/panel
    FormLayout layout = new FormLayout("right:pref, 3dlu, pref:grow, 3dlu, [20dlu,pref]", // cols
            "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 9dlu, p, 3dlu, p, 3dlu, p"); // rows

    // create builder
    PanelBuilder builder = new PanelBuilder(layout, panel);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();

    // fill the grid with components

    //////////////////////////////////////////////////////////////////////
    // group "connection"
    sepString = localer.getBundleText("ServerSettingsGroupConnection");
    builder.addSeparator(sepString, cc.xyw(1, 1, 5));

    // server name
    createTextfield(compc, "ServerSettingsServerName", "JTextField");
    builder.add(compc.label, cc.xy(1, 3));
    builder.add(compc.comp, cc.xy(3, 3));

    // host
    createTextfield(compc, "ServerSettingsHost", "JTextField");
    builder.add(compc.label, cc.xy(1, 5));
    builder.add(compc.comp, cc.xy(3, 5));

    // port
    createTextfield(compc, "ServerSettingsPort", "NumericTextField");
    if (prefMap.get("ServerSettingsPort").equals(""))
        ((JTextField) compc.comp).setText("119");
    stdServerPort = (NumericTextField) compc.comp;
    builder.add(compc.label, cc.xy(1, 7));
    builder.add(compc.comp, cc.xy(3, 7));

    // "use SSL connections" checkbox
    createCheckbox(compc, "ServerSettingsUseSSL", false);
    stdSslCB = ((JCheckBox) compc.comp);
    builder.add(compc.label, cc.xy(1, 9));
    builder.add(compc.comp, cc.xy(3, 9));

    // SSL server port number
    createTextfield(compc, "ServerSettingsSSLPort", "NumericTextField");
    if (prefMap.get("ServerSettingsSSLPort").equals(""))
        ((JTextField) compc.comp).setText("563");
    sslServerPort = (NumericTextField) compc.comp;
    builder.add(compc.label, cc.xy(1, 11));
    builder.add(compc.comp, cc.xy(3, 11));

    if (!stdSslCB.isSelected()) {
        stdServerPort.setEnabled(true);
        sslServerPort.setEnabled(false);
    } else {
        stdServerPort.setEnabled(false);
        sslServerPort.setEnabled(true);
    }

    // create slider and add to layout (via new row)
    createSlider(compc, "ServerSettingsTimeout", 30, 310, 10, 40, 60, "s");
    builder.add(compc.label, cc.xy(1, 13));
    builder.add(compc.comp, cc.xy(3, 13));
    builder.add(compc.extraLabel, cc.xy(5, 13));

    // create slider and add to layout (via new row)
    createSlider(compc, "ServerSettingsThreadCount", 1, 51, 1, 5, 1, "");
    builder.add(compc.label, cc.xy(1, 15));
    builder.add(compc.comp, cc.xy(3, 15));
    builder.add(compc.extraLabel, cc.xy(5, 15));

    //////////////////////////////////////////////////////////////////////
    // group "authentication"
    sepString = localer.getBundleText("ServerSettingsGroupAuthentication");
    builder.addSeparator(sepString, cc.xyw(1, 17, 5));

    // username
    createTextfield(compc, "ServerSettingsUsername", "JTextField");
    builder.add(compc.label, cc.xy(1, 19));
    builder.add(compc.comp, cc.xy(3, 19));

    // password
    createTextfield(compc, "ServerSettingsPassword", "JPasswordField");
    builder.add(compc.label, cc.xy(1, 21));
    builder.add(compc.comp, cc.xy(3, 21));
}

From source file:at.lame.hellonzb.preferences.tabs.PrefUsageStatsTab.java

License:Open Source License

private void createPanel() {
    CompContainer compc = new CompContainer(null, null);
    String sepString = null;// w  w  w .j a  va 2 s  . c om

    // create layout for this tab/panel
    FormLayout layout = new FormLayout("right:pref, 3dlu, pref:grow", // cols
            "p, 3dlu, p, 9dlu, p"); // rows

    // create builder
    PanelBuilder builder = new PanelBuilder(layout, panel);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();

    // fill the grid with components

    //////////////////////////////////////////////////////////////////////
    // group "usage statistics"
    sepString = localer.getBundleText("PrefDialogUsageStatsSettingsPane");
    builder.addSeparator(sepString, cc.xyw(1, 1, 3));

    // actiave usage statistics?
    createCheckbox(compc, "UsageStatsSettingsActivate", true);
    activateUsageStats = ((JCheckBox) compc.comp);
    builder.add(compc.label, cc.xy(1, 3));
    builder.add(compc.comp, cc.xy(3, 3));

    // info label
    JLabel infotxt = new JLabel(localer.getBundleText("UsageStatsSettingsInfoTxt"));
    infotxt.setName("Label-UsageStatsSettingsInfoTxt");
    infotxt.setFont(infotxt.getFont().deriveFont(Font.PLAIN));
    builder.add(infotxt, cc.xy(3, 5));
}

From source file:blogthisplugin.BlogSettingsTab.java

License:Open Source License

/**
 * Create the SettingsPanel//from w  ww . j av  a2 s.c  o  m
 */
public JPanel createSettingsPanel() {
    final EnhancedPanelBuilder settingsPanel = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode()
            + "," + FormFactory.PREF_COLSPEC.encode() + "," + FormFactory.RELATED_GAP_COLSPEC.encode() + ","
            + FormFactory.PREF_COLSPEC.encode() + ", fill:pref:grow");

    String[] services = { "", "Blogger.com", "Wordpress", "b2evolution" };

    mServiceCombo = new JComboBox(services);

    if (mSettings.getBlogService() == BlogService.Blogger) {
        mServiceCombo.setSelectedIndex(1);
    } else if (mSettings.getBlogService() == BlogService.WordPress) {
        mServiceCombo.setSelectedIndex(2);
    } else if (mSettings.getBlogService() == BlogService.B2Evolution) {
        mServiceCombo.setSelectedIndex(3);
    }

    mServiceCombo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateAfterServiceSelection();
        }
    });

    mServiceUrlLabel = new JLabel(mLocalizer.msg("Url", "Url") + ':');
    mServiceUrlLabel.setEnabled(mServiceCombo.getSelectedIndex() >= 2);

    mServiceUrlField = new JTextField();
    mServiceUrlField.setEnabled(mServiceCombo.getSelectedIndex() >= 2);
    mServiceUrlField.setText(mSettings.getBlogUrl());

    CellConstraints cc = new CellConstraints();

    settingsPanel.addRow();
    settingsPanel.add(new JLabel(mLocalizer.msg("Service", "Blog-Service") + ':'),
            cc.xy(2, settingsPanel.getRow()));
    settingsPanel.add(mServiceCombo, cc.xy(4, settingsPanel.getRow()));

    settingsPanel.addRow();
    settingsPanel.add(mServiceUrlLabel, cc.xy(2, settingsPanel.getRow()));
    settingsPanel.add(mServiceUrlField, cc.xyw(4, settingsPanel.getRow(), 2));

    mConfigPanel = new PluginProgramConfigurationPanel(mPlugin.getSelectedPluginProgramFormattings(),
            mPlugin.getAvailableLocalPluginProgramFormattings(), BlogThisPlugin.getDefaultFormatting(), true,
            false);

    settingsPanel.addParagraph(mLocalizer.msg("formattings", "Formattings"));

    settingsPanel.addGrowingRow();
    settingsPanel.add(mConfigPanel, cc.xyw(1, settingsPanel.getRow(), 5));

    return settingsPanel.getPanel();
}