javax.swing.text.JTextComponent.getInputMap()方法的使用及代码示例

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

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

JTextComponent.getInputMap介绍

暂无

代码示例

代码示例来源:origin: skylot/jadx

private void addKeyActions() {
  KeyStroke undoKey = KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK);
  textComponent.getInputMap().put(undoKey, undoAction);
  KeyStroke redoKey = KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK);
  textComponent.getInputMap().put(redoKey, redoAction);
}

代码示例来源:origin: groovy/groovy-core

public static void installAutoTabAction(JTextComponent tComp) {
  tComp.getActionMap().put("GroovyFilter-autoTab", AUTO_TAB_ACTION);
  KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false);
  tComp.getInputMap().put(keyStroke, "GroovyFilter-autoTab");
}

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

InputMap inputMap = textConponent.getInputMap();
actionMap.put("Undo", new AbstractAction("Undo") {
  @Override

代码示例来源:origin: ron190/jsql-injection

this.getProxy().getInputMap().put(KeyStroke.getKeyStroke("control Z"), undoIdentifier);
this.getProxy().getInputMap().put(KeyStroke.getKeyStroke("control Y"), redoIdentifier);

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

private void bindKeyStrokeToActionMapKey( KeyStroke keyStroke, String actionMapKey )
{
 _textComponent.getInputMap().put( keyStroke, actionMapKey );
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

private void bindKeyStrokeToActionMapKey( KeyStroke keyStroke, String actionMapKey )
{
 _textComponent.getInputMap().put( keyStroke, actionMapKey );
}

代码示例来源:origin: org.codehaus.groovy/groovy-console

public static void installAutoTabAction(JTextComponent tComp) {
  tComp.getActionMap().put("GroovyFilter-autoTab", AUTO_TAB_ACTION);
  KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false);
  tComp.getInputMap().put(keyStroke, "GroovyFilter-autoTab");
}

代码示例来源:origin: zgqq/mah

private void disposeKeybinds(JTextComponent input) {
  InputMap inputMap = input.getInputMap();
  KeyStroke keystroke = KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.CTRL_MASK, false);
  inputMap.put(keystroke, "none");
  KeyStroke keystroke2 = KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, KeyEvent.CTRL_MASK, false);
  inputMap.put(keystroke2, "none");
  KeyStroke keystroke3 = KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0, false);
  inputMap.put(keystroke3, "none");
  KeyStroke keystroke4 = KeyStroke.getKeyStroke(KeyEvent.VK_H, KeyEvent.CTRL_MASK, false);
  inputMap.put(keystroke4, "none");
  KeyStroke keystroke5 = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false);
  inputMap.put(keystroke5, "none");
}

代码示例来源:origin: com.fifesoft/autocomplete

/**
 * Replaces the "trigger key" action with the one that was there before
 * auto-completion was installed.
 *
 * @see #installTriggerKey(KeyStroke)
 */
private void uninstallTriggerKey() {
  InputMap im = textComponent.getInputMap();
  im.put(trigger, oldTriggerKey);
  ActionMap am = textComponent.getActionMap();
  am.put(PARAM_TRIGGER_KEY, oldTriggerAction);
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public static void installAutoTabAction(JTextComponent tComp) {
  tComp.getActionMap().put("GroovyFilter-autoTab", AUTO_TAB_ACTION);
  KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false);
  tComp.getInputMap().put(keyStroke, "GroovyFilter-autoTab");
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

public static void installAutoTabAction(JTextComponent tComp) {
  tComp.getActionMap().put("GroovyFilter-autoTab", AUTO_TAB_ACTION);
  KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false);
  tComp.getInputMap().put(keyStroke, "GroovyFilter-autoTab");
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

public static void installAutoTabAction(JTextComponent tComp) {
  tComp.getActionMap().put("GroovyFilter-autoTab", AUTO_TAB_ACTION);
  KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false);
  tComp.getInputMap().put(keyStroke, "GroovyFilter-autoTab");
}

代码示例来源:origin: org.kohsuke.droovy/groovy

public static void installAutoTabAction(JTextComponent tComp) {
  tComp.getActionMap().put("GroovyFilter-autoTab", AUTO_TAB_ACTION);
  KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false);
  tComp.getInputMap().put(keyStroke, "GroovyFilter-autoTab");
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

