Search in sources :

Example 71 with Dimension

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

the class LegendPanelMediator method init.

@AfterInjection
@SuppressWarnings("serial")
private void init() {
    invokeOnEDTAndWait(() -> {
        dialog = new JDialog(swingApplication.getJFrame(), "EnrichmentMap Legend", ModalityType.MODELESS);
        dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        dialog.setMinimumSize(new Dimension(440, 380));
        JButton closeButton = new JButton(new AbstractAction("Close") {

            @Override
            public void actionPerformed(ActionEvent e) {
                dialog.dispose();
            }
        });
        creationParamsButton.addActionListener(e -> showCreationParamsDialog());
        JPanel bottomPanel = LookAndFeelUtil.createOkCancelPanel(null, closeButton, creationParamsButton);
        dialog.getContentPane().add(legendPanelProvider.get(), BorderLayout.CENTER);
        dialog.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
        LookAndFeelUtil.setDefaultOkCancelKeyStrokes(dialog.getRootPane(), null, closeButton.getAction());
        dialog.getRootPane().setDefaultButton(closeButton);
        dialog.setLocationRelativeTo(swingApplication.getJFrame());
    });
}
Also used : JPanel(javax.swing.JPanel) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) AbstractAction(javax.swing.AbstractAction) JDialog(javax.swing.JDialog) AfterInjection(org.baderlab.csplugins.enrichmentmap.AfterInjection)

Example 72 with Dimension

use of java.awt.Dimension 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 73 with Dimension

use of java.awt.Dimension 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 74 with Dimension

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

the class PostAnalysisInputPanel method getUserInputScrollPane.

JScrollPane getUserInputScrollPane() {
    if (userInputScrollPane == null) {
        // Default panel
        userInputScrollPane = new JScrollPane(getKnownSignaturePanel());
        int w = Math.max(getKnownSignaturePanel().getPreferredSize().width, getSignatureDiscoveryPanel().getPreferredSize().width);
        userInputScrollPane.setPreferredSize(new Dimension(w + 40, userInputScrollPane.getPreferredSize().height));
    }
    return userInputScrollPane;
}
Also used : JScrollPane(javax.swing.JScrollPane) Dimension(java.awt.Dimension)

Example 75 with Dimension

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

the class JRangeSlider method toScreen.

/**
	 * Converts from a range value to screen coordinates.
	 */
protected int toScreen(int xOrY) {
    Dimension sz = getSize();
    int min = getMinimum();
    double scale;
    if (orientation == VERTICAL) {
        scale = (sz.height - (2 * ARROW_SZ)) / (double) (getMaximum() - min);
    } else {
        scale = (sz.width - (2 * ARROW_SZ)) / (double) (getMaximum() - min);
    }
    // Otherwise, we have to invert the number by subtracting the value from the height
    if (direction == LEFTRIGHT_TOPBOTTOM) {
        return (int) (ARROW_SZ + ((xOrY - min) * scale) + 0.5);
    } else {
        if (orientation == VERTICAL) {
            return (int) (sz.height - ((xOrY - min) * scale) - ARROW_SZ + 0.5);
        } else {
            return (int) (sz.width - ((xOrY - min) * scale) - ARROW_SZ + 0.5);
        }
    }
}
Also used : Dimension(java.awt.Dimension)

Aggregations

Dimension (java.awt.Dimension)4003 JPanel (javax.swing.JPanel)1091 JLabel (javax.swing.JLabel)742 Point (java.awt.Point)683 JButton (javax.swing.JButton)671 ActionEvent (java.awt.event.ActionEvent)644 ActionListener (java.awt.event.ActionListener)583 JScrollPane (javax.swing.JScrollPane)558 BorderLayout (java.awt.BorderLayout)492 Insets (java.awt.Insets)411 BoxLayout (javax.swing.BoxLayout)334 GridBagLayout (java.awt.GridBagLayout)312 GridBagConstraints (java.awt.GridBagConstraints)266 FlowLayout (java.awt.FlowLayout)242 JTextField (javax.swing.JTextField)235 ImageIcon (javax.swing.ImageIcon)216 Component (java.awt.Component)215 Color (java.awt.Color)205 ChangeEvent (javax.swing.event.ChangeEvent)200 ChangeListener (javax.swing.event.ChangeListener)198