java.awt.event.FocusListener类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(254)

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

FocusListener介绍

[英]The listener interface for receiving keyboard focus events on a component. The class that is interested in processing a focus event either implements this interface (and all the methods it contains) or extends the abstract FocusAdapter class (overriding only the methods of interest). The listener object created from that class is then registered with a component using the component's addFocusListener method. When the component gains or loses the keyboard focus, the relevant method in the listener object is invoked, and the FocusEvent is passed to it.
[中]用于接收组件上的键盘焦点事件的侦听器接口。对处理焦点事件感兴趣的类要么实现此接口(及其包含的所有方法),要么扩展抽象FocusAdapter类(仅覆盖感兴趣的方法)。然后使用组件的addFocusListener方法向组件注册从该类创建的侦听器对象。当组件获得或失去键盘焦点时,将调用侦听器对象中的相关方法,并将FocusEvent传递给它。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-util

/** Delegates to the original listener.
*/
@Override public void focusLost(FocusEvent ev) {
  FocusListener l = (FocusListener) super.get(ev);
  if (l != null) {
    l.focusLost(ev);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-util

/** Delegates to the original listener.
*/
@Override public void focusGained(FocusEvent ev) {
  FocusListener l = (FocusListener) super.get(ev);
  if (l != null) {
    l.focusGained(ev);
  }
}

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

final FocusListener listener = new FocusListener() {
    listener.focusLost(new FocusEvent(event));
    listener.focusGained(new FocusEvent(event));

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

for (int i = 0; i < focusListenersList.size(); i++) {
  FocusListener focusListener = focusListenersList.get(i);
  focusListener.focusGained(new FocusEvent(
                      VersionTextField.this,
                      e.getID(),
for (int i = 0; i < focusListenersList.size(); i++) {
  FocusListener focusListener = focusListenersList.get(i);
  focusListener.focusLost(new FocusEvent(
                      VersionTextField.this,
                      e.getID(),

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

public void closeEdit() {
  if (textFieldListener != null) {
    textFieldListener.focusLost(null);
  }
}

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

public void focusGained(FocusEvent e) {
  fl.focusGained(e);
}

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

public void focusLost(FocusEvent e) {
    fl.focusLost(e);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

public void focusGained(FocusEvent e) {
  fl.focusGained(e);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

public void focusLost(FocusEvent e) {
    fl.focusLost(e);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/**
 * Notifies all registered listeners about the event.
 *
 * @param event The event to be fired
 */
private void fireFocusGained(FocusEvent event) {
  if (listenerList == null) return;
  Object[] listeners = listenerList.getListenerList();
  for (int i = listeners.length-2; i>=0; i-=2) {
    if (listeners[i]==java.awt.event.FocusListener.class) {
      ((java.awt.event.FocusListener)listeners[i+1]).focusGained(event);
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/**
 * Notifies all registered listeners about the event.
 *
 * @param event The event to be fired
 */
private void fireFocusLost(FocusEvent event) {
  if (listenerList == null) return;
  Object[] listeners = listenerList.getListenerList();
  for (int i = listeners.length-2; i>=0; i-=2) {
    if (listeners[i]==java.awt.event.FocusListener.class) {
      ((java.awt.event.FocusListener)listeners[i+1]).focusLost(event);
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/**
 * Notifies all registered listeners about the event.
 *
 * @param event The event to be fired
 */
private void fireFocusGained(FocusEvent event) {
  if (listenerList == null) return;
  Object[] listeners = listenerList.getListenerList();
  for (int i = listeners.length-2; i>=0; i-=2) {
    if (listeners[i]==java.awt.event.FocusListener.class) {
      ((java.awt.event.FocusListener)listeners[i+1]).focusGained(event);
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/**
 * Notifies all registered listeners about the event.
 *
 * @param event The event to be fired
 */
private void fireFocusLost(FocusEvent event) {
  if (listenerList == null) return;
  Object[] listeners = listenerList.getListenerList();
  for (int i = listeners.length-2; i>=0; i-=2) {
    if (listeners[i]==java.awt.event.FocusListener.class) {
      ((java.awt.event.FocusListener)listeners[i+1]).focusLost(event);
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/**
 * Notifies all registered listeners about the event.
 *
 * @param event The event to be fired
 */
private void fireFocusGained(FocusEvent event) {
  if (listenerList == null) {
    return;
  }
  Object[] listeners = listenerList.getListenerList();
  for (int i = listeners.length - 2; i >= 0; i -= 2) {
    if (listeners[i] == java.awt.event.FocusListener.class) {
      ((java.awt.event.FocusListener) listeners[i + 1]).focusGained(event);
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/**
 * Notifies all registered listeners about the event.
 *
 * @param event The event to be fired
 */
private void fireFocusLost(FocusEvent event) {
  if (listenerList == null) {
    return;
  }
  Object[] listeners = listenerList.getListenerList();
  for (int i = listeners.length - 2; i >= 0; i -= 2) {
    if (listeners[i] == java.awt.event.FocusListener.class) {
      ((java.awt.event.FocusListener) listeners[i + 1]).focusLost(event);
    }
  }
}

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util

/** Delegates to the original listener.
*/
@Override public void focusGained(FocusEvent ev) {
  FocusListener l = (FocusListener) super.get(ev);
  if (l != null) {
    l.focusGained(ev);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Delegates to the original listener.
*/
public void focusLost(FocusEvent ev) {
  FocusListener l = (FocusListener)super.get (ev);
  if (l != null) l.focusLost (ev);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Delegates to the original listener.
*/
public void focusGained(FocusEvent ev) {
  FocusListener l = (FocusListener)super.get (ev);
  if (l != null) l.focusGained (ev);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Delegates to the original listener.
*/
public void focusLost(FocusEvent ev) {
  FocusListener l = (FocusListener)super.get (ev);
  if (l != null) l.focusLost (ev);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Delegates to the original listener.
*/
public void focusGained(FocusEvent ev) {
  FocusListener l = (FocusListener)super.get (ev);
  if (l != null) l.focusGained (ev);
}

相关文章