Package javax.swing

Examples of javax.swing.JRootPane$AccessibleJRootPane


            public void actionPerformed(ActionEvent actionEvent) {
                setVisible(false);
            }
        };
       
        JRootPane rootPane = new JRootPane();
        KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
        rootPane.registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
        return rootPane;
  }
View Full Code Here


   */
  @Override
  public void setVisible(boolean visible) {
    boolean oldVisible = isVisible();
    super.setVisible(visible);
    JRootPane rootPane = SwingUtilities.getRootPane(this);
    if ((rootPane != null) && (isVisible() != oldVisible)) {
      if (isVisible()) {
        Component focusOwner = KeyboardFocusManager.
            getCurrentKeyboardFocusManager().getPermanentFocusOwner();
        if ((focusOwner != null) &&
            SwingUtilities.isDescendingFrom(focusOwner, rootPane)) {
          recentFocusOwner = focusOwner;
        }
        rootPane.getLayeredPane().setVisible(false);
        requestFocusInWindow();
      } else {
        rootPane.getLayeredPane().setVisible(true);
        if (recentFocusOwner != null) {
          recentFocusOwner.requestFocusInWindow();
        }
        recentFocusOwner = null;
      }
View Full Code Here

    int width = getWidth();
    int height = getHeight();

    // Draw layered pane below glass pane
    JRootPane rootPane = SwingUtilities.getRootPane(this);
    if (rootPane != null) {
      // It is important to call print() instead of paint() here
      // because print() doesn't affect the frame's double buffer
      rootPane.getLayeredPane().print(g);
    }
    // Draw background
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHints(hints);
    g2.setColor(background);
View Full Code Here

    super(parentFrame);
  }

  @Override
  protected JRootPane createRootPane() {
    JRootPane superRootPane = super.createRootPane();

    superRootPane.registerKeyboardAction(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent ev) {
        setVisible(false);
        dispose();
      }
View Full Code Here

                .addComponent(controlFilePanel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
                .addPreferredGap(RELATED)
                .addComponent(buttonPanel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
                .addContainerGap(DEFAULT_SIZE, Short.MAX_VALUE))
        );
        final JRootPane rootPane = getRootPane();
    /* On escape keystroke, it closes the dialog */
        rootPane.registerKeyboardAction(closeDialogActionListener, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
        /* Makes the Generate button the default button */
        rootPane.setDefaultButton(generateButton);
       
        pack();
  }
View Full Code Here

            JInternalFrame iframe = (JInternalFrame) c;

            mb     = iframe.getJMenuBar();
            cArray = iframe.getContentPane().getComponents();
        } else if (c instanceof JRootPane) {
            JRootPane root = (JRootPane) c;

            mb     = root.getJMenuBar();
            cArray = root.getContentPane().getComponents();
        }

        int topToolBarHeight    = 0;
        int bottomToolBarHeight = 0;
View Full Code Here

        if (propertyName == null) {
            return;
        }

        if (propertyName.equals("windowDecorationStyle")) {
            JRootPane root  = (JRootPane) e.getSource();
            int       style = root.getWindowDecorationStyle();

            // This is potentially more than needs to be done,
            // but it rarely happens and makes the install/uninstall process
            // simpler. AqvavitTitlePane also assumes it will be recreated if
            // the decoration style changes.
            uninstallClientDecorations(root);
            Container parent = root.getParent();

            if (parent != null && (parent instanceof JFrame || parent instanceof JDialog) && style != JRootPane.NONE) {
                installClientDecorations(root);
            }
        } else if (propertyName.equals("ancestor")) {
            uninstallWindowListeners(root);
            installWindowListeners(root, root.getParent());
        } else if (propertyName.equals(UNIFIED_TOOLBAR_LOOK)) {
            updateTextured();
        }
    }
