< prev index next >

## src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java

Print this page

     589
     590     /**
     591      * Resets the mnemonics bindings to an empty state.
     592      */
     593     private void resetMnemonics() {
     594         if (mnemonicToIndexMap != null) {
     595             mnemonicToIndexMap.clear();
     596             mnemonicInputMap.clear();
     597         }
     598     }
     599
     600     /**
     601      * Adds the specified mnemonic at the specified index.
     602      */
     603     private void addMnemonic(int index, int mnemonic) {
     604         if (mnemonicToIndexMap == null) {
     605             initMnemonics();
     606         }
     607         mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic, BasicLookAndFeel.getFocusAcceleratorKeyMask()),
     608                              "setSelectedIndex");

     609         mnemonicToIndexMap.put(Integer.valueOf(mnemonic), Integer.valueOf(index));
     610     }
     611
     612     /**
     613      * Installs the state needed for mnemonics.
     614      */
     615     private void initMnemonics() {
     616         mnemonicToIndexMap = new Hashtable<Integer, Integer>();
     617         mnemonicInputMap = new ComponentInputMapUIResource(tabPane);
     618         mnemonicInputMap.setParent(SwingUtilities.getUIInputMap(tabPane,
     619                               JComponent.WHEN_IN_FOCUSED_WINDOW));
     620         SwingUtilities.replaceUIInputMap(tabPane,
     621                               JComponent.WHEN_IN_FOCUSED_WINDOW,
     622                                          mnemonicInputMap);
     623     }
     624
     625     /**
     626      * Sets the tab the mouse is over by location. This is a cover method
     627      * for <code>setRolloverTab(tabForCoordinate(x, y, false))</code>.
     628      */
     589
     590     /**
     591      * Resets the mnemonics bindings to an empty state.
     592      */
     593     private void resetMnemonics() {
     594         if (mnemonicToIndexMap != null) {
     595             mnemonicToIndexMap.clear();
     596             mnemonicInputMap.clear();
     597         }
     598     }
     599
     600     /**
     601      * Adds the specified mnemonic at the specified index.
     602      */
     603     private void addMnemonic(int index, int mnemonic) {
     604         if (mnemonicToIndexMap == null) {
     605             initMnemonics();
     606         }
     607         mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic, BasicLookAndFeel.getFocusAcceleratorKeyMask()),
     608                              "setSelectedIndex");
     609         mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic,
     610                 BasicLookAndFeel.getFocusAcceleratorKeyMask() |
     611                         InputEvent.ALT_GRAPH_DOWN_MASK),
     612                 "setSelectedIndex");
     613         mnemonicToIndexMap.put(Integer.valueOf(mnemonic), Integer.valueOf(index));
     614     }
     615
     616     /**
     617      * Installs the state needed for mnemonics.
     618      */
     619     private void initMnemonics() {
     620         mnemonicToIndexMap = new Hashtable<Integer, Integer>();
     621         mnemonicInputMap = new ComponentInputMapUIResource(tabPane);
     622         mnemonicInputMap.setParent(SwingUtilities.getUIInputMap(tabPane,
     623                               JComponent.WHEN_IN_FOCUSED_WINDOW));
     624         SwingUtilities.replaceUIInputMap(tabPane,
     625                               JComponent.WHEN_IN_FOCUSED_WINDOW,
     626                                          mnemonicInputMap);
     627     }
     628
     629     /**
     630      * Sets the tab the mouse is over by location. This is a cover method
     631      * for <code>setRolloverTab(tabForCoordinate(x, y, false))</code>.
     632      */

< prev index next >