热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

java.awt.KeyboardFocusManager.removeKeyEventDispatcher()方法的使用及代码示例

本文整理了Java中java.awt.KeyboardFocusManager.removeKeyEventDispatcher()方法的一些代码示例,展示了

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

KeyboardFocusManager.removeKeyEventDispatcher介绍

[英]Removes a KeyEventDispatcher which was previously added to this KeyboardFocusManager's dispatcher chain. This KeyboardFocusManager cannot itself be removed, unless it was explicitly re-registered via a call to addKeyEventDispatcher.

If a null dispatcher is specified, if the specified dispatcher is not in the dispatcher chain, or if this KeyboardFocusManager is specified without having been explicitly re-registered, no action is taken and no exception is thrown.
[中]删除以前添加到此KeyboardFocusManager调度程序链的KeyEventDispatcher。此KeyboardFocusManager本身无法删除,除非通过调用addKeyEventDispatcher显式重新注册。
如果指定了null dispatcher,如果指定的dispatcher不在dispatcher链中,或者如果在未显式重新注册的情况下指定了此KeyboardFocusManager,则不会执行任何操作,也不会引发异常。

代码示例

代码示例来源:origin: JetBrains/ideavim

@Override
public boolean dispatchKeyEvent(KeyEvent e) {
final KeyStroke stroke;
if (e.getID() == KeyEvent.KEY_RELEASED) {
stroke = KeyStroke.getKeyStrokeForEvent(e);
if (!StringHelper.isCloseKeyStroke(stroke) && stroke.getKeyCode() != KeyEvent.VK_ENTER) {
return true;
}
} else if (e.getID() == KeyEvent.KEY_TYPED) {
stroke = KeyStroke.getKeyStrokeForEvent(e);
} else {
return true;
}
if (!processor.process(stroke)) {
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this);
loop.exit();
}
return true;
}
});

代码示例来源:origin: Otacon/wifi_china_drone_controller

public void stop() {
focusManager.removeKeyEventDispatcher(this);
}

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

public void init()
{
Container topParent = null;
Container parent = this;
// The natural thing would be to call getParent() until it returns
// null, but then you would be looping for a long time, since
// PluginEmbeddedFrame's getParent() returns itself.
for (int k=0; k <10; k++) {
topParent = parent;
parent = parent.getParent();
if (parent == null) break;
}
// If topParent isn't a KeyEventDispatcher then we must be in some
// Plugin version that doesn't need the workaround.
try {
KeyEventDispatcher ked = (KeyEventDispatcher)topParent;
KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
// You have to remove it twice, otherwise the problem isn't fixed
kfm.removeKeyEventDispatcher(ked);
kfm.removeKeyEventDispatcher(ked);
} catch (ClassCastException e) {}
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

void uninstall() {
isTestingCaps = false;
KeyboardFocusManager.getCurrentKeyboardFocusManager()
.removeKeyEventDispatcher(this);
if (cot.ked == this) {
cot.ked = null;
}
}

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

public void run() {
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(EventBuffer.this);
}
});

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

/**
* Clean up any outside reference to this so it can be garbage
* collected (also close the info popup if necessary).
*/
public void cleanUp() {
KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
kfm.removeKeyEventDispatcher(keyListener);
hideFixedChatInfo();
updateTimer.stop();
}

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

public void deactivate() {
if(! isActive)
return;
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this);
isActive = false;
if(textComponent != null)
textComponent.removeFocusListener(this);
textCompOnent= null;
events.clear();
firstEvent = null;
dispatchedEvent = null;
}
public void activate(InputEvent e) {

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

@Override
public void focusLost(FocusEvent e) {
// System.out.println("focus lost");
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(keyboard);
pressedTask.shutdown();
pressedTask = null;
resetKey();
}
});

代码示例来源:origin: com.threerings/nenya

/**
* Shuts down the key dispatcher.
*/
public void shutdown ()
{
// cease monitoring key events
KeyboardFocusManager.getCurrentKeyboardFocusManager().
removeKeyEventDispatcher(this);
// cease observing our window
_window.removeWindowFocusListener(this);
}

代码示例来源:origin: threerings/nenya

/**
* Shuts down the key dispatcher.
*/
public void shutdown ()
{
// cease monitoring key events
KeyboardFocusManager.getCurrentKeyboardFocusManager().
removeKeyEventDispatcher(this);
// cease observing our window
_window.removeWindowFocusListener(this);
}

代码示例来源:origin: cmu-phil/tetrad

