Package javax.swing

Examples of javax.swing.JRootPane$AccessibleJRootPane


          if (initialFocusComponent instanceof JButton) {
            JButton defaultB = (JButton)initialFocusComponent;
            defaultB.addAncestorListener(new AncestorListener() {
              public void ancestorAdded(AncestorEvent e) {
                JButton defaultButton = (JButton)e.getComponent();
                JRootPane root = SwingUtilities.getRootPane(defaultButton);
                if (root != null) {
                  root.setDefaultButton(defaultButton);
                }
              }
              public void ancestorRemoved(AncestorEvent event) {}
              public void ancestorMoved(AncestorEvent event) {}
            });
View Full Code Here


   
    @Override
    protected JRootPane createRootPane()
    {
        final KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
        final JRootPane rootPane = super.createRootPane();
        rootPane.registerKeyboardAction(new ActionListener()
        {
            public void actionPerformed(ActionEvent actionEvent)
            {
                setVisible(false);
            }
View Full Code Here

   
    @Override
    protected JRootPane createRootPane()
    {
        final KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
        final JRootPane rootPane = super.createRootPane();
        rootPane.registerKeyboardAction(new ActionListener()
        {
            public void actionPerformed(ActionEvent actionEvent)
            {
                setVisible(false);
            }
View Full Code Here

             *
             * @deprecated, this code remains only for backward compatability.
             * Only code generated prior to 6/8/07 will use this
             */
            Component grandMa = ((JComponent)parent).getTopLevelAncestor();
            JRootPane root = ((JComponent)parent).getRootPane();
            JLayeredPane layeredPane = getLayeredPane(grandMa);
            Component glassPane = UIutils.getGlassPane(grandMa);
            JMenuBar menuBar = root == null ? null : root.getJMenuBar();
            if (grandMa != null) {
                Insets insets = ((Container)grandMa).getInsets();
                Insets tempInsets = new Insets(0,0,0,0);

                int menuHeight = 0;
                // TF:19/09/2009:Only compensate for the menu bar if it's visible.
                if (menuBar != null && menuBar.isVisible()) {
                    // Compensate for only the height of the menu, the width is derived from the screen.
                    menuHeight = menuBar.getHeight();
                }

                // Layered pane = content pane + menu bar + insets
                if (layeredPane != null) {
                    layeredPane.getInsets(tempInsets);
                    newSize.height += menuHeight + tempInsets.top + tempInsets.bottom;
                    newSize.width += tempInsets.left + tempInsets.right;
                    if (debugEnabled) {
                      _log.debug("\tsetting layered pane size to " + newSize);
                    }
                    if (newSize.height != layeredPane.getHeight()
                            || newSize.width != layeredPane.getWidth()) {
                        layeredPane.setSize(newSize);
                    }
                }
                if (glassPane != null) {
                  if (debugEnabled) {
                    _log.debug("\tsetting glass pane size to " + newSize);
                  }
                    if (newSize.height != glassPane.getHeight()
                            || newSize.width != glassPane.getWidth()) {
                        glassPane.setSize(newSize);
                    }
                }

                if (root != null) {
                    root.getInsets(tempInsets);
                    newSize.height += tempInsets.top + tempInsets.bottom;
                    newSize.width += tempInsets.left + tempInsets.right;
                    if (debugEnabled) {
                      _log.debug("\tsetting root pane size to " + newSize);
                    }
                    if (newSize.height != root.getHeight()
                            || newSize.width != root.getWidth()) {
                        root.setSize(newSize);
                        root.revalidate(); //PM:4/8/07 Added to correct paint issue
                    }
                }

                if (debugEnabled) {
                  _log.debug("\tSetting owning container's size to ("
View Full Code Here

        JLayeredPane layeredPane = this.frame.getLayeredPane();
        Insets layeredPaneInsets = new Insets(0,0,0,0);
        JMenuBar menuBar = this.frame.getJMenuBar();
        int menuHeight = (menuBar == null) ? 0 : menuBar.getHeight()// Compensate for only the height of the menu, the width is derived from the screen.
        Component glassPane = this.frame.getGlassPane();
        JRootPane rootPane = this.frame.getRootPane();
        Insets RootPaneInsets = new Insets(0,0,0,0);

        // Layered pane = content pane + menu bar + insets
        if (layeredPane != null) {
            layeredPane.getInsets(layeredPaneInsets);
            // TF:20/8/07:Tests show that if we include the menu height here that our window comes out too big,
            // by the height of the menu. So setting the layered pane size must cater for this.
            newSize.height += menuHeight + layeredPaneInsets.top + layeredPaneInsets.bottom;
            newSize.width += layeredPaneInsets.left + layeredPaneInsets.right;
            if (_log.isDebugEnabled()) {
              _log.debug("\tsetting layered pane size to " + newSize);
            }
            if (newSize.height != layeredPane.getHeight()
                    || newSize.width != layeredPane.getWidth()) {
                layeredPane.setSize(newSize);
                layeredPane.revalidate();
                layeredPane.repaint();
            }
        }
        // size the glass pane
        if (glassPane != null) {
            if (_log.isDebugEnabled()) {
              _log.debug("\tsetting glass pane size to " + newSize);
            }
            if (newSize.height != glassPane.getHeight()
                    || newSize.width != glassPane.getWidth()) {
                glassPane.setSize(newSize);
            }
        }

        //size the root pane
        if (rootPane != null) {
            rootPane.getInsets(RootPaneInsets);
            newSize.height += RootPaneInsets.top + RootPaneInsets.bottom;
            newSize.width += RootPaneInsets.left + RootPaneInsets.right;
            if (_log.isDebugEnabled()) {
              _log.debug("\tsetting root pane size to " + newSize);
            }
            if (newSize.height != rootPane.getHeight()
                    || newSize.width != rootPane.getWidth()) {
                rootPane.setSize(newSize);
                rootPane.revalidate(); //PM:4/8/07 Added to correct paint issue
                rootPane.repaint();
            }
        }

        if (_log.isDebugEnabled()) {
          _log.debug("\tSetting owning container's size to ("
View Full Code Here

             *
             * @deprecated, this code remains only for backward compatability.
             * Only code generated prior to 6/8/07 will use this
             */
            Component grandMa = ((JComponent)parent).getTopLevelAncestor();
            JRootPane root = ((JComponent)parent).getRootPane();
            JLayeredPane layeredPane = getLayeredPane(grandMa);
            Component glassPane = UIutils.getGlassPane(grandMa);
            JMenuBar menuBar = root == null ? null : root.getJMenuBar();
            if (grandMa != null) {
                Insets insets = ((Container)grandMa).getInsets();
                Insets tempInsets = new Insets(0,0,0,0);

                int menuHeight = 0;
                // TF:19/09/2009:Only compensate for the menu bar if it's visible.
                if (menuBar != null && menuBar.isVisible()) {
                    // Compensate for only the height of the menu, the width is derived from the screen.
                    menuHeight = menuBar.getHeight();
                }

                // Layered pane = content pane + menu bar + insets
                if (layeredPane != null) {
                    layeredPane.getInsets(tempInsets);
                    newSize.height += menuHeight + tempInsets.top + tempInsets.bottom;
                    newSize.width += tempInsets.left + tempInsets.right;
                    if (debugEnabled) {
                      _log.debug("\tsetting layered pane size to " + newSize);
                    }
                    if (newSize.height != layeredPane.getHeight()
                            || newSize.width != layeredPane.getWidth()) {
                        layeredPane.setSize(newSize);
                    }
                }
                if (glassPane != null) {
                  if (debugEnabled) {
                    _log.debug("\tsetting glass pane size to " + newSize);
                  }
                    if (newSize.height != glassPane.getHeight()
                            || newSize.width != glassPane.getWidth()) {
                        glassPane.setSize(newSize);
                    }
                }

                if (root != null) {
                    root.getInsets(tempInsets);
                    newSize.height += tempInsets.top + tempInsets.bottom;
                    newSize.width += tempInsets.left + tempInsets.right;
                    if (debugEnabled) {
                      _log.debug("\tsetting root pane size to " + newSize);
                    }
                    if (newSize.height != root.getHeight()
                            || newSize.width != root.getWidth()) {
                        root.setSize(newSize);
                        root.revalidate(); //PM:4/8/07 Added to correct paint issue
                    }
                }

                if (debugEnabled) {
                  _log.debug("\tSetting owning container's size to ("
View Full Code Here

        JLayeredPane layeredPane = this.frame.getLayeredPane();
        Insets layeredPaneInsets = new Insets(0,0,0,0);
        JMenuBar menuBar = this.frame.getJMenuBar();
        int menuHeight = (menuBar == null) ? 0 : menuBar.getHeight()// Compensate for only the height of the menu, the width is derived from the screen.
        Component glassPane = this.frame.getGlassPane();
        JRootPane rootPane = this.frame.getRootPane();
        Insets RootPaneInsets = new Insets(0,0,0,0);

        // Layered pane = content pane + menu bar + insets
        if (layeredPane != null) {
            layeredPane.getInsets(layeredPaneInsets);
            // TF:20/8/07:Tests show that if we include the menu height here that our window comes out too big,
            // by the height of the menu. So setting the layered pane size must cater for this.
            newSize.height += menuHeight + layeredPaneInsets.top + layeredPaneInsets.bottom;
            newSize.width += layeredPaneInsets.left + layeredPaneInsets.right;
            if (_log.isDebugEnabled()) {
              _log.debug("\tsetting layered pane size to " + newSize);
            }
            if (newSize.height != layeredPane.getHeight()
                    || newSize.width != layeredPane.getWidth()) {
                layeredPane.setSize(newSize);
                layeredPane.revalidate();
                layeredPane.repaint();
            }
        }
        // size the glass pane
        if (glassPane != null) {
            if (_log.isDebugEnabled()) {
              _log.debug("\tsetting glass pane size to " + newSize);
            }
            if (newSize.height != glassPane.getHeight()
                    || newSize.width != glassPane.getWidth()) {
                glassPane.setSize(newSize);
            }
        }

        //size the root pane
        if (rootPane != null) {
            rootPane.getInsets(RootPaneInsets);
            newSize.height += RootPaneInsets.top + RootPaneInsets.bottom;
            newSize.width += RootPaneInsets.left + RootPaneInsets.right;
            if (_log.isDebugEnabled()) {
              _log.debug("\tsetting root pane size to " + newSize);
            }
            if (newSize.height != rootPane.getHeight()
                    || newSize.width != rootPane.getWidth()) {
                rootPane.setSize(newSize);
                rootPane.revalidate(); //PM:4/8/07 Added to correct paint issue
                rootPane.repaint();
            }
        }

        if (_log.isDebugEnabled()) {
          _log.debug("\tSetting owning container's size to ("
View Full Code Here

     * Provide a mechanism to propagate an enter key to the default button
     */
    private void setupEnterKeyListener() {       
        this.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JRootPane aRootPane = getRootPane();
                if (aRootPane != null) {
                    JButton aDefaultButton = aRootPane.getDefaultButton();
                    if (aDefaultButton!= null && aDefaultButton.isEnabled()) {
                        loseFocus(Constants.FC_KEYNEXT);
                        aDefaultButton.requestFocus();

                        UIutils.invokeOnGuiThread(new Runnable () {
View Full Code Here

     * Provide a mechanism to propagate an enter key to the default button
     */
    private void setupEnterKeyListener() {       
        this.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JRootPane aRootPane = getRootPane();
                if (aRootPane != null) {
                    JButton aDefaultButton = aRootPane.getDefaultButton();
                    if (aDefaultButton!= null && aDefaultButton.isEnabled()) {
                        loseFocus(Constants.FC_KEYNEXT);
                        aDefaultButton.requestFocus();

                        UIutils.invokeOnGuiThread(new Runnable () {
View Full Code Here

        // TF:21/11/07:If the child has the default button for the panel, and
        // the new child doesn't have a default button, set the old default
        // button to be the new default button.
        JButton defaultButton = null;
        JRootPane root = pChild.getRootPane();
        if (root != null && root.getDefaultButton() != null &&
                (pChild == root.getDefaultButton() || pChild.isAncestorOf(root.getDefaultButton()))) {

            defaultButton = root.getDefaultButton();
        }

        if (oldParent != null) {
            oldParent.remove(pChild);
            if (oldParent.getParent() != null)
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.