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);
}
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();
}
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);
}
}
}
}
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);
}
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);
}
}
Aggregations