Package java.awt

Examples of java.awt.Window.addWindowFocusListener()


                : ((initialFocusComponent instanceof JComponent)
                        ? (JComponent)initialFocusComponent : null);
        if (focusOwner != null) {
            Window w = SwingUtilities.getWindowAncestor(focusOwner);
            if (w != null) {
                w.addWindowFocusListener(new WindowFocusGainedListener(focusOwner));
            }
        }
    }

    public boolean containsCustomComponents(final JOptionPane op) {
View Full Code Here


        final Component component = event.getComponent();
        final Window windowAncestor = SwingUtilities.getWindowAncestor(component);
        if(windowAncestor.isFocused())
          editor.focusInputField(true);
        else{
          windowAncestor.addWindowFocusListener(new WindowFocusListener() {
            public void windowLostFocus(WindowEvent e) {
            }
           
            public void windowGainedFocus(WindowEvent e) {
              windowAncestor.removeWindowFocusListener(this);
View Full Code Here

  private void restoreFocusToMainView() {
    final Window windowAncestor = SwingUtilities.getWindowAncestor(mainView);
    if(windowAncestor.isFocused())
      mainView.requestFocusInWindow();
    else
      windowAncestor.addWindowFocusListener(new WindowFocusListener() {
        public void windowLostFocus(WindowEvent e) {
        }

        public void windowGainedFocus(WindowEvent e) {
          mainView.requestFocusInWindow();
View Full Code Here

            KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(
                    capsOnListener);
            Container c = getTLA();
            if (c instanceof Window) {
                Window w = (Window) c;
                w.addWindowFocusListener(capsOnWinListener );
                w.addWindowListener(capsOnWinListener);
            }
        } catch (Exception e) {
            // probably unsigned app over web, disable capslock support and bail out
            capsLockSupport = false;
View Full Code Here

                public void windowGainedFocus(WindowEvent we) {
                    System.out.println(we);
                    throw new RuntimeException("owner frame must not receive WINDWO_GAINED_FOCUS");
                }
            });
        window.addWindowFocusListener(new WindowFocusListener() {
                public void windowLostFocus(WindowEvent we) {
                    System.out.println(we);
                }
                public void windowGainedFocus(WindowEvent we) {
                    System.out.println(we);
View Full Code Here

                : ((initialFocusComponent instanceof JComponent)
                        ? (JComponent)initialFocusComponent : null);
        if (focusOwner != null) {
            Window w = SwingUtilities.getWindowAncestor(focusOwner);
            if (w != null) {
                w.addWindowFocusListener(new WindowFocusGainedListener(focusOwner));
            }
        }
    }

    public boolean containsCustomComponents(final JOptionPane op) {
View Full Code Here

                : ((initialFocusComponent instanceof JComponent)
                        ? (JComponent)initialFocusComponent : null);
        if (focusOwner != null) {
            Window w = SwingUtilities.getWindowAncestor(focusOwner);
            if (w != null) {
                w.addWindowFocusListener(new WindowFocusGainedListener(focusOwner));
            }
        }
    }

    public boolean containsCustomComponents(final JOptionPane op) {
View Full Code Here

                : ((initialFocusComponent instanceof JComponent)
                        ? (JComponent)initialFocusComponent : null);
        if (focusOwner != null) {
            Window w = SwingUtilities.getWindowAncestor(focusOwner);
            if (w != null) {
                w.addWindowFocusListener(new WindowFocusGainedListener(focusOwner));
            }
        }
    }

    public boolean containsCustomComponents(final JOptionPane op) {
View Full Code Here

        }
      });

      // If anything happens to the "parent" window, hide this popup
      Window parent = (Window)getParent();
      parent.addWindowFocusListener(this);
      parent.addWindowListener(this);
      parent.addComponentListener(this);

    }
View Full Code Here

                pField.addHierarchyListener(new HierarchyListener() {
                    public void hierarchyChanged(HierarchyEvent e) {
                        final Component c = e.getComponent();
                        if (c.isShowing() && (e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
                            Window toplevel = SwingUtilities.getWindowAncestor(c);
                            toplevel.addWindowFocusListener(new WindowAdapter() {
                                @Override
                                public void windowGainedFocus(WindowEvent e) {
                                    c.requestFocus();
                                }
                            });
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.