Package java.awt

Examples of java.awt.FocusTraversalPolicy


   */
  public static void compositeRequestFocus(Component component) {
    if (component instanceof Container) {
      Container container = (Container) component;
      if (container.isFocusCycleRoot()) {
        FocusTraversalPolicy policy = container.getFocusTraversalPolicy();
        Component comp = policy.getDefaultComponent(container);
        if (comp != null) {
          comp.requestFocusInWindow();
          return;
        }
      }
      Container rootAncestor = container.getFocusCycleRootAncestor();
      if (rootAncestor != null) {
        FocusTraversalPolicy policy = rootAncestor.getFocusTraversalPolicy();
        Component comp = policy.getComponentAfter(rootAncestor, container);

        if (comp != null && SwingUtilities.isDescendingFrom(comp, container)) {
          comp.requestFocusInWindow();
          return;
        }
View Full Code Here


    private static final String FORWARD = "moveSelectionForward";
    private static final String BACKWARD = "moveSelectionBackward";

    public void actionPerformed( ActionEvent e )
    {
      FocusTraversalPolicy ftp = xp.getFocusTraversalPolicy();

      if (ftp instanceof JXButtonPanelFocusTraversalPolicy) {
        JXButtonPanelFocusTraversalPolicy xftp = (JXButtonPanelFocusTraversalPolicy)ftp;

        String actionCommand = e.getActionCommand();
View Full Code Here

    private class ActionHandler implements ActionListener {
        private static final String FORWARD = "moveSelectionForward";
        private static final String BACKWARD = "moveSelectionBackward";

        public void actionPerformed(ActionEvent e) {
            FocusTraversalPolicy ftp = JXButtonPanel.this.getFocusTraversalPolicy();

            if (ftp instanceof JXButtonPanelFocusTraversalPolicy) {
                JXButtonPanelFocusTraversalPolicy xftp = (JXButtonPanelFocusTraversalPolicy) ftp;

                String actionCommand = e.getActionCommand();
View Full Code Here

            @Override
            public void display(Component c) {
                pageArea.add(c, BorderLayout.CENTER);
                JComponent jc = (JComponent) c;
                FocusTraversalPolicy policy = new FocusTraversal(page, jc, jc.getFocusTraversalPolicy(), navigationToolBar.getFocusTraversalPolicy());
                setFocusTraversalPolicy(policy);
            }
        });
        pageArea.revalidate();
        pageArea.repaint();
View Full Code Here

            : aContainer.getFocusCycleRootAncestor();

        // Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
        // traversal policy is non-legacy, then honor it.
        if (root != null) {
            FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
            if (policy != gluePolicy) {
                return policy.getComponentAfter(root, aComponent);
            }

            comparator.setComponentOrientation(root.getComponentOrientation());
            return layoutPolicy.getComponentAfter(root, aComponent);
        }
View Full Code Here

            : aContainer.getFocusCycleRootAncestor();

        // Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
        // traversal policy is non-legacy, then honor it.
        if (root != null) {
            FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
            if (policy != gluePolicy) {
                return policy.getComponentBefore(root, aComponent);
            }

            comparator.setComponentOrientation(root.getComponentOrientation());
            return layoutPolicy.getComponentBefore(root, aComponent);
        }
View Full Code Here

            : aContainer.getFocusCycleRootAncestor();

        // Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
        // traversal policy is non-legacy, then honor it.
        if (root != null) {
            FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
            if (policy != gluePolicy) {
                return policy.getFirstComponent(root);
            }

            comparator.setComponentOrientation(root.getComponentOrientation());
            return layoutPolicy.getFirstComponent(root);
        }
View Full Code Here

            : aContainer.getFocusCycleRootAncestor();

        // Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
        // traversal policy is non-legacy, then honor it.
        if (root != null) {
            FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
            if (policy != gluePolicy) {
                return policy.getLastComponent(root);
            }

            comparator.setComponentOrientation(root.getComponentOrientation());
            return layoutPolicy.getLastComponent(root);
        }
View Full Code Here

        // See if the component is inside of policy provider
        Container ftp = getTopmostProvider(aContainer, aComponent);
        if (ftp != null) {
            if (log.isLoggable(Level.FINE)) log.fine("### Asking FTP " + ftp.getName() + " for component after " + aComponent.getName());
            // FTP knows how to find component after the given. We don't.
            FocusTraversalPolicy policy = ftp.getFocusTraversalPolicy();
            Component retval = policy.getComponentBefore(ftp, aComponent);
            if (retval == policy.getLastComponent(ftp)) {
                retval = null;
            }
            if (retval != null) {
                if (log.isLoggable(Level.FINE)) log.fine("### FTP returned " + retval.getName());
                return retval;
View Full Code Here

TOP

Related Classes of java.awt.FocusTraversalPolicy

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.