Java Swing Key Action removeTabbedPaneFocusTraversalKeyBindings( JComponent c)

Here you can find the source of removeTabbedPaneFocusTraversalKeyBindings( JComponent c)

Description

Remove problematic actions that prevent Ctrl+PageUp/PageDown from being used for cycling through active documents.

License

BSD License

Parameter

Parameter Description
c The component to modify.

Declaration

public static void removeTabbedPaneFocusTraversalKeyBindings(
        JComponent c) 

Method Source Code

//package com.java2s;
/*/*  ww  w  .  ja v a 2  s  .com*/
 * 03/01/2004
 *
 * RTextUtilities.java - Standard tools used by several pieces of RText.
 * Copyright (C) 2004 Robert Futrell
 * http://fifesoft.com/rtext
 * Licensed under a modified BSD license.
 * See the included license file for details.
 */

import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

import javax.swing.InputMap;
import javax.swing.JComponent;

import javax.swing.KeyStroke;

public class Main {
    /**
     * Remove problematic actions that prevent Ctrl+PageUp/PageDown from
     * being used for cycling through active documents.
     *
     * @param c The component to modify.
     */
    public static void removeTabbedPaneFocusTraversalKeyBindings(
            JComponent c) {

        InputMap im = c
                .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
        im.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN,
                InputEvent.CTRL_MASK), "nothing");
        im.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP,
                InputEvent.CTRL_MASK), "nothing");

        im = c.getInputMap();
        im.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN,
                InputEvent.CTRL_MASK), "nothing");
        im.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP,
                InputEvent.CTRL_MASK), "nothing");

    }
}

Related

  1. pressKey(Component component, int keyCode, int modifier)
  2. registerKey(JComponent component, final int keyEvent, int modifiers, Action action)
  3. registerKeyAction(JComponent component, int keyCode, Action action)
  4. registerTabKey(Container container)
  5. registerWindowCloseKeys(JRootPane root, Action closeAction)
  6. replaceAction(InputMap map, char c)
  7. sendKeys(JComponent component, int modifiers, int key)
  8. setActionID(final Action a, final String id)
  9. setDefaultOkCancelKeyStrokes(final JRootPane rootPane, final Action okAction, final Action cancelAction)