/**
* Unregistered the keyboard actions which are normally registered when the
* user is allowed to edit the workbench directly.
*
* @see #registerKeys
*/
private void unregisterKeys() {
unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0));
unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(controlDispatcher);
}

代码示例来源:origin: Vhati/Slipstream-Mod-Manager

@Override
public void setVisible( boolean b ) {
super.setVisible( b );
if ( b ) {
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher( nullDispatcher );
} else {
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher( nullDispatcher );
}
}
}

代码示例来源:origin: jtrfp/terminal-recall

public void waitForSequenceTyped(final int ... keys){
final boolean [] keyTypeObject = new boolean[]{false};
final KeyEventDispatcher dispatcher = new KeyEventDispatcher(){
private volatile int keyArrayIndex = 0;
@Override
public synchronized boolean dispatchKeyEvent(KeyEvent evt) {//one at a time please...
if(evt.getID()==KeyEvent.KEY_RELEASED){
if(evt.getKeyCode()==keys[keyArrayIndex]){
keyArrayIndex++;
if(keyArrayIndex>=keys.length){
synchronized(keyTypeObject){
keyTypeObject[0]=true;
keyTypeObject.notifyAll();
}//end sync(keyTypeObject)
return false;
}//end if(>keys.length)
}else keyArrayIndex=0;//!target key
}//end if(KEY_RELEASED)
return false;
}};
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(dispatcher);
synchronized(keyTypeObject){
while(!keyTypeObject[0]){
try{keyTypeObject.wait();}
catch(InterruptedException e){break;}
}//end while(!keyTypeObject)
}//end sync(keyTypeObject)
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(dispatcher);
}//end waitForKeyTyped

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

public void uninstall() {
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this);
MapController mapCOntroller= modeController.getMapController();
mapController.removeNodeChangeListener(this);
mapController.removeNodeSelectionListener(this);
keyEventDispatcher = null;
}

代码示例来源:origin: raydac/netbeans-mmd-plugin

