javax.swing.JTextArea.processKeyEvent()方法的使用及代码示例

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

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

JTextArea.processKeyEvent介绍

暂无

代码示例

代码示例来源:origin: net.java.abeille/abeille

/**
   * Intercept commands to set field to null
   */
  public void processKeyEvent(KeyEvent evt) {
    if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
      setValue(getText());
    }
    else
      super.processKeyEvent(evt);
  }
}

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

/**
 * {@inheritDoc}
 * <p>
 * Overridden due to smart enter.
 */
@Override
protected void processKeyEvent(KeyEvent e)  {
 if (e.getID() == KeyEvent.KEY_PRESSED) {
  lastKeyEvent = e;
  if (e.getKeyCode() != KeyEvent.VK_ENTER) {
   enterWillInsert = true;
  }
  if (e.getKeyCode() == KeyEvent.VK_Z && e.getModifiers() == KeyEvent.CTRL_MASK) {
   // undo
   setText(savedValue);
   e.consume();
  }
 }
 super.processKeyEvent(e);
}

代码示例来源:origin: net.sourceforge.owlapi/org.semanticweb.hermit

@Override
protected void processKeyEvent(KeyEvent event) {
  if (event.getKeyCode()!=KeyEvent.VK_ENTER)
    super.processKeyEvent(event);
  if (event.getID()==KeyEvent.KEY_PRESSED && event.getKeyCode()==KeyEvent.VK_ENTER) {
    int textEnd=getDocument().getLength();
    select(textEnd,textEnd);
    super.replaceSelection("\n");
    textEnd=getDocument().getLength();
    String text;
    try {
      text=getDocument().getText(m_userTypedTextStart,textEnd-m_userTypedTextStart);
    }
    catch (@SuppressWarnings("unused") BadLocationException error) {
      text="";
    }
    m_reader.addToBuffer(text);
    m_userTypedTextStart=textEnd;
    select(m_userTypedTextStart,m_userTypedTextStart);
  }
}

代码示例来源:origin: com.hermit-reasoner/org.semanticweb.hermit

protected void processKeyEvent(KeyEvent event) {
  if (event.getKeyCode()!=KeyEvent.VK_ENTER)
    super.processKeyEvent(event);
  if (event.getID()==KeyEvent.KEY_PRESSED && event.getKeyCode()==KeyEvent.VK_ENTER) {
    int textEnd=getDocument().getLength();
    select(textEnd,textEnd);
    super.replaceSelection("\n");
    textEnd=getDocument().getLength();
    String text;
    try {
      text=getDocument().getText(m_userTypedTextStart,textEnd-m_userTypedTextStart);
    }
    catch (BadLocationException error) {
      text="";
    }
    m_reader.addToBuffer(text);
    m_userTypedTextStart=textEnd;
    select(m_userTypedTextStart,m_userTypedTextStart);
  }
}

代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit

super.processKeyEvent(evt);

相关文章

JTextArea类方法