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:brainflow.colormap.ColorIntervalEditor.java

private void setupLayout() {
    FormLayout layout = new FormLayout(
            "2dlu, l:max(p;25dlu), 5dlu, max(p;15dlu), 5dlu, max(p;15dlu), 5dlu, max(p;15dlu), 5dlu, max(p;15dlu), 2dlu",
            "2dlu, p, 4dlu, p, 4dlu, p, 2dlu");
    layout.addGroupedColumn(4);//from ww w.j av a 2 s.c  o  m
    layout.addGroupedColumn(6);
    layout.addGroupedColumn(8);
    layout.addGroupedColumn(10);
    setLayout(layout);
    CellConstraints cc = new CellConstraints();

    JLabel redLabel = new JLabel("R");
    redLabel.setToolTipText("Red");
    add(redLabel, cc.xy(4, 2));

    JLabel greenLabel = new JLabel("G");
    greenLabel.setToolTipText("Green");
    add(greenLabel, cc.xy(6, 2));

    JLabel blueLabel = new JLabel("B");
    blueLabel.setToolTipText("Blue");

    add(blueLabel, cc.xy(8, 2));

    JLabel alphaLabel = new JLabel("A");
    alphaLabel.setToolTipText("Alpha/Opacity");
    add(alphaLabel, cc.xy(10, 2));

    add(new JideButton(colorIcon), cc.xy(2, 4));
    add(new JLabel(" Range: "), cc.xy(2, 6));
    add(new JLabel("" + interval.getRed()), cc.xy(4, 4));
    add(new JLabel("" + interval.getGreen()), cc.xy(6, 4));
    add(new JLabel("" + interval.getBlue()), cc.xy(8, 4));
    add(new JLabel("" + interval.getAlpha()), cc.xy(10, 4));

    NumberFormat format = DecimalFormat.getNumberInstance();
    format.setMaximumFractionDigits(2);

    lowField = new JFormattedTextField(format);
    highField = new JFormattedTextField(format);

    lowField.setValue(interval.getMinimum());
    highField.setValue(interval.getMaximum());

    if (!isEditable) {
        lowField.setEditable(false);
        highField.setEditable(false);
    }

    add(lowField, cc.xywh(4, 6, 3, 1));
    //add(new JLabel(JideIconsFactory.getImageIcon(JideIconsFactory.Arrow.RIGHT)), cc.xy(6,6));
    add(highField, cc.xywh(8, 6, 3, 1));

}

From source file:bzh.plealog.bioinfo.ui.filter.BFilterEditor.java

License:Open Source License

private void createGUI() {
    DefaultFormBuilder builder;//ww  w  . j  a va2  s.  co  m
    FormLayout layout;
    JScrollPane scroller;
    JPanel top, expr, exprMain, rulesContainer;

    layout = new FormLayout("right:max(50dlu;p), 4dlu, 150dlu", "");
    builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    if (!_showRulesOnly) {
        _filterName = createTextField();
        _filterDescription = createTextField();
        builder.appendSeparator(FilterMessages.getString("BFilterEditor.ui.lbl.1"));
        builder.append(new JLabel(FilterMessages.getString("BFilterEditor.ui.lbl.2") + ": "), _filterName);
        builder.nextLine();
        builder.append(new JLabel(FilterMessages.getString("BFilterEditor.ui.lbl.3") + ": "),
                _filterDescription);
        builder.nextLine();
    }

    _rulesPanel = new JPanel();

    _rulesPanel.setLayout(new BoxLayout(_rulesPanel, BoxLayout.Y_AXIS));

    expr = new JPanel();
    expr.add(new JLabel(FilterMessages.getString("BFilterEditor.ui.lbl.4")));
    _exprType = new JComboBox<ExpressionTypeItem>();
    _exprType.addItem(_exprItems[ANY_EXPR_ITEM]);//or
    _exprType.addItem(_exprItems[ALL_EXPR_ITEM]);//and
    _exprType.setSelectedIndex(ALL_EXPR_ITEM);
    expr.add(_exprType);
    expr.add(new JLabel(FilterMessages.getString("BFilterEditor.ui.lbl.5") + ":"));
    exprMain = new JPanel(new BorderLayout());
    exprMain.add(expr, BorderLayout.WEST);
    rulesContainer = new JPanel(new BorderLayout());
    rulesContainer.add(_rulesPanel, BorderLayout.NORTH);
    scroller = new JScrollPane(rulesContainer);
    this.setLayout(new BorderLayout());
    top = new JPanel(new BorderLayout());
    if (!_showRulesOnly) {
        top.add(builder.getContainer(), BorderLayout.CENTER);
    }
    top.add(exprMain, BorderLayout.SOUTH);
    this.add(top, BorderLayout.NORTH);
    this.add(scroller, BorderLayout.CENTER);
    this.add(createHelper(), BorderLayout.SOUTH);
}

