Hi,

I committed the attached patch which enables lightweight components to receive focus through mouse clicks.

2005-05-20  Roman Kennke  <[EMAIL PROTECTED]>

       * java/awt/Component.java
       (dispatchEventImpl): Let MouseEvents trigger a focus change
       on lightweight components.


/Roman

Index: java/awt/Component.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.56
diff -u -r1.56 Component.java
--- java/awt/Component.java     18 May 2005 15:03:53 -0000      1.56
+++ java/awt/Component.java     20 May 2005 14:12:06 -0000
@@ -1149,7 +1149,9 @@
   public Point getLocationOnScreen()
   {
     if (! isShowing())
-      throw new IllegalComponentStateException("component not showing");
+      throw new IllegalComponentStateException("component "
+                                               + getClass().getName()
+                                               + " not showing");
     // We know peer != null here.
     return peer.getLocationOnScreen();
   }
@@ -4762,6 +4764,10 @@
                     .getCurrentKeyboardFocusManager()
                     .dispatchEvent(e))
                     return;
+              case MouseEvent.MOUSE_PRESSED:
+                if (isLightweight())
+                  requestFocus();
+                break;
               }
           }
         processEvent (e);
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to