classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: focus fixlet for java.awt.Component


From: Roman Kennke
Subject: [cp-patches] FYI: focus fixlet for java.awt.Component
Date: Fri, 20 May 2005 16:14:49 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204

Hi,

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

2005-05-20  Roman Kennke  <address@hidden>

       * 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);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]