本文整理汇总了Java中javax.swing.InputMap.remove方法的典型用法代码示例。如果您正苦于以下问题:Java InputMap.remove方法的具体用法?Java InputMap.remove怎么用?Java InputMap.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.InputMap
的用法示例。
在下文中一共展示了InputMap.remove方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CheckTreeView
import javax.swing.InputMap; //导入方法依赖的package包/类
/** Creates a new instance of CheckTreeView */
public CheckTreeView() {
setFocusable( false );
CheckListener l = new CheckListener();
tree.addMouseListener( l );
tree.addKeyListener( l );
CheckRenderer check = new CheckRenderer();
tree.setCellRenderer( check );
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.setShowsRootHandles(false);
InputMap input = tree.getInputMap( JTree.WHEN_FOCUSED );
if( null != input )
input.remove( KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0) );
setBorder( UIManager.getBorder("ScrollPane.border") );
}
示例2: initKeysAndActions
import javax.swing.InputMap; //导入方法依赖的package包/类
/**
* Right-arrow key expands a row, left-arrow collapses a row, enter invokes
* row's default action (if any).
*/
private void initKeysAndActions() {
unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0));
unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0));
unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.SHIFT_DOWN_MASK));
expandAction = new ExpandAction();
collapseAction = new CollapseAction();
defaultAction = new DefaultAction();
showPopupAction = new ShowPopupAction();
InputMap imp = getInputMap();
InputMap impAncestor = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
ActionMap am = getActionMap();
imp.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), ACTION_EXPAND);
imp.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), ACTION_COLLAPSE);
imp.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), ACTION_DEFAULT);
imp.put(KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.SHIFT_DOWN_MASK), ACTION_SHOW_POPUP);
impAncestor.remove(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0));
impAncestor.remove(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0));
impAncestor.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
impAncestor.remove(KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.SHIFT_DOWN_MASK));
am.put(ACTION_EXPAND, expandAction);
am.put(ACTION_COLLAPSE, collapseAction);
am.put(ACTION_DEFAULT, defaultAction);
am.put(ACTION_SHOW_POPUP, showPopupAction);
}
示例3: createCommandField
import javax.swing.InputMap; //导入方法依赖的package包/类
@Override
protected JTextComponent createCommandField() {
JTextArea res = new DynamicWidthTA();
res.setRows(1);
res.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 1));
// disable default Swing's Ctrl+Shift+O binding to enable our global action
InputMap curIm = res.getInputMap(JComponent.WHEN_FOCUSED);
while (curIm != null) {
curIm.remove(KeyStroke.getKeyStroke(
KeyEvent.VK_O, KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK));
curIm = curIm.getParent();
}
return res;
}
示例4: fixCtrlH
import javax.swing.InputMap; //导入方法依赖的package包/类
/**
* Removes the "Ctrl+H <=> Backspace" behavior that Java shows, for some
* odd reason...
*/
private void fixCtrlH() {
InputMap inputMap = getInputMap();
KeyStroke char010 = KeyStroke.getKeyStroke("typed \010");
InputMap parent = inputMap;
while (parent != null) {
parent.remove(char010);
parent = parent.getParent();
}
if (inputMap != null) { // Just for Sonar
KeyStroke backspace = KeyStroke.getKeyStroke("BACK_SPACE");
inputMap.put(backspace, DefaultEditorKit.deletePrevCharAction);
}
}
示例5: configureActionMaps
import javax.swing.InputMap; //导入方法依赖的package包/类
/**
* Installs the keyListener in the textArea and editorPane
* for handling the enter keystroke and updating the modified state.
*/
protected void configureActionMaps()
{
InputMap editorInputMap = editorPane.getInputMap();
InputMap textInputMap = textArea.getInputMap();
// Adds handling for the escape key to cancel editing
editorInputMap.put(escapeKeystroke, cancelEditingAction);
textInputMap.put(escapeKeystroke, cancelEditingAction);
// Adds handling for shift-enter and redirects enter to stop editing
if (graphComponent.isEnterStopsCellEditing())
{
editorInputMap.put(shiftEnterKeystroke, editorEnterActionMapKey);
textInputMap.put(shiftEnterKeystroke, textEnterActionMapKey);
editorInputMap.put(enterKeystroke, SUBMIT_TEXT);
textInputMap.put(enterKeystroke, SUBMIT_TEXT);
}
else
{
editorInputMap.put(enterKeystroke, editorEnterActionMapKey);
textInputMap.put(enterKeystroke, textEnterActionMapKey);
if (isShiftEnterSubmitsText())
{
editorInputMap.put(shiftEnterKeystroke, SUBMIT_TEXT);
textInputMap.put(shiftEnterKeystroke, SUBMIT_TEXT);
}
else
{
editorInputMap.remove(shiftEnterKeystroke);
textInputMap.remove(shiftEnterKeystroke);
}
}
}
示例6: configureActionMaps
import javax.swing.InputMap; //导入方法依赖的package包/类
/**
* Installs the keyListener in the textArea and editorPane for handling the enter keystroke and
* updating the modified state.
*/
protected void configureActionMaps() {
InputMap editorInputMap = editorPane.getInputMap();
InputMap textInputMap = textArea.getInputMap();
// Adds handling for the escape key to cancel editing
editorInputMap.put(escapeKeystroke, cancelEditingAction);
textInputMap.put(escapeKeystroke, cancelEditingAction);
// Adds handling for shift-enter and redirects enter to stop editing
if (graphComponent.isEnterStopsCellEditing()) {
editorInputMap.put(shiftEnterKeystroke, editorEnterActionMapKey);
textInputMap.put(shiftEnterKeystroke, textEnterActionMapKey);
editorInputMap.put(enterKeystroke, SUBMIT_TEXT);
textInputMap.put(enterKeystroke, SUBMIT_TEXT);
} else {
editorInputMap.put(enterKeystroke, editorEnterActionMapKey);
textInputMap.put(enterKeystroke, textEnterActionMapKey);
if (isShiftEnterSubmitsText()) {
editorInputMap.put(shiftEnterKeystroke, SUBMIT_TEXT);
textInputMap.put(shiftEnterKeystroke, SUBMIT_TEXT);
} else {
editorInputMap.remove(shiftEnterKeystroke);
textInputMap.remove(shiftEnterKeystroke);
}
}
}
示例7: initKeysAndActions
import javax.swing.InputMap; //导入方法依赖的package包/类
@Override
protected void initKeysAndActions() {
super.initKeysAndActions();
unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0));
unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0));
expandAction = new ExpandAction();
collapseAction = new CollapseAction();
edClassAction = new EditorClassAction();
InputMap imp = getInputMap();
InputMap impAncestor = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
ActionMap am = getActionMap();
KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK);
imp.put(ks, null);
imp.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), ACTION_EXPAND);
imp.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), ACTION_COLLAPSE);
if (!GraphicsEnvironment.isHeadless()) {
imp.put(
KeyStroke.getKeyStroke(
KeyEvent.VK_HOME, KeyEvent.SHIFT_DOWN_MASK | Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
), ACTION_EDCLASS
);
}
imp.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), ACTION_NEXT);
imp.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, KeyEvent.SHIFT_DOWN_MASK), ACTION_PREV);
impAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, KeyEvent.CTRL_DOWN_MASK), ACTION_CUSTOM_EDITOR);
impAncestor.remove(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0));
impAncestor.remove(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0));
am.put(ACTION_EXPAND, expandAction);
am.put(ACTION_COLLAPSE, collapseAction);
am.put(ACTION_CUSTOM_EDITOR, getCustomEditorAction());
am.put(ACTION_EDCLASS, edClassAction);
Action defaultAction = am.get( "selectNextRow" );
if( null != defaultAction ) {
am.put("selectNextRow", new IncrementAction(false, defaultAction));
}
defaultAction = am.get( "selectPreviousRow" );
if( null != defaultAction ) {
am.put("selectPreviousRow", new IncrementAction(true, defaultAction));
}
}