javax.swing.JComponent.setFocusTraversalKeys()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中javax.swing.JComponent.setFocusTraversalKeys()方法的一些代码示例,展示了JComponent.setFocusTraversalKeys()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComponent.setFocusTraversalKeys()方法的具体详情如下:
包路径:javax.swing.JComponent
类名称:JComponent
方法名:setFocusTraversalKeys

JComponent.setFocusTraversalKeys介绍

暂无

代码示例

代码示例来源:origin: mabe02/lanterna

component.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.<AWTKeyStroke>emptySet());
component.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.<AWTKeyStroke>emptySet());

代码示例来源:origin: stackoverflow.com

textArea.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
textArea.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
  KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS ) );
set.add( KeyStroke.getKeyStroke( "TAB" ) );
textArea.setFocusTraversalKeys(
  KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, set );
  KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS ) );
set.add( KeyStroke.getKeyStroke( "shift TAB" ) );
textArea.setFocusTraversalKeys(
  KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, set );

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-team-commons

public static void fixFocusTraversalKeys(JComponent component) {
  Set<AWTKeyStroke> set = component.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
  set = new HashSet<AWTKeyStroke>(set);
  set.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK));
  component.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, set);
}

代码示例来源:origin: senbox-org/snap-desktop

private static void forwardFocusWhenTabKeyReleased(JComponent aSenderComponent, JComponent aReceiverComponent) {
    ForwardFocusAction forwardFocusAction = new ForwardFocusAction("TabKeyAction", aReceiverComponent);
    aSenderComponent.setFocusTraversalKeys(0, new HashSet());
    int modifiers = 0; // '0' => no modifiers
    int keyCode = KeyEvent.VK_TAB;
    KeyStroke tabKeyReleased = KeyStroke.getKeyStroke(keyCode, modifiers, true);
    aSenderComponent.getInputMap(1).put(tabKeyReleased, forwardFocusAction.getName());
    aSenderComponent.getActionMap().put(forwardFocusAction.getName(), forwardFocusAction);
  }
}

代码示例来源:origin: stackoverflow.com

forwardKeys.add(KeyStroke.getKeyStroke(
  KeyEvent.VK_TAB, InputEvent.CTRL_MASK));
setFocusTraversalKeys(
  KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forwardKeys);
backwardKeys.add(KeyStroke.getKeyStroke(
  KeyEvent.VK_TAB, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK));
setFocusTraversalKeys(
  KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, backwardKeys);

代码示例来源:origin: org.tentackle/tentackle-swing

comp.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, set);
set = new HashSet<>();
comp.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, set);

代码示例来源:origin: com.googlecode.lanterna/lanterna

component.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.<AWTKeyStroke>emptySet());
component.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.<AWTKeyStroke>emptySet());

代码示例来源:origin: stackoverflow.com

setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,set);
setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,set);
addComponentListener(this);

代码示例来源:origin: stackoverflow.com

Set newForwardKeys = new HashSet(forwardKeys);
newForwardKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
        newForwardKeys);

相关文章

JComponent类方法