Search in sources :

Example 76 with Dimension

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

the class ControlPanel method createContents.

@AfterInjection
private void createContents() {
    setMinimumSize(new Dimension(390, 400));
    setPreferredSize(new Dimension(390, 600));
    JButton helpButton = SwingUtil.createOnlineHelpButton(EnrichmentMapBuildProperties.USER_MANUAL_URL, "Online Manual...", serviceRegistrar);
    makeSmall(getAboutButton(), getClosePanelButton());
    final GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    layout.setAutoCreateContainerGaps(LookAndFeelUtil.isWinLAF());
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    layout.setHorizontalGroup(layout.createParallelGroup(CENTER, true).addGroup(layout.createSequentialGroup().addComponent(getEmViewCombo(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addPreferredGap(ComponentPlacement.RELATED).addComponent(getCreateEmButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addComponent(getOptionsButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)).addComponent(getCtrlPanelsContainer(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addComponent(helpButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getAboutButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGap(0, 0, Short.MAX_VALUE).addComponent(getClosePanelButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(CENTER, false).addComponent(getEmViewCombo(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getCreateEmButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getOptionsButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)).addComponent(getCtrlPanelsContainer(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createParallelGroup(CENTER, false).addComponent(helpButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getAboutButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getClosePanelButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)));
    if (LookAndFeelUtil.isAquaLAF())
        setOpaque(false);
}
Also used : JButton(javax.swing.JButton) GroupLayout(javax.swing.GroupLayout) Dimension(java.awt.Dimension) AfterInjection(org.baderlab.csplugins.enrichmentmap.AfterInjection)

Example 77 with Dimension

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

the class ControlPanel method styleHeaderButton.

private void styleHeaderButton(final AbstractButton btn, final Font font) {
    btn.setFont(font);
    btn.setBorder(null);
    btn.setContentAreaFilled(false);
    btn.setBorderPainted(false);
    int h = getEmViewCombo().getPreferredSize().height;
    btn.setMinimumSize(new Dimension(h, h));
    btn.setPreferredSize(new Dimension(h, h));
}
Also used : Dimension(java.awt.Dimension)

Example 78 with Dimension

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

the class CardDialog method createComponents.

private void createComponents() {
    dialog.setLayout(new BorderLayout());
    dialog.setPreferredSize(params.getPreferredSize());
    Dimension minimumSize = params.getMinimumSize();
    if (minimumSize != null) {
        dialog.setMinimumSize(minimumSize);
    }
    dialog.setTitle(params.getTitle());
    // Create message and button panel first because the controller can call callbacks from inside createBodyPanel()
    JPanel buttonPanel = createButtonPanel();
    JPanel bodyPanel = createBodyPanel();
    Border padding = BorderFactory.createEmptyBorder(5, 5, 5, 5);
    Border separator = BorderFactory.createMatteBorder(1, 0, 0, 0, UIManager.getColor("Separator.foreground"));
    Border border = BorderFactory.createCompoundBorder(separator, padding);
    buttonPanel.setBorder(border);
    dialog.add(bodyPanel, BorderLayout.CENTER);
    dialog.add(buttonPanel, BorderLayout.SOUTH);
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) Dimension(java.awt.Dimension) Border(javax.swing.border.Border)

Example 79 with Dimension

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

the class SliderBarPanel method getTextField.

public JFormattedTextField getTextField() {
    if (textField == null) {
        textField = new JFormattedTextField(format) {

            @Override
            public Dimension getPreferredSize() {
                final Dimension d = super.getPreferredSize();
                if (this.getGraphics() != null) {
                    // Set the preferred text field size after it gets a Graphics
                    int sw = 16 + this.getGraphics().getFontMetrics().stringWidth(format.format(max));
                    d.width = Math.max(sw, 48);
                }
                return d;
            }
        };
        textField.setHorizontalAlignment(JTextField.RIGHT);
        textField.addActionListener(evt -> {
            textFieldValueChanged();
        });
        textField.addFocusListener(new FocusAdapter() {

            @Override
            public void focusLost(FocusEvent e) {
                textFieldValueChanged();
            }
        });
    }
    return textField;
}
Also used : FocusAdapter(java.awt.event.FocusAdapter) JFormattedTextField(javax.swing.JFormattedTextField) Dimension(java.awt.Dimension) FocusEvent(java.awt.event.FocusEvent)

Example 80 with Dimension

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

the class SwingUtil method createOnlineHelpButton.

public static JButton createOnlineHelpButton(String url, String toolTipText, CyServiceRegistrar serviceRegistrar) {
    JButton btn = new JButton();
    btn.setToolTipText(toolTipText);
    btn.addActionListener((ActionEvent evt) -> {
        serviceRegistrar.getService(OpenBrowser.class).openURL(url);
    });
    if (LookAndFeelUtil.isAquaLAF()) {
        btn.putClientProperty("JButton.buttonType", "help");
    } else {
        btn.setFont(serviceRegistrar.getService(IconManager.class).getIconFont(22.0f));
        btn.setText(IconManager.ICON_QUESTION_CIRCLE);
        btn.setBorderPainted(false);
        btn.setContentAreaFilled(false);
        btn.setFocusPainted(false);
        btn.setBorder(BorderFactory.createEmptyBorder());
        btn.setMinimumSize(new Dimension(22, 22));
    }
    return btn;
}
Also used : OpenBrowser(org.cytoscape.util.swing.OpenBrowser) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) 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