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