From source file:bzh.plealog.bioinfo.ui.filter.BRuleEditor.java

License:Open Source License

/**
 * Creates the GUI.//www  . j a  v  a  2 s.co  m
 */
private void createGUI(JButton add, JButton remove) {
    DefaultFormBuilder builder;
    FormLayout layout;
    JPanel valPnl;

    //create GUI components
    _accessors = new JComboBox<BAccessorEntry>();
    _accessors.addPopupMenuListener(new ResizableComboboxPopupMenuListener());
    _operators = new JComboBox<String>();
    _accessors.addPopupMenuListener(new ResizableComboboxPopupMenuListener());
    _value = createTextField();
    valPnl = new JPanel(new BorderLayout());
    valPnl.add(_value, BorderLayout.CENTER);
    _caseBox = new JCheckBox(FilterMessages.getString("BRuleEditor.ui.cbox.1"));
    _caseBox.setFont(CBX_FNT);
    valPnl.add(_caseBox, BorderLayout.SOUTH);
    _caseBox.setSelected(true);
    _caseBox.setVisible(false);
    //install listeners
    _accessors.addActionListener(new AccComboSelectionActionListener(_operators));

    //layout the GUI
    layout = new FormLayout("95dlu, 1dlu, 110dlu, 1dlu, 80dlu, 1dlu, 30dlu, 1dlu, 30dlu", "top:pref");
    builder = new DefaultFormBuilder(layout);
    //builder.setDefaultDialogBorder();
    builder.append(_accessors);
    builder.append(_operators);
    builder.append(valPnl);
    if (add != null)
        builder.append(add);
    if (remove != null)
        builder.append(remove);

    //sets default values
    fillAccessorsCombo(_accessors);
    _accessors.setSelectedIndex(0);

    this.setLayout(new BorderLayout());
    this.add(builder.getContainer(), BorderLayout.CENTER);
}

From source file:bzh.plealog.blastviewer.config.color.HitPolicyEditorBasePanel.java

License:Open Source License

/**
 * Create the UI.//from w  ww .ja  v  a  2 s  .  co  m
 * 
 * @param nClasses nb of classes to use
 */
protected void buildGUI(int nClasses) {
    DefaultFormBuilder builder;
    FormLayout layout;
    JLabel emptyLbl;
    JPanel pnl, pnl2, pnl3, pnl4;
    int i;

    emptyLbl = new JLabel();
    _valuesFrom = new JTextField[nClasses];
    _valuesTo = new JTextField[nClasses];
    for (i = 0; i < nClasses; i++) {
        _valuesFrom[i] = createTextField(false);
        _valuesTo[i] = createTextField(true);
    }
    initSpecialComponents(nClasses);
    nClasses--;
    for (i = 0; i < nClasses; i++) {
        _valuesTo[i].getDocument().addDocumentListener(new EditListener(_valuesTo[i], _valuesFrom[i + 1]));
    }
    nClasses++;
    layout = new FormLayout("30dlu, 2dlu, 25dlu, 2dlu, 80dlu, 2dlu, 40dlu, 2dlu, 40dlu, 2dlu, 40dlu", "");
    builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    for (i = 0; i < nClasses; i++) {
        if (i == 0) {
            builder.append(createLabel(MSG_P1));
            builder.append(getSpecialComponent(i));
            builder.append(createLabel(MSG_P2));
            builder.append(_valuesTo[i]);
            builder.append(emptyLbl);
            builder.append(emptyLbl);
        } else if (i == nClasses - 1) {
            builder.append(createLabel(MSG_P1));
            builder.append(getSpecialComponent(i));
            builder.append(createLabel(MSG_P5));
            builder.append(emptyLbl);
            builder.append(emptyLbl);
            builder.append(emptyLbl);
        } else {
            builder.append(createLabel(MSG_P1));
            builder.append(getSpecialComponent(i));
            builder.append(createLabel(MSG_P3));
            builder.append(_valuesFrom[i]);
            builder.append(createLabel(MSG_P4));
            builder.append(_valuesTo[i]);
        }
        if ((i + 1) < nClasses)
            builder.nextLine();
    }
    pnl = new JPanel();
    _valueTypeChooser = new JComboBox<>();
    _valueTypeChooser.setFont(DEF_FNT);
    _valueTypeChooser.addActionListener(new ValueTypeSelector());
    for (i = 0; i < ColorPolicyConfigImplem.FIELDS.length; i++) {
        _valueTypeChooser.addItem(ColorPolicyConfigImplem.FIELDS[i]);
    }
    pnl.add(createLabel(getHeaderMsg()));
    pnl.add(_valueTypeChooser);
    pnl.add(createLabel("values"));
    pnl2 = new JPanel(new BorderLayout());
    pnl2.add(pnl, BorderLayout.WEST);
    pnl2.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
    pnl3 = new JPanel(new BorderLayout());
    pnl3.add(createHelper(5, getHelpMsg()), BorderLayout.CENTER);
    pnl4 = new JPanel(new BorderLayout());
    pnl4.add(pnl2, BorderLayout.NORTH);
    pnl4.add(builder.getContainer(), BorderLayout.CENTER);
    pnl4.add(pnl3, BorderLayout.SOUTH);
    this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    this.add(pnl4);
}

