Package java.awt.event

Examples of java.awt.event.FocusEvent


                    new HeavyweightFocusRequest(heavyweight, descendant,
                                                temporary, cause);
                heavyweightRequests.add(hwFocusRequest);

                if (currentFocusOwner != null) {
                    FocusEvent currentFocusOwnerEvent =
                        new CausedFocusEvent(currentFocusOwner,
                                       FocusEvent.FOCUS_LOST,
                                       temporary, descendant, cause);
                    // Fix 5028014. Rolled out.
                    // SunToolkit.postPriorityEvent(currentFocusOwnerEvent);
                    SunToolkit.postEvent(currentFocusOwner.appContext,
                                         currentFocusOwnerEvent);
                }
                FocusEvent newFocusOwnerEvent =
                    new CausedFocusEvent(descendant, FocusEvent.FOCUS_GAINED,
                                   temporary, currentFocusOwner, cause);
                // Fix 5028014. Rolled out.
                // SunToolkit.postPriorityEvent(newFocusOwnerEvent);
                SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent);
View Full Code Here


                     */
                    if (!iter.hasNext()) {
                        disableRestoreFocus = false;
                    }

                    FocusEvent currentFocusOwnerEvent = null;
                    /*
                     * We're not dispatching FOCUS_LOST while the current focus owner is null.
                     * But regardless of whether it's null or not, we're clearing ALL the local
                     * lw requests.
                     */
                    if (currentFocusOwner != null) {
                        currentFocusOwnerEvent = new CausedFocusEvent(currentFocusOwner,
                                       FocusEvent.FOCUS_LOST,
                                       lwFocusRequest.temporary,
                                       lwFocusRequest.component, lwFocusRequest.cause);
                    }
                    FocusEvent newFocusOwnerEvent =
                        new CausedFocusEvent(lwFocusRequest.component,
                                       FocusEvent.FOCUS_GAINED,
                                       lwFocusRequest.temporary,
                                       currentFocusOwner == null ? lastFocusOwner : currentFocusOwner,
                                       lwFocusRequest.cause);
View Full Code Here

             * Fix for 4472032
             */
            if (newFocusOwner != null &&
                event.getID() == FocusEvent.FOCUS_LOST)
            {
                FocusEvent fe = (FocusEvent)event;

                if (manager.getGlobalFocusOwner() == fe.getComponent() &&
                    fe.getOppositeComponent() == newFocusOwner)
                {
                    newFocusOwner = null;
                    return event;
                }
            }
View Full Code Here

        };

        autoSelector = new TextAutoSelector() {

            public void eventDispatched(AWTEvent event) {
                FocusEvent fe = (FocusEvent) event;
                if (fe.getComponent() instanceof JTextField
                        && fe.getID() == FocusEvent.FOCUS_GAINED
                        && fe.getComponent().isEnabled()
                        && ((JTextField)fe.getComponent()).isEditable()){
                    ((JTextField)fe.getComponent()).selectAll();
                }
            }
        };

        EventQueue.invokeLater(new Runnable() {
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

   */
  public void firePluginFocusGained()
  {
    if (listenerSupport != null && listenerSupport.containsListeners(FocusListener.class))
    {
      listenerSupport.fireFocusGained(new FocusEvent(getPluginComponent(), FocusEvent.FOCUS_GAINED));
    }
  }
View Full Code Here

   */
  public void firePluginFocusLost()
  {
    if (listenerSupport != null && listenerSupport.containsListeners(FocusListener.class))
    {
      listenerSupport.fireFocusLost(new FocusEvent(getPluginComponent(), FocusEvent.FOCUS_LOST));
    }
  }
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.