@Override public void run() { SwingUtilities.getWindowAncestor(ZoomableView.this).addWindowFocusListener(fh); } });
Listener() { addWindowFocusListener(this); // If anything happens to the "parent" window, hide this popup Window parent = (Window)getParent(); parent.addWindowFocusListener(this); parent.addWindowListener(this); parent.addComponentListener(this); }
Listener() { addWindowFocusListener(this); list.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount()==2) { insertSelectedItem(); } } }); list.getInputMap().put( KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "onEnter"); list.getActionMap().put("onEnter", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { insertSelectedItem(); } }); // If anything happens to the "parent" window, hide this popup Window parent = (Window)getParent(); parent.addWindowFocusListener(this); parent.addWindowListener(this); parent.addComponentListener(this); }
this.setLocationRelativeTo(owner); this.setAlwaysOnTop(true); this.addWindowFocusListener(new WindowFocusListener() {
/** * Makes the given component grab the keyboard focus whenever the window gains * the focus. */ private void setDefaultFocusComponent(final Window w, final Component c) { w.addWindowFocusListener(new WindowAdapter() { @Override public void windowGainedFocus(final WindowEvent e) { c.requestFocusInWindow(); } }); }
public void addWindow(Window window) { window.addWindowFocusListener(focusHandler); windows.put(window, null); } public void removeWindow(Window window) {
public void addPalette(Window palette) { palette.addWindowFocusListener(focusHandler); palettes.add(palette); }
public void windowGainedFocus(WindowEvent e) { frame.addWindowFocusListener(new WindowFocusListener() { public void windowLostFocus(WindowEvent e) { } public void windowGainedFocus(WindowEvent e) { d.setVisible(false); frame.removeWindowFocusListener(this); } }); d.removeWindowFocusListener(this); } });
public void trackWindowForComponent(Component c){ final Window windowToTrack = SwingUtilities.getWindowAncestor(c); if(windowToTrack.equals(trackedWindow)) return; if(trackedWindow != null) trackedWindow.removeWindowFocusListener(this); trackedWindow = windowToTrack; trackedWindow.addWindowFocusListener(this); mousePositionAfterFocusGained = null; }
public void ancestorAdded (AncestorEvent e) { gainedFocus(); if (_window == null) { _window = SwingUtilities.getWindowAncestor(_target); _window.addWindowFocusListener(this); } }
public void ancestorAdded (AncestorEvent e) { gainedFocus(); if (_window == null) { _window = SwingUtilities.getWindowAncestor(_target); _window.addWindowFocusListener(this); } }
public void add(Window window, @Nullable View view) { window.addWindowFocusListener(focusHandler); windows.put(window, view); }
public void addTo(Window w) { w.addComponentListener(this); w.addWindowFocusListener(this); }
public void add( Window window ){ if( monitored.add( window ) ){ window.addWindowFocusListener( listener ); if( window.isActive() ){ current = window; fireWindowChanged( window ); history.add( current ); } else{ history.add( 0, window ); } } }
public void add( Window window ){ if( monitored.add( window ) ){ window.addWindowFocusListener( listener ); if( window.isActive() ){ current = window; fireWindowChanged( window ); history.add( current ); } else{ history.add( 0, window ); } } }
private void restoreFocusToMainView() { final Window windowAncestor = SwingUtilities.getWindowAncestor(mainView); if(windowAncestor.isFocused()) mainView.requestFocusInWindow(); else windowAncestor.addWindowFocusListener(new WindowFocusListener() { @Override public void windowLostFocus(WindowEvent e) { } @Override public void windowGainedFocus(WindowEvent e) { mainView.requestFocusInWindow(); windowAncestor.removeWindowFocusListener(this); } }); }
/** * Constructs a key dispatcher. */ public KeyDispatcher (Window window) { // save things off _window = window; // listen to window events on our main window so that we can release // keys when the mouse leaves the window _window.addWindowFocusListener(this); // monitor key events from the central dispatch mechanism KeyboardFocusManager.getCurrentKeyboardFocusManager(). addKeyEventDispatcher(this); }
/** * Constructs a key dispatcher. */ public KeyDispatcher (Window window) { // save things off _window = window; // listen to window events on our main window so that we can release // keys when the mouse leaves the window _window.addWindowFocusListener(this); // monitor key events from the central dispatch mechanism KeyboardFocusManager.getCurrentKeyboardFocusManager(). addKeyEventDispatcher(this); }
Listener() { addWindowFocusListener(this); // If anything happens to the "parent" window, hide this popup Window parent = (Window)getParent(); parent.addWindowFocusListener(this); parent.addWindowListener(this); parent.addComponentListener(this); }
public static void createWindowFocusListeners(ActionContext actionContext){ Thing self = (Thing) actionContext.get("self"); Window parent = (Window) actionContext.get("parent"); for(Thing child : self.getChilds()){ WindowFocusListener l = (WindowFocusListener) child.doAction("create", actionContext); if(l != null){ parent.addWindowFocusListener(l); } } }