From source file:bzh.plealog.blastviewer.msa.MSAPanel.java

License:Open Source License

/**
 * Creates the consensus panel./*w ww. j a va2s.c o  m*/
 */
private Component createConsensusPanel() {
    DefaultFormBuilder builder;
    FormLayout layout;

    layout = new FormLayout("right:max(20dlu;p), 2dlu, 100dlu, 10dlu, " + "right:max(20dlu;p), 2dlu, 110dlu",
            "");
    builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.append(new JLabel(BVMessages.getString("PscmMsaViewer.lbl.cons")), _consensusSlider);
    builder.append(new JLabel(BVMessages.getString("PscmMsaViewer.lbl.pos")), _positionner);
    return builder.getContainer();
}

From source file:bzh.plealog.blastviewer.phylo.PhyloPanel.java

License:Open Source License

protected Component createTreeLayoutPanel() {
    DefaultFormBuilder builder;//from  w  w w. j  a  va  2s. com
    FormLayout layout;
    OptionMenuButton btn;

    _circLayoutBox = createChkBoxMnu(BVMessages.getString("PhyloPanel.layout.circ"));
    _circLayoutBox.setSelected(_treeLayoutType == TreeLayoutType.CIRCULAR);
    _circLayoutBox.addActionListener(new CircLayoutAction());

    _dendLayoutBox = createChkBoxMnu(BVMessages.getString("PhyloPanel.layout.dend"));
    _dendLayoutBox.setSelected(_treeLayoutType == TreeLayoutType.DENDOGRAM);
    _dendLayoutBox.addActionListener(new DendLayoutAction());

    _expandLeavesBox = createChkBoxMnu(BVMessages.getString("PhyloPanel.opt1.lbl"));
    _expandLeavesBox.setSelected(_expandLeaves);
    _expandLeavesBox.addActionListener(new ExpandLeavesAction());

    _showValuesBox = createChkBoxMnu(BVMessages.getString("PhyloPanel.opt2.lbl"));
    _showValuesBox.setSelected(_showValues);
    _showValuesBox.addActionListener(new ShowValuesAction());

    _antiAliasBox = createChkBoxMnu(BVMessages.getString("PhyloPanel.opt3.lbl"));
    _antiAliasBox.setSelected(_antiAlias);
    _antiAliasBox.addActionListener(new AntiAliasAction());

    _txtAntiAliasBox = createChkBoxMnu(BVMessages.getString("PhyloPanel.opt4.lbl"));
    _txtAntiAliasBox.setSelected(_txtAntiAlias);
    _txtAntiAliasBox.addActionListener(new TxtAntiAliasAction());

    _clipLabelBox = createChkBoxMnu(BVMessages.getString("PhyloPanel.opt5.lbl"));
    _clipLabelBox.setSelected(_clipLabel);
    _clipLabelBox.addActionListener(new ClipLabelAction());

    _dynFntResizeBox = createChkBoxMnu(BVMessages.getString("PhyloPanel.opt6.lbl"));
    _dynFntResizeBox.setSelected(_dynFntResize);
    _dynFntResizeBox.addActionListener(new DynFntResizeAction());

    btn = new OptionMenuButton(BVMessages.getString("PhyloPanel.options.lbl"));
    btn.setPopup(getOptionPopupMenu());

    _searcher = new SearchField();
    _searcher.setHelperText(BVMessages.getString("PhyloPanel.search.lbl"));
    _searcher.setFont(_fnt);
    _searcher.setToolTipText(BVMessages.getString("PhyloPanel.search.toolTip"));
    _searcher.addPropertyChangeListener(SearchField.PROPERTY_TEXT, new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            String l = evt.getNewValue().toString();
            if (l.equals(_lastSearch) || l.matches("\\s+")) {
            } else {
                setSelectedNodes(search(l));
            }
        }
    });
    layout = new FormLayout("50dlu, 10dlu, 100dlu", // , 10dlu,
            // right:max(20dlu;p), 2dlu,
            // 60dlu",
            "");
    builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.append(btn);
    builder.append(_searcher);
    return builder.getContainer();
}

