Search in sources :

Example 81 with GridBagLayout

use of java.awt.GridBagLayout in project ACS by ACS-Community.

the class ExpertPrefsDlg method initGUI.

/**
	 * Builds the GUI
	 *
	 */
private void initGUI() {
    JRootPane mainPnl = this.getRootPane();
    mainPnl.setLayout(new BorderLayout());
    /////////////////////////////////////////////////////////////
    // Add the table constraints (max num of logs and time frame)
    ///////////////////////////////////////////////////////////
    JPanel tablePnl = new JPanel();
    tablePnl.setBorder(BorderFactory.createTitledBorder("Table constraints"));
    tablePnl.setLayout(new GridBagLayout());
    GridBagConstraints constr = new GridBagConstraints();
    // Num of logs
    constr.gridx = 0;
    constr.gridy = 0;
    constr.fill = GridBagConstraints.HORIZONTAL;
    constr.anchor = GridBagConstraints.WEST;
    constr.insets = new Insets(5, 5, 5, 5);
    tablePnl.add(OptionWidgets.MAX_NUM_OF_LOGS.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 0;
    constr.anchor = GridBagConstraints.LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    constr.fill = GridBagConstraints.HORIZONTAL;
    tablePnl.add(maxLogsInTableCB, constr);
    // Time frame
    constr.gridx = 0;
    constr.gridy = 1;
    constr.anchor = GridBagConstraints.WEST;
    constr.insets = new Insets(5, 5, 5, 5);
    tablePnl.add(OptionWidgets.TIME_FRAME.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 1;
    constr.anchor = GridBagConstraints.LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    tablePnl.add(timeFrameCB, constr);
    /// DISABLED
    timeFrameCB.setEnabled(false);
    // DISABLED
    OptionWidgets.TIME_FRAME.enableCB.setEnabled(false);
    ///////////////////////////////////////////////////////////
    // Add engine constraints
    ///////////////////////////////////////////////////////////
    JPanel enginePnl = new JPanel();
    enginePnl.setBorder(BorderFactory.createTitledBorder("Engine constraints"));
    enginePnl.setLayout(new GridBagLayout());
    // INPUT RATE
    constr.gridx = 0;
    constr.gridy = 0;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(OptionWidgets.MAX_INPUT_RATE.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 0;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(inputRateTF, constr);
    // Output RATE
    constr.gridx = 0;
    constr.gridy = 1;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(OptionWidgets.MAX_OUTPUT_RATE.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 1;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(outputRateTF, constr);
    // DYNAMIC DISCARD LEVEL
    JPanel pnl = new JPanel();
    pnl.setLayout(new GridLayout(3, 2));
    pnl.add(new JLabel("Threshold: "), "1");
    pnl.add(dynThresholdTF, "2");
    pnl.add(new JLabel("Damping: "), "3");
    pnl.add(dynDampingTF, "4");
    pnl.add(new JLabel("Time: "), "5");
    pnl.add(dynIntervalTF, "6");
    constr.gridx = 0;
    constr.gridy = 2;
    constr.fill = GridBagConstraints.VERTICAL;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(OptionWidgets.DYNAMIC_DISCARD_LEVEL.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 2;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(pnl, constr);
    // Add the table and engine panels to the main panel
    mainPnl.add(tablePnl, BorderLayout.CENTER);
    mainPnl.add(enginePnl, BorderLayout.NORTH);
    // Add the OK, CANCEL buttons
    JPanel buttonsPnl = new JPanel(new BorderLayout());
    JPanel okCancelPnl = new JPanel();
    okCancelPnl.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    BoxLayout boxLayout = new BoxLayout(okCancelPnl, BoxLayout.LINE_AXIS);
    okCancelPnl.setLayout(boxLayout);
    okCancelPnl.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
    okBtn = new JButton("Ok");
    okBtn.addActionListener(this);
    cancelBtn = new JButton("Cancel");
    cancelBtn.addActionListener(this);
    okCancelPnl.add(okBtn, BorderLayout.WEST);
    okCancelPnl.add(Box.createRigidArea(new Dimension(10, 0)));
    okCancelPnl.add(cancelBtn, BorderLayout.EAST);
    JPanel restoreBtnPnl = new JPanel(new FlowLayout());
    restoreBtn = new JButton("Restore");
    restoreBtn.addActionListener(this);
    restoreBtnPnl.add(restoreBtn);
    buttonsPnl.add(restoreBtnPnl, BorderLayout.WEST);
    buttonsPnl.add(okCancelPnl, BorderLayout.EAST);
    mainPnl.add(buttonsPnl, BorderLayout.SOUTH);
    pack();
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridLayout(java.awt.GridLayout) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JRootPane(javax.swing.JRootPane) Dimension(java.awt.Dimension)

Example 82 with GridBagLayout

use of java.awt.GridBagLayout in project EnrichmentMapApp by BaderLab.

the class MannWhitneyRanksDialog method createDataSetPanel.

private JPanel createDataSetPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Select ranks to use for each data set."));
    int y = 0;
    List<EMDataSet> dataSets = getDataSets();
    for (EMDataSet dataset : dataSets) {
        final String dataSetName = dataset.getName();
        JLabel label = new JLabel(dataSetName + ":");
        JComboBox<String> combo = new JComboBox<>();
        for (String ranksName : dataset.getExpressionSets().getAllRanksNames()) {
            combo.addItem(ranksName);
        }
        SwingUtil.makeSmall(label, combo);
        if (combo.getItemCount() <= 1) {
            combo.setEnabled(false);
        }
        combo.addActionListener(e -> {
            String ranks = combo.getSelectedItem().toString();
            results.put(dataSetName, ranks);
        });
        results.put(dataSetName, combo.getSelectedItem().toString());
        panel.add(label, GBCFactory.grid(0, y).weightx(.5).anchor(EAST).fill(NONE).get());
        panel.add(combo, GBCFactory.grid(1, y).weightx(.5).get());
        y++;
    }
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagLayout(java.awt.GridBagLayout) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet)

Example 83 with GridBagLayout

use of java.awt.GridBagLayout in project EnrichmentMapApp by BaderLab.

the class EdgeWidthDialog method createSignatureSetPanel.

private JPanel createSignatureSetPanel() {
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Signature Set (Post Analysis)"));
    panel.setLayout(new GridBagLayout());
    GridBagConstraints gbc;
    JLabel pValueLabel = new JLabel("p-value:  ");
    gbc = gridBagConstraints(0, 0);
    gbc.weightx = 1.0;
    panel.add(pValueLabel, gbc);
    JLabel lessThan100 = new JLabel("<= cutoff/100     ");
    gbc = gridBagConstraints(1, 0);
    panel.add(lessThan100, gbc);
    JLabel lessThan10 = new JLabel("<= cutoff/10     ");
    gbc = gridBagConstraints(2, 0);
    panel.add(lessThan10, gbc);
    JLabel greaterThan = new JLabel("> cutoff/10     ");
    gbc = gridBagConstraints(3, 0);
    panel.add(greaterThan, gbc);
    // Width
    JLabel widthLabel = new JLabel("Width:");
    gbc = gridBagConstraints(0, 1);
    panel.add(widthLabel, gbc);
    lessThan100Text = new JFormattedTextField(new DecimalFormat());
    lessThan100Text.setPreferredSize(new Dimension(50, lessThan100Text.getPreferredSize().height));
    lessThan100Text.setHorizontalAlignment(JTextField.RIGHT);
    gbc = gridBagConstraints(1, 1);
    gbc.insets = new Insets(5, 5, 5, 0);
    panel.add(lessThan100Text, gbc);
    lessThan10Text = new JFormattedTextField(new DecimalFormat());
    lessThan10Text.setPreferredSize(new Dimension(50, lessThan10Text.getPreferredSize().height));
    lessThan10Text.setHorizontalAlignment(JTextField.RIGHT);
    gbc = gridBagConstraints(2, 1);
    gbc.insets = new Insets(5, 5, 5, 0);
    panel.add(lessThan10Text, gbc);
    greaterThanText = new JFormattedTextField(new DecimalFormat());
    greaterThanText.setPreferredSize(new Dimension(50, greaterThanText.getPreferredSize().height));
    greaterThanText.setHorizontalAlignment(JTextField.RIGHT);
    gbc = gridBagConstraints(3, 1);
    gbc.insets = new Insets(5, 5, 5, 0);
    panel.add(greaterThanText, gbc);
    makeSmall(pValueLabel, lessThan100, lessThan10, greaterThan, widthLabel, lessThan100Text, lessThan10Text, greaterThanText);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) DecimalFormat(java.text.DecimalFormat) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 84 with GridBagLayout

use of java.awt.GridBagLayout in project EnrichmentMapApp by BaderLab.

the class EdgeWidthDialog method createGenesetOverlapPanel.

private JPanel createGenesetOverlapPanel() {
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Geneset Overlap"));
    panel.setLayout(new GridBagLayout());
    GridBagConstraints gbc;
    // Similarity Coefficient
    JLabel similarityLabel = new JLabel("Similarity Coefficient:    ");
    gbc = gridBagConstraints(0, 0);
    gbc.weightx = 1.0;
    panel.add(similarityLabel, gbc);
    JLabel lowerBound = new JLabel(String.format("%.1f", similarityCutoff));
    lowerBound.setHorizontalAlignment(JLabel.RIGHT);
    gbc = gridBagConstraints(1, 0);
    panel.add(lowerBound, gbc);
    // hardcoded
    JLabel upperBound = new JLabel("1.0");
    upperBound.setHorizontalAlignment(JLabel.RIGHT);
    gbc = gridBagConstraints(2, 0);
    panel.add(upperBound, gbc);
    JLabel spacer = new JLabel("");
    gbc = gridBagConstraints(3, 0);
    panel.add(spacer, gbc);
    // Width
    JLabel widthLabel = new JLabel("Width:");
    gbc = gridBagConstraints(0, 1);
    panel.add(widthLabel, gbc);
    emLowerWidthText = new JFormattedTextField(new DecimalFormat());
    emLowerWidthText.setPreferredSize(new Dimension(50, emLowerWidthText.getPreferredSize().height));
    emLowerWidthText.setHorizontalAlignment(JTextField.RIGHT);
    gbc = gridBagConstraints(1, 1);
    gbc.insets = new Insets(5, 5, 5, 0);
    panel.add(emLowerWidthText, gbc);
    emUpperWidthText = new JFormattedTextField(new DecimalFormat());
    emUpperWidthText.setPreferredSize(new Dimension(50, emUpperWidthText.getPreferredSize().height));
    emUpperWidthText.setHorizontalAlignment(JTextField.RIGHT);
    gbc = gridBagConstraints(2, 1);
    gbc.insets = new Insets(5, 5, 5, 0);
    panel.add(emUpperWidthText, gbc);
    JLabel mappingText = new JLabel("(continuous mapping) ");
    gbc = gridBagConstraints(3, 1);
    panel.add(mappingText, gbc);
    makeSmall(similarityLabel, lowerBound, upperBound, spacer, widthLabel, emLowerWidthText, emUpperWidthText, mappingText);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) DecimalFormat(java.text.DecimalFormat) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 85 with GridBagLayout

use of java.awt.GridBagLayout in project zaproxy by zaproxy.

the class OptionsGlobalExcludeURLPanel method initialize.

/**
	 * This method initializes this
	 */
private void initialize() {
    this.setName(Constant.messages.getString("options.globalexcludeurl.title"));
    this.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.weightx = 1.0;
    gbc.anchor = GridBagConstraints.LINE_START;
    gbc.fill = GridBagConstraints.BOTH;
    this.add(new JLabel(Constant.messages.getString("options.globalexcludeurl.label.tokens")), gbc);
    tokensOptionsPanel = new GlobalExcludeURLMultipleOptionsPanel(getGlobalExcludeURLModel());
    gbc.weighty = 1.0;
    this.add(tokensOptionsPanel, gbc);
//gbc.weighty = 0.0;
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel)

Aggregations

GridBagLayout (java.awt.GridBagLayout)739 GridBagConstraints (java.awt.GridBagConstraints)576 JPanel (javax.swing.JPanel)532 JLabel (javax.swing.JLabel)425 Insets (java.awt.Insets)409 Dimension (java.awt.Dimension)182 JScrollPane (javax.swing.JScrollPane)147 JButton (javax.swing.JButton)143 ActionEvent (java.awt.event.ActionEvent)136 ActionListener (java.awt.event.ActionListener)115 JTextField (javax.swing.JTextField)100 BorderLayout (java.awt.BorderLayout)96 JCheckBox (javax.swing.JCheckBox)79 BoxLayout (javax.swing.BoxLayout)66 ButtonGroup (javax.swing.ButtonGroup)56 TitledBorder (javax.swing.border.TitledBorder)48 JComboBox (javax.swing.JComboBox)46 FlowLayout (java.awt.FlowLayout)42 JRadioButton (javax.swing.JRadioButton)36 Color (java.awt.Color)34