View Full Code Here

            int       mbWidth  = 0;
            int       mbHeight = 0;
            int       tpWidth  = 0;
            int       tpHeight = 0;
            Insets    i        = parent.getInsets();
            JRootPane root     = (JRootPane) parent;

            if (root.getContentPane() != null) {
                cpd = root.getContentPane().getPreferredSize();
            } else {
                cpd = root.getSize();
            }

            if (cpd != null) {
                cpWidth  = cpd.width;
                cpHeight = cpd.height;
            }

            if (root.getJMenuBar() != null) {
                mbd = root.getJMenuBar().getPreferredSize();
                if (mbd != null) {
                    mbWidth  = mbd.width;
                    mbHeight = mbd.height;
                }
            }

            if (root.getWindowDecorationStyle() != JRootPane.NONE && (root.getUI() instanceof SeaGlassRootPaneUI)) {
                JComponent titlePane = ((SeaGlassRootPaneUI) root.getUI()).getTitlePane();

                if (titlePane != null) {
                    tpd = titlePane.getPreferredSize();
                    if (tpd != null) {
                        tpWidth  = tpd.width;
View Full Code Here

            int       mbWidth  = 0;
            int       mbHeight = 0;
            int       tpWidth  = 0;
            int       tpHeight = 0;
            Insets    i        = parent.getInsets();
            JRootPane root     = (JRootPane) parent;

            if (root.getContentPane() != null) {
                cpd = root.getContentPane().getMinimumSize();
            } else {
                cpd = root.getSize();
            }

            if (cpd != null) {
                cpWidth  = cpd.width;
                cpHeight = cpd.height;
            }

            if (root.getJMenuBar() != null) {
                mbd = root.getJMenuBar().getMinimumSize();
                if (mbd != null) {
                    mbWidth  = mbd.width;
                    mbHeight = mbd.height;
                }
            }

            if (root.getWindowDecorationStyle() != JRootPane.NONE && (root.getUI() instanceof SeaGlassRootPaneUI)) {
                JComponent titlePane = ((SeaGlassRootPaneUI) root.getUI()).getTitlePane();

                if (titlePane != null) {
                    tpd = titlePane.getMinimumSize();
                    if (tpd != null) {
                        tpWidth  = tpd.width;
View Full Code Here

         *
         * @param parent the Container for which this layout manager is being
         *               used
         */
        public void layoutContainer(Container parent) {
            JRootPane root  = (JRootPane) parent;
            Rectangle b     = root.getBounds();
            Insets    i     = root.getInsets();
            int       nextY = 0;
            int       w     = b.width - i.right - i.left;
            int       h     = b.height - i.top - i.bottom;

            if (root.getLayeredPane() != null) {
                root.getLayeredPane().setBounds(i.left, i.top, w, h);
            }

            if (root.getGlassPane() != null) {
                root.getGlassPane().setBounds(i.left, i.top, w, h);
            }
            // Note: This is laying out the children in the layeredPane,
            // technically, these are not our children.
            if (root.getWindowDecorationStyle() != JRootPane.NONE && (root.getUI() instanceof SeaGlassRootPaneUI)) {
                JComponent titlePane = ((SeaGlassRootPaneUI) root.getUI()).getTitlePane();

                if (titlePane != null) {
                    Dimension tpd = titlePane.getPreferredSize();

                    if (tpd != null) {
                        int tpHeight = tpd.height;

                        titlePane.setBounds(0, 0, w, tpHeight);
                        nextY += tpHeight;
                    }
                }
            }

            if (root.getJMenuBar() != null) {
                boolean   menuInTitle = (root.getClientProperty("JRootPane.MenuInTitle") == Boolean.TRUE);
                Dimension mbd         = root.getJMenuBar().getPreferredSize();
                int x = menuInTitle? 20 : 0;
                root.getJMenuBar().setBounds(x, menuInTitle ? 0 : nextY, w, mbd.height);
                root.getJMenuBar().setOpaque(false);
                root.getJMenuBar().setBackground(transparentColor);
                if (!menuInTitle) {
                    nextY += mbd.height;
                }
            }

            if (root.getContentPane() != null) {
                /* Dimension cpd = */ root.getContentPane().getPreferredSize();
                root.getContentPane().setBounds(0, nextY, w, h < nextY ? 0 : h - nextY);
            }
        }
View Full Code Here

TOP

Related Classes of javax.swing.JRootPane$AccessibleJRootPane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.