private Object getActionMapKey( KeyStroke keyStroke )
{
 return _textComponent.getInputMap().get( keyStroke );
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

private Object getActionMapKey( KeyStroke keyStroke )
{
 return _textComponent.getInputMap().get( keyStroke );
}

代码示例来源:origin: com.fifesoft/autocomplete

/**
 * Installs a "trigger key" action onto the current text component.
 *
 * @param ks The keystroke that should trigger the action.
 * @see #uninstallTriggerKey()
 */
private void installTriggerKey(KeyStroke ks) {
  InputMap im = textComponent.getInputMap();
  oldTriggerKey = im.get(ks);
  im.put(ks, PARAM_TRIGGER_KEY);
  ActionMap am = textComponent.getActionMap();
  oldTriggerAction = am.get(PARAM_TRIGGER_KEY);
  am.put(PARAM_TRIGGER_KEY, createAutoCompleteAction());
}

代码示例来源:origin: org.zaproxy/zap

private void setEnabled(boolean enabled) {
  if (enabled != this.enabled) {
    this.enabled = enabled;
    if (enabled) {
      this.textComponent.addPropertyChangeListener("document", this);
      this.textComponent.getDocument().addUndoableEditListener(this);
      this.textComponent.getActionMap().put(UndoAction.ACTION_NAME, undoAction);
      this.textComponent.getActionMap().put(RedoAction.ACTION_NAME, redoAction);
      this.textComponent.getInputMap().put(UndoAction.KEY_STROKE, UndoAction.ACTION_NAME);
      this.textComponent.getInputMap().put(RedoAction.KEY_STROKE, RedoAction.ACTION_NAME);
    } else {
      this.textComponent.removePropertyChangeListener("document", this);
      this.textComponent.getDocument().removeUndoableEditListener(this);
      this.textComponent.getActionMap().remove(UndoAction.ACTION_NAME);
      this.textComponent.getActionMap().remove(RedoAction.ACTION_NAME);
      this.textComponent.getInputMap().remove(UndoAction.KEY_STROKE);
      this.textComponent.getInputMap().remove(RedoAction.KEY_STROKE);
    }
  }
}

代码示例来源:origin: gaborbata/jpass

public static final void bindAllActions(JTextComponent component) {
    ActionMap actionMap = component.getActionMap();
    InputMap inputMap = component.getInputMap();
    for (TextComponentActionType type : values()) {
      actionMap.put(type.getName(), type.getAction());
      KeyStroke acc = type.getAccelerator();
      if (acc != null) {
        inputMap.put(type.getAccelerator(), type.getName());
      }
    }
  }
}

代码示例来源:origin: org.softsmithy.lib/lib-core

/**
 * Creates a new instance of this class.
 */
public JHtmlCustomizer() {
  super(new JEditorPane("text/html", HTML_START+HTML_END));
  setStateManager(new HiddenStateManager(this));
  setEditor(new JEditorPane("text/html", HTML_START+HTML_END));
  setEditorScrollable(true);
  //System.out.println("ENTER KeyStroke: " + getEditor().getInputMap().get(KeyStroke.getKeyStroke("ENTER")));
  getEditor().getInputMap().put(KeyStroke.getKeyStroke("ENTER"), insertHtmlBreakAction);
  getEditor().getActionMap().put(insertHtmlBreakAction, new InsertHtmlBreakAction());
  //setComponent(new JEditorPane("text/html", HTML_START+HTML_END));
  inited = true;
  //setBackground(getBackground());
  setForeground(getForeground());
  setFont(getFont());
  setHorizontalAlignment(getHorizontalAlignment());
  //System.out.println(getEditor().getText());
}

代码示例来源:origin: com.jidesoft/jide-oss

private Action getHintsPopupAction() {
  if (isHintsPopupVisible() && getDelegateComponent() != null) {
    Object key = getDelegateComponent().getInputMap().get(_keyStroke);
    key = key == null ? getTextComponent().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).get(_keyStroke) : key;
    if (key != null) {
      return getDelegateComponent().getActionMap().get(key);
    }
  }
  return null;
}

相关文章

JTextComponent类方法