javax.swing.JPanel.processKeyBinding()方法的使用及代码示例

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

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

JPanel.processKeyBinding介绍

暂无

代码示例

代码示例来源:origin: freeplane/freeplane

@Override
  protected boolean processKeyBinding(final KeyStroke ks, final KeyEvent e, final int condition,
                    final boolean pressed) {
    return super.processKeyBinding(ks, e, condition, pressed) || e.getKeyChar() == KeyEvent.VK_SPACE
        || e.getKeyChar() == KeyEvent.VK_ALT;
  }
}

代码示例来源:origin: freeplane/freeplane

@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
  return super.processKeyBinding(ks, e, condition, pressed)
      || MenuKeyProcessor.INSTANCE.processKeyBinding(ks, e, condition, pressed);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-beans

@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, 
    boolean pressed) 
{
  if (e.getKeyCode() == KeyEvent.VK_F1 || e.getKeyCode() == KeyEvent.VK_HELP)  {
    JComponent rootPane = SwingUtilities.getRootPane(this);
    if (rootPane != null) {
      rootPane.putClientProperty(ResizablePopup.HELP_COOKIE, Boolean.TRUE); 
    }
  }
  return super.processKeyBinding(ks, e, condition, pressed);
}

代码示例来源:origin: MegaMek/megamek

/**
 *
 */
@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,
    int condition, boolean pressed) {
  if (!e.isConsumed()) {
    return super.processKeyBinding(ks, e, condition, pressed);
  } else {
    return true;
  }
}

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java15

/**
 * This method is called by Swing when the TreeTableCellPanel is installed
 * as a TableCellEditor. It gives the component a chance to process the
 * KeyEvent. For example, a JTextField will honour the keystroke and
 * add the letter to its Document.
 *
 * The TreeTableCellPanel's main job is to pass the KeyEvent on to the
 * underlying {@link #nodeComponent} so that it may have a chance to react.
 * This only need occur once for the KeyEvent that caused the cell edit,
 * after which time the focus will be within the {@link #nodeComponent} and
 * subsequent keystrokes should be ignored.
 */
@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
  // let the nodeComponent have a crack at processing the KeyEvent
  // (we'd love to call nodeComponent.processKeyBinding(ks, e, condition, pressed) but it's protected and thus out of scope)
  if (!nodeComponent.hasFocus())
    SwingUtilities.invokeLater(new RequestFocusAndDispatchKeyEventRunnable(e, nodeComponent));
  // now let the JComboBox react (important for arrow keys to work as expected)
  return super.processKeyBinding(ks, e, condition, pressed);
}

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java16

/**
 * This method is called by Swing when the TreeTableCellPanel is installed
 * as a TableCellEditor. It gives the component a chance to process the
 * KeyEvent. For example, a JTextField will honour the keystroke and
 * add the letter to its Document.
 *
 * The TreeTableCellPanel's main job is to pass the KeyEvent on to the
 * underlying {@link #nodeComponent} so that it may have a chance to react.
 * This only need occur once for the KeyEvent that caused the cell edit,
 * after which time the focus will be within the {@link #nodeComponent} and
 * subsequent keystrokes should be ignored.
 */
@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
  // let the nodeComponent have a crack at processing the KeyEvent
  // (we'd love to call nodeComponent.processKeyBinding(ks, e, condition, pressed) but it's protected and thus out of scope)
  if (!nodeComponent.hasFocus())
    SwingUtilities.invokeLater(new RequestFocusAndDispatchKeyEventRunnable(e, nodeComponent));
  // now let the JComboBox react (important for arrow keys to work as expected)
  return super.processKeyBinding(ks, e, condition, pressed);
}

代码示例来源:origin: com.haulmont.thirdparty/glazedlists

/**
 * This method is called by Swing when the TreeTableCellPanel is installed
 * as a TableCellEditor. It gives the component a chance to process the
 * KeyEvent. For example, a JTextField will honour the keystroke and
 * add the letter to its Document.
 *
 * The TreeTableCellPanel's main job is to pass the KeyEvent on to the
 * underlying {@link #nodeComponent} so that it may have a chance to react.
 * This only need occur once for the KeyEvent that caused the cell edit,
 * after which time the focus will be within the {@link #nodeComponent} and
 * subsequent keystrokes should be ignored.
 */
@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
  // let the nodeComponent have a crack at processing the KeyEvent
  // (we'd love to call nodeComponent.processKeyBinding(ks, e, condition, pressed) but it's protected and thus out of scope)
  if (!nodeComponent.hasFocus())
    SwingUtilities.invokeLater(new RequestFocusAndDispatchKeyEventRunnable(e, nodeComponent));
  // now let the JComboBox react (important for arrow keys to work as expected)
  return super.processKeyBinding(ks, e, condition, pressed);
}

代码示例来源:origin: org.jspresso.framework/jspresso-swing-components

/**
 * {@inheritDoc}
 */
@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition,
  boolean pressed) {
 if (super.processKeyBinding(ks, e, condition, pressed)) {
  return true;
 }
 Object binding = textField.getInputMap(condition).get(ks);
 if (binding != null && textField.getActionMap().get(binding) != null) {
  textField.dispatchEvent(e);
  return true;
 }
 return false;
}

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

/**
 * {@inheritDoc}
 */
@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition,
  boolean pressed) {
 if (super.processKeyBinding(ks, e, condition, pressed)) {
  return true;
 }
 Object binding = textField.getInputMap(condition).get(ks);
 if (binding != null && textField.getActionMap().get(binding) != null) {
  textField.dispatchEvent(e);
  return true;
 }
 return false;
}

相关文章

微信公众号

最新文章

更多

JPanel类方法