/[classpath]/classpath/java/awt/Component.java
ViewVC logotype

Diff of /classpath/java/awt/Component.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.39 by mark, Sun Aug 8 13:01:35 2004 UTC revision 1.40 by mark, Sat Sep 4 17:14:00 2004 UTC
# Line 58  import java.awt.event.MouseMotionListene Line 58  import java.awt.event.MouseMotionListene
58  import java.awt.event.MouseWheelListener;  import java.awt.event.MouseWheelListener;
59  import java.awt.event.MouseWheelEvent;  import java.awt.event.MouseWheelEvent;
60  import java.awt.event.PaintEvent;  import java.awt.event.PaintEvent;
61    import java.awt.event.WindowEvent;
62  import java.awt.im.InputContext;  import java.awt.im.InputContext;
63  import java.awt.im.InputMethodRequests;  import java.awt.im.InputMethodRequests;
64  import java.awt.image.BufferStrategy;  import java.awt.image.BufferStrategy;
# Line 3432  public abstract class Component Line 3433  public abstract class Component
3433     */     */
3434    public boolean isFocusTraversable()    public boolean isFocusTraversable()
3435    {    {
3436      return enabled && visible && (peer == null || peer.isFocusTraversable());      return enabled && visible && (peer == null || isLightweight() || peer.isFocusTraversable());
3437    }    }
3438    
3439    /**    /**
# Line 3447  public abstract class Component Line 3448  public abstract class Component
3448    }    }
3449    
3450    /**    /**
3451     * Specify whether this component can receive focus.     * Specify whether this component can receive focus. This method also
3452       * sets the {@link #isFocusTraversableOverridden} field to 1, which
3453       * appears to be the undocumented way {@link
3454       * DefaultFocusTraversalPolicy#accept()} determines whether to respect
3455       * the {@link #isFocusable()} method of the component.
3456     *     *
3457     * @param focusable the new focusable status     * @param focusable the new focusable status
3458     * @since 1.4     * @since 1.4
# Line 3456  public abstract class Component Line 3461  public abstract class Component
3461    {    {
3462      firePropertyChange("focusable", this.focusable, focusable);      firePropertyChange("focusable", this.focusable, focusable);
3463      this.focusable = focusable;      this.focusable = focusable;
3464        this.isFocusTraversableOverridden = 1;
3465    }    }
3466    
3467    /**    /**
# Line 3714  public abstract class Component Line 3720  public abstract class Component
3720              Window toplevel = (Window) parent;              Window toplevel = (Window) parent;
3721              if (toplevel.isFocusableWindow ())              if (toplevel.isFocusableWindow ())
3722                {                {
3723                  if (peer != null)                  if (peer != null && !isLightweight())
3724                    // This call will cause a FOCUS_GAINED event to be                    // This call will cause a FOCUS_GAINED event to be
3725                    // posted to the system event queue if the native                    // posted to the system event queue if the native
3726                    // windowing system grants the focus request.                    // windowing system grants the focus request.
# Line 3800  public abstract class Component Line 3806  public abstract class Component
3806              Window toplevel = (Window) parent;              Window toplevel = (Window) parent;
3807              if (toplevel.isFocusableWindow ())              if (toplevel.isFocusableWindow ())
3808                {                {
3809                  if (peer != null)                  if (peer != null && !isLightweight())
3810                    // This call will cause a FOCUS_GAINED event to be                    // This call will cause a FOCUS_GAINED event to be
3811                    // posted to the system event queue if the native                    // posted to the system event queue if the native
3812                    // windowing system grants the focus request.                    // windowing system grants the focus request.
# Line 3921  public abstract class Component Line 3927  public abstract class Component
3927                  if (focusedWindow == toplevel)                  if (focusedWindow == toplevel)
3928                    {                    {
3929                      if (peer != null                      if (peer != null
3930                            && !isLightweight()
3931                          && !(this instanceof Window))                          && !(this instanceof Window))
3932                        // This call will cause a FOCUS_GAINED event to be                        // This call will cause a FOCUS_GAINED event to be
3933                        // posted to the system event queue if the native                        // posted to the system event queue if the native
# Line 4690  p   * <li>the set of backward traversal Line 4697  p   * <li>the set of backward traversal
4697     *     *
4698     * @param e the event to dispatch     * @param e the event to dispatch
4699     */     */
4700    
4701    void dispatchEventImpl (AWTEvent e)    void dispatchEventImpl (AWTEvent e)
4702    {    {
4703      Event oldEvent = translateEvent (e);      Event oldEvent = translateEvent (e);
# Line 4698  p   * <li>the set of backward traversal Line 4706  p   * <li>the set of backward traversal
4706        postEvent (oldEvent);        postEvent (oldEvent);
4707    
4708      if (eventTypeEnabled (e.id))      if (eventTypeEnabled (e.id))
4709          {
4710            // the trick we use to communicate between dispatch and redispatch
4711            // is to have KeyboardFocusManager.redispatch synchronize on the
4712            // object itself. we then do not redispatch to KeyboardFocusManager
4713            // if we are already holding the lock.
4714            if (! Thread.holdsLock(e))
4715              {
4716                switch (e.id)
4717                  {
4718                  case WindowEvent.WINDOW_GAINED_FOCUS:
4719                  case WindowEvent.WINDOW_LOST_FOCUS:
4720                  case KeyEvent.KEY_PRESSED:
4721                  case KeyEvent.KEY_RELEASED:
4722                  case KeyEvent.KEY_TYPED:
4723                  case FocusEvent.FOCUS_GAINED:
4724                  case FocusEvent.FOCUS_LOST:
4725                    if (KeyboardFocusManager
4726                        .getCurrentKeyboardFocusManager()
4727                        .dispatchEvent(e))
4728                        return;
4729                  }
4730              }
4731        processEvent (e);        processEvent (e);
4732    }    }
4733      }
4734    
4735    /**    /**
4736     * Tells whether or not an event type is enabled.     * Tells whether or not an event type is enabled.

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26