These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 JRootPane class.
true, new JScrollPane(), glCanvas1); verticalSplitPane.setResizeWeight(0.5); final JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, new JScrollPane(), verticalSplitPane); horizontalSplitPane.setResizeWeight(0.5); final JRootPane intermediateRootPane = new JRootPane(); intermediateRootPane.setContentPane(horizontalSplitPane); intermediateRootPane.setSize(640, 480); this.add(intermediateRootPane); System.err.println("GearsApplet: init() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); } String currentThreadName() { return Thread.currentThread().getName(); } @Override public void start() { System.err.println("GearsApplet: start() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); animator.start();
protected JRootPane createRootPane() { KeyStroke escapeStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); KeyStroke enterStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0); JRootPane rootPane = new JRootPane(); rootPane.registerKeyboardAction(this, escapeStroke, JComponent.WHEN_IN_FOCUSED_WINDOW); rootPane.registerKeyboardAction(this, enterStroke, JComponent.WHEN_IN_FOCUSED_WINDOW); return rootPane; } public Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Insets scnMax = Toolkit.getDefaultToolkit().getScreenInsets(frame.getGraphicsConfiguration()); int taskBarSize = scnMax.bottom; int usableScreenHeight = screenSize.height - taskBarSize - 50;
@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); }
true, new JScrollPane(), glCanvas1); verticalSplitPane.setResizeWeight(0.5); final JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, new JScrollPane(), verticalSplitPane); horizontalSplitPane.setResizeWeight(0.5); final JRootPane intermediateRootPane = new JRootPane(); intermediateRootPane.setContentPane(horizontalSplitPane); add(intermediateRootPane, BorderLayout.CENTER); System.err.println("GearsApplet: init() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); } String currentThreadName() { return Thread.currentThread().getName(); } @Override public void start() { System.err.println("GearsApplet: start() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); animator.start(); animator.setUpdateFPSFrames(60, System.err);
public EscapeDialog(final Frame owner) { super(owner, true); } protected JRootPane createRootPane() { final JRootPane rootPane = new JRootPane(); final KeyStroke stroke = KeyStroke.getKeyStroke("ESCAPE"); final Action actionListener = new AbstractAction() { public void actionPerformed(final ActionEvent actionEvent) { setVisible(false); } }; final InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMap.put(stroke, "ESCAPE"); rootPane.getActionMap().put("ESCAPE", actionListener);
* @param rootPane */ public static void makeWindowLeopardStyle(JRootPane rootPane) { // TODO figure out correct way to determine if the JRootPane has been // TODO realized. if (rootPane.isValid()) { throw new IllegalArgumentException("This method only works if the" + "given JRootPane has not yet been realized."); } rootPane.putClientProperty("apple.awt.brushMetalLook", Boolean.TRUE); } /** * {@code true} if the Unified Tool Bar, Preference Tool Bar or Bottom Bar backgrounds should * be manually painted in code, rather than letting Mac OS X do the painting. This will always * return true on platforms other than Mac, and will sometimes return true on Mac's due to * painting bugs in the Java distrobution. */ public static boolean shouldManuallyPaintTexturedWindowBackground() {
this.mouseListener = new DelayedMouseListener(new GlassPaneNodeSelector(nodeSelector), 2, 1); this.rootPane = jframe; } public void ancestorRemoved(AncestorEvent event) { rootPane.getJMenuBar().setEnabled(true); final Component glassPane = rootPane.getRootPane().getGlassPane(); glassPane.removeMouseListener(mouseListener); glassPane.removeMouseMotionListener(mouseListener); glassPane.setVisible(false); SwingUtilities.getWindowAncestor(rootPane).setFocusableWindowState(true); } public void ancestorMoved(AncestorEvent event) { } public void ancestorAdded(AncestorEvent event) { rootPane.getJMenuBar().setEnabled(false); final Component glassPane = rootPane.getRootPane().getGlassPane(); glassPane.addMouseListener(mouseListener);
public void actionPerformed(ActionEvent event) { dialog.dispatchEvent(new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING)); } }; JRootPane root = dialog.getRootPane(); root.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escapeStroke, dispatchWindowClosingActionMapKey); root.getActionMap().put(dispatchWindowClosingActionMapKey, dispatchClosing); } }
this.mouseListener = new DelayedMouseListener(new GlassPaneNodeSelector(nodeSelector), 2, 1); this.rootPane = jframe; } public void ancestorRemoved(AncestorEvent event) { rootPane.getJMenuBar().setEnabled(true); final Component glassPane = rootPane.getRootPane().getGlassPane(); glassPane.removeMouseListener(mouseListener); glassPane.removeMouseMotionListener(mouseListener); glassPane.setVisible(false); SwingUtilities.getWindowAncestor(rootPane).setFocusableWindowState(true); } public void ancestorMoved(AncestorEvent event) { } public void ancestorAdded(AncestorEvent event) { rootPane.getJMenuBar().setEnabled(false); final Component glassPane = rootPane.getRootPane().getGlassPane(); glassPane.addMouseListener(mouseListener);
public void actionPerformed(ActionEvent actionEvent) { dispose(); // setVisible(false); } }; JRootPane rootPane = new JRootPane(); KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); rootPane.registerKeyboardAction(escapeActionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW); return rootPane; } }