Package javax.swing

Examples of javax.swing.JRootPane$AccessibleJRootPane


        this.add = add;
    }
    @SuppressWarnings("unchecked")
  public void performAction() {

        JRootPane root = ((JComponent)this._component).getRootPane();
      JComponent target = (JComponent)this._component;
        if (root!=null){
            HashSet<JComponent> selectedKids = (HashSet<JComponent>)root.getClientProperty("qq_selectedKids");
            if (selectedKids == null){
                selectedKids = new HashSet<JComponent>();
                root.putClientProperty("qq_selectedKids", selectedKids);
            }
            if (!add){
                // no shift key
                Iterator<JComponent> it = selectedKids.iterator();
                while (it.hasNext()){
View Full Code Here


    }

    public void performAction() {
        // TF:21/11/07: Refactored and commented this method for readability
        JButton newDefaultButton = (JButton)this._component;
        JRootPane rootPane = newDefaultButton.getRootPane();
        if (rootPane == null) {
            // If the button is not parented onto a Window, we cannot set the default button.
            return;
        }
        // Get the button that used to be the default button
        JButton oldDefaultButton = rootPane.getDefaultButton();

        if (this.setAsDefault) {
            if (oldDefaultButton == newDefaultButton) {
                // We're just resetting the default button to the same thing, do nothing.
                return;
            }
            // Make this button the default button
            newDefaultButton.setDefaultCapable(true);
            rootPane.setDefaultButton(newDefaultButton);
            // Set the old button not as the default if applicable
            if (oldDefaultButton != null) {
                oldDefaultButton.setDefaultCapable(false);
            }
        }
        else {
            // See if we're the default button
            if (oldDefaultButton == newDefaultButton) {
                rootPane.setDefaultButton(null);
            }
            // DK:11/11/2008: reset the default button as far as we do not want the button to be default any more.
            JButton initialDefault = (JButton)rootPane.getClientProperty("initialDefaultButton");
            if (newDefaultButton == initialDefault) {
              rootPane.putClientProperty("initialDefaultButton", null);
      }
         
            newDefaultButton.setDefaultCapable(false);
        }
    }
View Full Code Here

     * Gets default button for root container of the component.
     * @param component the component to obtain root container.
     * @return default button of the container or null if root container did not obtained or default button is not defined.
     */
    public static JButton get(JComponent component) {
        JRootPane rootPane = component.getRootPane();
        if (rootPane != null) {
            return rootPane.getDefaultButton();
        }
    return null;
  }
View Full Code Here

        this.add = add;
    }
    @SuppressWarnings("unchecked")
  public void performAction() {

        JRootPane root = ((JComponent)this._component).getRootPane();
      JComponent target = (JComponent)this._component;
        if (root!=null){
            HashSet<JComponent> selectedKids = (HashSet<JComponent>)root.getClientProperty("qq_selectedKids");
            if (selectedKids == null){
                selectedKids = new HashSet<JComponent>();
                root.putClientProperty("qq_selectedKids", selectedKids);
            }
            if (!add){
                // no shift key
                Iterator<JComponent> it = selectedKids.iterator();
                while (it.hasNext()){
View Full Code Here

    }

    public void performAction() {
        // TF:21/11/07: Refactored and commented this method for readability
        JButton newDefaultButton = (JButton)this._component;
        JRootPane rootPane = newDefaultButton.getRootPane();
        if (rootPane == null) {
            // If the button is not parented onto a Window, we cannot set the default button.
            return;
        }
        // Get the button that used to be the default button
        JButton oldDefaultButton = rootPane.getDefaultButton();

        if (this.setAsDefault) {
            if (oldDefaultButton == newDefaultButton) {
                // We're just resetting the default button to the same thing, do nothing.
                return;
            }
            // Make this button the default button
            newDefaultButton.setDefaultCapable(true);
            rootPane.setDefaultButton(newDefaultButton);
            // Set the old button not as the default if applicable
            if (oldDefaultButton != null) {
                oldDefaultButton.setDefaultCapable(false);
            }
        }
        else {
            // See if we're the default button
            if (oldDefaultButton == newDefaultButton) {
                rootPane.setDefaultButton(null);
            }
            // DK:11/11/2008: reset the default button as far as we do not want the button to be default any more.
            JButton initialDefault = (JButton)rootPane.getClientProperty("initialDefaultButton");
            if (newDefaultButton == initialDefault) {
              rootPane.putClientProperty("initialDefaultButton", null);
      }
         
            newDefaultButton.setDefaultCapable(false);
        }
    }
View Full Code Here

     * Gets default button for root container of the component.
     * @param component the component to obtain root container.
     * @return default button of the container or null if root container did not obtained or default button is not defined.
     */
    public static JButton get(JComponent component) {
        JRootPane rootPane = component.getRootPane();
        if (rootPane != null) {
            return rootPane.getDefaultButton();
        }
    return null;
  }
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

     * 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

          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

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.