From source file:ca.dsrg.mirador.ui.MatchPanel.java

/**                                                                     DOCDO: Provide method overview.
 *
 *///from ww  w .  ja  v  a 2s  .  c om
private JPanel assembleControlPanel() {
    // Instantiate the components.
    JPanel master_pnl = assembleControlMasterPanel();
    match_btn_ = new JButton("Match");
    unmatch_btn_ = new JButton("Unmatch");

    // Set visual and behavioral aspects of the components.
    match_btn_.setMnemonic(KeyEvent.VK_M);
    match_btn_.setToolTipText("Pair the selected tree elements.");
    unmatch_btn_.setMnemonic(KeyEvent.VK_U);
    unmatch_btn_.setToolTipText("Unpair the selected tree elements.");

    // Set panel layout and constraints.
    String col_spec = "$rgap, pref, $rgap";
    String row_spec = "pref, $ugap, pref, 4dlu, pref";
    FormLayout layout = new FormLayout(col_spec, row_spec);

    // Initialize builder of the panel with the layout and a border.
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.DLU2_BORDER);

    // Add components to the panel.
    CellConstraints cc = new CellConstraints();
    builder.add(master_pnl, cc.rcw(1, 1, 3));
    builder.add(match_btn_, cc.rc(3, 2));
    builder.add(unmatch_btn_, cc.rc(5, 2));

    return builder.getPanel();
}

From source file:ca.dsrg.mirador.ui.MatchPanel.java

/**
 * Instantiate the GUI's components, and populate its containers.
 *///from   w w w. j  a  v a  2 s. c o m
private void assembleGui() {
    // Assemble the constituent panels.
    weight_pnl_ = assembleWeightPanel();
    JPanel option_pnl = assembleOptionPanel();
    JPanel view_pnl = assembleViewPanel();

    // Set panel layout and constraints.
    String col_spec = "pref:grow";
    String row_spec = "pref, $ugap, pref, $ugap, fill:pref:grow";
    FormLayout layout = new FormLayout(col_spec, row_spec);

    // Initialize builder of the panel with the layout and a border.
    PanelBuilder builder = new PanelBuilder(layout, this);
    builder.setBorder(Borders.TABBED_DIALOG_BORDER);

    // Add components to the panel.
    CellConstraints cc = new CellConstraints();
    builder.add(weight_pnl_, cc.rc(1, 1));
    builder.add(option_pnl, cc.rc(3, 1));
    builder.add(view_pnl, cc.rc(5, 1));
}

From source file:ca.dsrg.mirador.ui.MatchPanel.java

/**                                                                     DOCDO: Provide method overview.
 *
 */// w w  w .  j a  va 2  s. c o  m
private JPanel assembleOptionPanel() {
    // Instantiate the components.
    JComponent separator = DefaultComponentFactory.getInstance().createSeparator("Set Model Matching Options",
            SwingConstants.CENTER);
    strategy_pnl_ = assembleOptionStrategyPanel();

    sync_cbx_ = new JCheckBox();
    InvocationParser parser = Mirador.getParser();
    float weight = new Float(
            (parser.optionValue("match_threshold") != null) ? parser.optionValue("match_threshold") : "0.0");
    limit_spn_ = new JSpinner(new SpinnerNumberModel(0, 0, 1, weight));
    limit_btn_ = new JButton("Show");
    limit_spn_.setEditor(new JSpinner.NumberEditor(limit_spn_, "0.00"));

    // Set visual and behavioral aspects of the components.
    sync_cbx_.setMnemonic(KeyEvent.VK_Y);
    sync_cbx_.setToolTipText("Check so selected element's match in opposite tree is also selected.");
    limit_spn_.setToolTipText("Set similarity limit at which elements will be automatically matched.");
    limit_btn_.setToolTipText("Highlight elements that will matched for the specified threshold.");

    // Set panel layout and constraints.
    String col_spec = "pref, $rgap, pref, fill:$ugap:grow, pref, $rgap," + "pref, $ugap, pref";
    String row_spec = "pref, $rgap, pref, $rgap, pref";
    FormLayout layout = new FormLayout(col_spec, row_spec);

    // Initialize builder of the panel with the layout and a border.
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.EMPTY_BORDER);

    // Add components to the panel.
    CellConstraints cc = new CellConstraints();
    builder.add(separator, cc.rcw(1, 1, 9));
    builder.add(strategy_pnl_, cc.rcw(3, 1, 9));
    builder.add(sync_cbx_, cc.rc(5, 1));
    builder.addLabel("S&ynchronize tree node selections", cc.rc(5, 3));
    builder.add(limit_spn_, cc.rc(5, 5));
    builder.addLabel("Matching similarity threshold", cc.rc(5, 7));
    builder.add(limit_btn_, cc.rc(5, 9));

    return builder.getPanel();
}

