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

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

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

JTextComponent.getFocusListeners介绍

暂无

代码示例

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

public void focusLost() {
  for (FocusListener listener : jTextComponent.getFocusListeners()) {
   listener.focusLost(new FocusEvent(jTextComponent, 0));
  }
 }
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets

static void undecorate(JTextComponent textComponent, Document originalDocument) {
  Document doc = textComponent.getDocument();
  if (doc instanceof AutoCompleteDocument) {
    //remove autocomplete key/action mappings
    InputMap map = textComponent.getInputMap();
    while (map.getParent() != null) {
      InputMap parent = map.getParent();
      //if (parent instanceof AutoComplete.InputMap) {
      if (parent.getClass().getName().contains("AutoComplete")) {
        map.setParent(parent.getParent());
      }
      map = parent;
    }
    textComponent.getActionMap().put("nonstrict-backspace", null);
    //remove old focus listener
    for (FocusListener l : textComponent.getFocusListeners()) {
      //if (l instanceof AutoComplete.FocusAdapter) {
      if (l.getClass().getName().contains("AutoComplete")) {
        textComponent.removeFocusListener(l);
        break;
      }
    }
    //reset to original document
    //textComponent.setDocument(((AutoCompleteDocument) doc).delegate);
    textComponent.setDocument(originalDocument);
  }
}

代码示例来源:origin: tmyroadctfig/swingx

for (FocusListener l : textComponent.getFocusListeners()) {
  if (l instanceof AutoComplete.FocusAdapter) {
    textComponent.removeFocusListener(l);

代码示例来源:origin: org.swinglabs.swingx/swingx-all

for (FocusListener l : textComponent.getFocusListeners()) {
  if (l instanceof AutoComplete.FocusAdapter) {
    textComponent.removeFocusListener(l);

相关文章

JTextComponent类方法