Search in sources :

Example 31 with JRootPane

use of javax.swing.JRootPane in project blue by kunstmusik.

the class TableHilightDropListener method dragEnter.

@Override
public void dragEnter(DropTargetDragEvent dtde) {
    JTable table = (JTable) dtde.getDropTargetContext().getComponent();
    Point location = dtde.getLocation();
    JRootPane rootPane = table.getRootPane();
    oldGlassPane = rootPane.getGlassPane();
    rootPane.setGlassPane(glassPane);
    glassPane.setOpaque(false);
    glassPane.setVisible(true);
    updateLine(table, location);
}
Also used : JTable(javax.swing.JTable) JRootPane(javax.swing.JRootPane) Point(java.awt.Point)

Example 32 with JRootPane

use of javax.swing.JRootPane in project blue by kunstmusik.

the class TableHilightDropListener method resetGlassPane.

private void resetGlassPane(DropTargetEvent dte) {
    JTable table = (JTable) dte.getDropTargetContext().getComponent();
    JRootPane rootPane = table.getRootPane();
    rootPane.setGlassPane(oldGlassPane);
    oldGlassPane.setVisible(false);
    rootPane.repaint();
}
Also used : JTable(javax.swing.JTable) JRootPane(javax.swing.JRootPane)

Example 33 with JRootPane

use of javax.swing.JRootPane in project gephi by gephi.

the class TopDialog method updateOptions.

public void updateOptions() {
    Set<Object> addedOptions = new HashSet<>(5);
    Object[] options = nd.getOptions();
    if (options == null) {
        switch(nd.getOptionType()) {
            case NotifyDescriptor.DEFAULT_OPTION:
            case NotifyDescriptor.OK_CANCEL_OPTION:
                options = new Object[] { NotifyDescriptor.OK_OPTION, NotifyDescriptor.CANCEL_OPTION };
                break;
            case NotifyDescriptor.YES_NO_OPTION:
                options = new Object[] { NotifyDescriptor.YES_OPTION, NotifyDescriptor.NO_OPTION };
                break;
            case NotifyDescriptor.YES_NO_CANCEL_OPTION:
                options = new Object[] { NotifyDescriptor.YES_OPTION, NotifyDescriptor.NO_OPTION, NotifyDescriptor.CANCEL_OPTION };
                break;
            default:
                throw new IllegalArgumentException();
        }
    }
    // System.err.println("prep: " + Arrays.asList(options) + " " + Arrays.asList(closingOptions) + " " + buttonListener);
    buttonPanel.removeAll();
    JRootPane rp = getRootPane();
    for (int i = 0; i < options.length; i++) {
        addedOptions.add(options[i]);
        buttonPanel.add(option2Button(options[i], nd, makeListener(options[i]), rp));
    }
    options = nd.getAdditionalOptions();
    if (options != null) {
        for (int i = 0; i < options.length; i++) {
            addedOptions.add(options[i]);
            buttonPanel.add(option2Button(options[i], nd, makeListener(options[i]), rp));
        }
    }
    if (closingOptions != null) {
        for (int i = 0; i < closingOptions.length; i++) {
            if (addedOptions.add(closingOptions[i])) {
                ActionListener l = makeListener(closingOptions[i]);
                attachActionListener(closingOptions[i], l);
            }
        }
    }
}
Also used : ActionListener(java.awt.event.ActionListener) JRootPane(javax.swing.JRootPane) HashSet(java.util.HashSet)

Example 34 with JRootPane

use of javax.swing.JRootPane in project gephi by gephi.

the class BannerRootPanelLayout method preferredLayoutSize.

@Override
public Dimension preferredLayoutSize(Container parent) {
    int contentWidth = 0;
    int menuWidth = 0;
    int height = 0;
    JRootPane rootPane = (JRootPane) parent;
    // hideMenu(rootPane);
    Insets insets = parent.getInsets();
    height += insets.top + insets.bottom;
    Dimension contentSize;
    if (rootPane.getContentPane() != null) {
        contentSize = rootPane.getContentPane().getPreferredSize();
    } else {
        contentSize = rootPane.getSize();
    }
    contentWidth = contentSize.width;
    height += contentSize.height;
    if (rootPane.getJMenuBar() != null && rootPane.getJMenuBar().isVisible()) {
        Dimension menuSize = rootPane.getJMenuBar().getPreferredSize();
        height += menuSize.height;
        menuWidth = menuSize.width;
    }
    return new Dimension(Math.max(contentWidth, menuWidth) + insets.left + insets.right, height);
}
Also used : Insets(java.awt.Insets) JRootPane(javax.swing.JRootPane) Dimension(java.awt.Dimension)

Example 35 with JRootPane

use of javax.swing.JRootPane in project gephi by gephi.

the class BannerRootPanelLayout method layoutContainer.

@Override
public void layoutContainer(Container parent) {
    JRootPane rootPane = (JRootPane) parent;
    // hideMenu(rootPane);
    Rectangle bounds = rootPane.getBounds();
    Insets insets = rootPane.getInsets();
    int y = insets.top;
    int x = insets.left;
    int w = bounds.width - insets.right - insets.left;
    int h = bounds.height - insets.top - insets.bottom;
    if (rootPane.getLayeredPane() != null) {
        rootPane.getLayeredPane().setBounds(x, y, w, h);
    }
    if (rootPane.getGlassPane() != null) {
        rootPane.getGlassPane().setBounds(x, y, w, h);
    }
    if (rootPane.getJMenuBar() != null && rootPane.getJMenuBar().isVisible()) {
        JMenuBar menu = rootPane.getJMenuBar();
        Dimension size = menu.getPreferredSize();
        menu.setBounds(x, y, w, size.height);
        y += size.height;
    }
    if (_toolbar != null) {
        Dimension size = _toolbar.getPreferredSize();
        _toolbar.setBounds(x, y, w, size.height);
        y += size.height;
    }
    if (rootPane.getContentPane() != null) {
        int height = h - y;
        if (height < 0) {
            height = 0;
        }
        rootPane.getContentPane().setBounds(x, y, w, height);
    }
}
Also used : Insets(java.awt.Insets) Rectangle(java.awt.Rectangle) JRootPane(javax.swing.JRootPane) Dimension(java.awt.Dimension) JMenuBar(javax.swing.JMenuBar)

Aggregations

JRootPane (javax.swing.JRootPane)90 ActionEvent (java.awt.event.ActionEvent)48 KeyStroke (javax.swing.KeyStroke)35 AbstractAction (javax.swing.AbstractAction)32 Action (javax.swing.Action)29 InputMap (javax.swing.InputMap)26 JPanel (javax.swing.JPanel)16 BorderLayout (java.awt.BorderLayout)14 JButton (javax.swing.JButton)13 ActionListener (java.awt.event.ActionListener)12 JLabel (javax.swing.JLabel)12 Container (java.awt.Container)10 FlowLayout (java.awt.FlowLayout)10 Dimension (java.awt.Dimension)9 Insets (java.awt.Insets)9 BoxLayout (javax.swing.BoxLayout)9 Component (java.awt.Component)8 Frame (java.awt.Frame)7 JScrollPane (javax.swing.JScrollPane)7 GridBagConstraints (java.awt.GridBagConstraints)6