From source file:ca.dsrg.mirador.ui.MatchPanel.java

/**                                                                     DOCDO: Provide method overview.
 *
 *///from www.  ja v a 2  s. co m
private JPanel assembleViewPanel() {
    // Instantiate the components.
    JComponent separator = DefaultComponentFactory.getInstance().createSeparator("Alter Model Element Matches",
            SwingConstants.CENTER);

    JPanel control_pnl = assembleControlPanel();

    view_lf_tree_ = new JTree();
    view_lf_scl_ = new JScrollPane(view_lf_tree_);
    view_lf_tbl_ = new JTable();
    table_lf_scl_ = new JScrollPane(view_lf_tbl_);
    view_lf_spl_ = new JSplitPane(JSplitPane.VERTICAL_SPLIT, view_lf_scl_, table_lf_scl_);

    view_rt_tree_ = new JTree();
    view_rt_scl_ = new JScrollPane(view_rt_tree_);
    view_rt_tbl_ = new JTable();
    table_rt_scl_ = new JScrollPane(view_rt_tbl_);
    view_rt_spl_ = new JSplitPane(JSplitPane.VERTICAL_SPLIT, view_rt_scl_, table_rt_scl_);

    // Set visual and behavioral aspects of the components.
    DefaultTreeSelectionModel mode = new DefaultTreeSelectionModel();
    mode.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    view_lf_tree_.setSelectionModel(mode);
    view_lf_tree_.setToolTipText("Select an element to highlight its match"
            + "in the right tree, and show its details the table below.");

    mode = new DefaultTreeSelectionModel();
    mode.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    view_rt_tree_.setSelectionModel(mode);
    view_rt_tree_.setToolTipText("Select an element to highlight its match"
            + "in the left tree, and show its details the table below.");

    ToolTipManager.sharedInstance().registerComponent(view_lf_tree_);
    ToolTipManager.sharedInstance().registerComponent(view_rt_tree_);

    view_lf_tbl_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    view_lf_tbl_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    view_lf_tbl_.setRowSelectionAllowed(true);
    view_lf_tbl_.setToolTipText("Select a candidate to highlight its" + " potential match in the right tree.");

    view_rt_tbl_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    view_rt_tbl_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    view_rt_tbl_.setRowSelectionAllowed(true);
    view_rt_tbl_.setToolTipText("Select a candidate to highlight its" + " potential match in the left tree.");

    view_lf_spl_.setPreferredSize(view_lf_spl_.getMaximumSize());
    view_lf_spl_.setOneTouchExpandable(true);
    view_lf_spl_.setResizeWeight(0.7);

    view_rt_spl_.setPreferredSize(view_rt_spl_.getMaximumSize());
    view_rt_spl_.setOneTouchExpandable(true);
    view_rt_spl_.setResizeWeight(0.7);

    // Set panel layout and constraints.
    String col_spec = "center:160dlu:grow, pref, center:160dlu:grow";
    String row_spec = "pref, $rgap, pref, $rgap, fill:MIN(180dlu;pref):grow";
    FormLayout layout = new FormLayout(col_spec, row_spec);

    // Initialize builder of the panel with the layout and a border.
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.EMPTY_BORDER);

    // Add components to the panel.
    CellConstraints cc = new CellConstraints();
    builder.add(separator, cc.rcw(1, 1, 3));
    builder.addLabel("Left model elements", cc.rc(3, 1));
    builder.add(view_lf_spl_, cc.rc(5, 1));
    builder.add(control_pnl, cc.rc(5, 2));
    builder.addLabel("Right model elements", cc.rc(3, 3));
    builder.add(view_rt_spl_, cc.rc(5, 3));

    return builder.getPanel();
}