Package java.awt.event

Examples of java.awt.event.FocusEvent


        case SWT.Activate:
          EventQueue.invokeLater(new Runnable () {
            public void run () {
              if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 4, 0)) {
                frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_ACTIVATED));
                frame.dispatchEvent (new FocusEvent (frame, FocusEvent.FOCUS_GAINED));
              } else {
                frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_ACTIVATED));
                frame.dispatchEvent (new WindowEvent (frame, 207 /*WindowEvent.WINDOW_GAINED_FOCUS*/));
              }
            }
          });
          break;
        case SWT.Deactivate:
          EventQueue.invokeLater(new Runnable () {
            public void run () {
              if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 4, 0)) {
                frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_DEACTIVATED));
                frame.dispatchEvent (new FocusEvent (frame, FocusEvent.FOCUS_LOST));
              } else {
                frame.dispatchEvent (new WindowEvent (frame, 208 /*WindowEvent.WINDOW_LOST_FOCUS*/));
                frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_DEACTIVATED));
              }
            }
View Full Code Here


            if ( comp == desktop ) {
                comp = null;
            }
            if ( oldFocusOwner != comp ) {
                if ( oldFocusOwner != null ) {
                    dispatchEvent( oldFocusOwner, new FocusEvent( oldFocusOwner,
                            FocusEvent.FOCUS_LOST, false, comp ) );
                }
                KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
                if ( comp != null ) {
                    dispatchEvent( comp, new FocusEvent( comp,
                            FocusEvent.FOCUS_GAINED, false, oldFocusOwner ) );
                }
            }
            awtWindow.setFocusableWindowState( false );
        }
View Full Code Here

    throw new UnsupportedOperationException("assertIconEquals is not supported for JTextComponent components");
  }

  public void focusLost() {
    for (FocusListener listener : jTextComponent.getFocusListeners()) {
      listener.focusLost(new FocusEvent(jTextComponent, 0));
    }
  }
View Full Code Here

    };
  }

  public void focusLost() {
    for (FocusListener listener : jLabel.getFocusListeners()) {
      listener.focusLost(new FocusEvent(jLabel, 0));
    }
  }
View Full Code Here

        case SWT.Activate:
          EventQueue.invokeLater(new Runnable () {
            public void run () {
              if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 4, 0)) {
                frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_ACTIVATED));
                frame.dispatchEvent (new FocusEvent (frame, FocusEvent.FOCUS_GAINED));
              } else if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 5, 0)) {
                frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_ACTIVATED));
                frame.dispatchEvent (new WindowEvent (frame, 207 /*WindowEvent.WINDOW_GAINED_FOCUS*/));
              } else {
                if (frame.isActive()) return;
                try {
                  Class clazz = frame.getClass();
                  Method method = clazz.getMethod("synthesizeWindowActivation", new Class[]{boolean.class});
                  if (method != null) method.invoke(frame, new Object[]{new Boolean(true)});
                } catch (Throwable e) {}
              }
            }
          });
          break;
        case SWT.Deactivate:
          EventQueue.invokeLater(new Runnable () {
            public void run () {
              if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 4, 0)) {
                frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_DEACTIVATED));
                frame.dispatchEvent (new FocusEvent (frame, FocusEvent.FOCUS_LOST));
              } else if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 5, 0)) {
                frame.dispatchEvent (new WindowEvent (frame, 208 /*WindowEvent.WINDOW_LOST_FOCUS*/));
                frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_DEACTIVATED));
              } else {
                if (!frame.isActive()) return;
View Full Code Here

        case SWT.Activate:
          EventQueue.invokeLater(new Runnable () {
            public void run () {
              if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 4, 0)) {
                frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_ACTIVATED));
                frame.dispatchEvent (new FocusEvent (frame, FocusEvent.FOCUS_GAINED));
              } else if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 5, 0)) {
                frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_ACTIVATED));
                frame.dispatchEvent (new WindowEvent (frame, 207 /*WindowEvent.WINDOW_GAINED_FOCUS*/));
              } else {
                try {
                  /* Initialize the default focus traversal policy */
                  Class clazz = frame.getClass();
                  Method method = clazz.getMethod("synthesizeWindowActivation", new Class[]{boolean.class});
                  if (method != null) method.invoke(frame, new Object[]{new Boolean(true)});
                } catch (Throwable e) {}
              }
            }
          });
          break;
        case SWT.Deactivate:
          EventQueue.invokeLater(new Runnable () {
            public void run () {
              if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 4, 0)) {
                frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_DEACTIVATED));
                frame.dispatchEvent (new FocusEvent (frame, FocusEvent.FOCUS_LOST));
              } else if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 5, 0)) {
                frame.dispatchEvent (new WindowEvent (frame, 208 /*WindowEvent.WINDOW_LOST_FOCUS*/));
                frame.dispatchEvent (new WindowEvent (frame, WindowEvent.WINDOW_DEACTIVATED));
              } else {
                try {
View Full Code Here

            Component focusOwner = activeWindow.getFocusOwner();
            if (focusLog.isLoggable(Level.FINE)) focusLog.fine("Clearing global focus owner " + focusOwner);
            if (focusOwner != null) {
                XComponentPeer nativePeer = XComponentPeer.getNativeContainer(focusOwner);
                if (nativePeer != null) {
                    FocusEvent fl = new CausedFocusEvent(focusOwner, FocusEvent.FOCUS_LOST, false, null,
                                                         CausedFocusEvent.Cause.CLEAR_GLOBAL_FOCUS_OWNER);
                    XWindow.sendEvent(fl);
                }
            }
        }
View Full Code Here

        Component currentOwner = XKeyboardFocusManagerPeer.getCurrentNativeFocusOwner();
        if (currentOwner != null && currentOwner.getPeer() == null) {
            currentOwner = null;
        }
        if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Simulating transfer from " + currentOwner + " to " + lightweightChild);
        FocusEvent  fg = new CausedFocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED, false, currentOwner, cause);
        FocusEvent fl = null;
        if (currentOwner != null) {
            fl = new CausedFocusEvent(currentOwner, FocusEvent.FOCUS_LOST, false, lightweightChild, cause);
        }

        if (fl != null) {
View Full Code Here

        }


        void forwardFocusGained( FocusEvent e) {
            isFocused = true;
            FocusEvent fe = CausedFocusEvent.retarget(e, this);
            super.processFocusEvent(fe);

        }
View Full Code Here

        }


        void forwardFocusLost( FocusEvent e) {
            isFocused = false;
            FocusEvent fe = CausedFocusEvent.retarget(e, this);
            super.processFocusEvent(fe);

        }
View Full Code Here

TOP

Related Classes of java.awt.event.FocusEvent

Copyright © 2018 www.massapicom. 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.