@Override
public void run() {
try {
window.dispose();
} finally {
tabPane.setComponentAt(tabIndex, selectedEditor.getContainerToShow());
device.setFullScreenWindow(null);
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(fullScreenEscCatcher);
}
}
})) {

代码示例来源:origin: es.gob.afirma/afirma-ui-core-jse-keystores

/** Muestra el diálogo de selección de certificados.
* @return Alias del certificado seleccionado o {@code null} si el usuario
* cancela el diálogo o cierra sin seleccionar. */
public String showDialog() {
final JDialog certDialog = this.optionPane.createDialog(
this.parent,
CertificateSelectionDialogMessages.getString("CertificateSelectionDialog.0") //$NON-NLS-1$
);
certDialog.setBackground(Color.WHITE);
certDialog.setModal(true);
certDialog.setAlwaysOnTop(true);
final KeyEventDispatcher dispatcher = new CertificateSelectionDispatcherListener(
this.optionPane,
this
);
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(dispatcher);
certDialog.setVisible(true);
if (this.optionPane.getValue() == null || ((Integer) this.optionPane.getValue()).intValue() != JOptionPane.OK_OPTION) {
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(dispatcher);
certDialog.dispose();
return null;
}
final String selectedAlias = this.csd.getSelectedCertificateAlias();
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(dispatcher);
certDialog.dispose();
return selectedAlias;
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

@Override
public void removeNotify() {
try {
// TODO: keep it here until all ui stuff is moved to uidelegate.
if (capsLockSupport)
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(capsOnListener);
Container c = getTLA();
if (c instanceof Window) {
Window w = (Window) c;
w.removeWindowFocusListener(capsOnWinListener );
w.removeWindowListener(capsOnWinListener );
}
} catch (Exception e) {
// bail out; probably running unsigned app distributed over web
}
super.removeNotify();
}

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

public void hide() {
if (_parent != null) {
_parent.requestFocus();
}
firePopupMenuWillBecomeInvisible();
if (_delegate != null) {
_delegate.setVisible(false);
}
if (_keyEventDispatcher != null) {
// JDK 1.3 Porting Hint
// Replace by AWTEventListener
// Toolkit.getDefaultToolkit().removeAWTEventListener(_keyEventDispatcher);
DefaultFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(_keyEventDispatcher);
_keyEventDispatcher = null;
}
releaseContainers();
disposeDelegate();
}

代码示例来源:origin: org.jdtaus.core/jdtaus-core-utilities

public void run()
{
if ( visible )
{
BlockingGlassPane.super.setVisible( true );
setCursor( getBlockingCursor() );
KeyboardFocusManager.getCurrentKeyboardFocusManager().
addKeyEventDispatcher( keyDispatcher );
}
else
{
KeyboardFocusManager.getCurrentKeyboardFocusManager().
removeKeyEventDispatcher( keyDispatcher );
setCursor( Cursor.getDefaultCursor() );
BlockingGlassPane.super.setVisible( false );
container.getContentPane().validate();
}
}
};

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

kfm.removeKeyEventDispatcher(ked);

推荐阅读
  • 本文详细介绍了 Java 中 org.apache.xmlbeans.SchemaType 类的 getBaseEnumType() 方法,提供了多个代码示例,并解释了其在不同场景下的使用方法。 ... [详细]
  • Scala 实现 UTF-8 编码属性文件读取与克隆
    本文介绍如何使用 Scala 以 UTF-8 编码方式读取属性文件,并实现属性文件的克隆功能。通过这种方式,可以确保配置文件在多线程环境下的一致性和高效性。 ... [详细]
  • 优化局域网SSH连接延迟问题的解决方案
    本文介绍了解决局域网内SSH连接到服务器时出现长时间等待问题的方法。通过调整配置和优化网络设置,可以显著缩短SSH连接的时间。 ... [详细]
  • andr ... [详细]
  • 本文详细探讨了JDBC(Java数据库连接)的内部机制,重点分析其作为服务提供者接口(SPI)框架的应用。通过类图和代码示例,展示了JDBC如何注册驱动程序、建立数据库连接以及执行SQL查询的过程。 ... [详细]
  • 毕业设计:基于机器学习与深度学习的垃圾邮件(短信)分类算法实现
    本文详细介绍了如何使用机器学习和深度学习技术对垃圾邮件和短信进行分类。内容涵盖从数据集介绍、预处理、特征提取到模型训练与评估的完整流程,并提供了具体的代码示例和实验结果。 ... [详细]
  • 深入解析 Apache Shiro 安全框架架构
    本文详细介绍了 Apache Shiro,一个强大且灵活的开源安全框架。Shiro 专注于简化身份验证、授权、会话管理和加密等复杂的安全操作,使开发者能够更轻松地保护应用程序。其核心目标是提供易于使用和理解的API,同时确保高度的安全性和灵活性。 ... [详细]
  • 本文详细介绍了 org.jdesktop.swingx.JXTitledPanel 类中的 setUI() 方法,探讨其功能、使用场景,并提供了多个实际代码示例。 ... [详细]
  • 本文探讨了在Java多线程环境下,如何确保具有相同key值的线程能够互斥执行并按顺序输出结果。通过优化代码结构和使用线程安全的数据结构,我们解决了线程同步问题,并实现了预期的并发行为。 ... [详细]
  • 获取计算机硬盘序列号的方法与实现
    本文介绍了如何通过编程方法获取计算机硬盘的唯一标识符(序列号),并提供了详细的代码示例和解释。此外,还涵盖了如何使用这些信息进行身份验证或注册保护。 ... [详细]
  • 本文介绍了两种方法,用于检测 Android 设备是否开启了开发者模式。第一种方法通过检查 USB 调试模式的状态,第二种方法则直接判断开发者选项是否启用。这两种方法均提供了代码示例和详细解释。 ... [详细]
  • 本文探讨了如何在 PHP 的 Eloquent ORM 中实现数据表之间的关联查询,并通过具体示例详细解释了如何将关联数据嵌入到查询结果中。这不仅提高了数据查询的效率,还简化了代码逻辑。 ... [详细]
  • 探讨了小型企业在构建安全网络和软件时所面临的挑战和机遇。本文介绍了如何通过合理的方法和工具,确保小型企业能够有效提升其软件的安全性,从而保护客户数据并增强市场竞争力。 ... [详细]
  • 谷粒商城统一返回对象R的泛型data获取异常及解决方案
    在实现过程中遇到空指针错误,经过定位发现远程调用后使用泛型的统一返回对象R无法正确获取data值。本文详细分析问题原因并提供解决方案。 ... [详细]
  • 在 Flutter 开发过程中,开发者经常会遇到 Widget 构造函数中的可选参数 Key。对于初学者来说,理解 Key 的作用和使用场景可能是一个挑战。本文将详细探讨 Key 的概念及其应用场景,并通过实例帮助你更好地掌握这一重要工具。 ... [详细]
author-avatar
mobiledu2502885853
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有