[kaffe] CVS kaffe (riccardo): changed getToolkit

Kaffe CVS cvs-commits at kaffe.org
Wed May 10 13:00:24 PDT 2006


PatchSet 7286 
Date: 2006/05/10 19:51:21
Author: riccardo
Branch: HEAD
Tag: (none) 
Log:
changed getToolkit

Members: 
	ChangeLog:1.4790->1.4791 
	libraries/javalib/awt-implementations/kaffe/java/awt/Component.java:1.10->1.11 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4790 kaffe/ChangeLog:1.4791
--- kaffe/ChangeLog:1.4790	Wed May 10 15:43:03 2006
+++ kaffe/ChangeLog	Wed May 10 19:51:21 2006
@@ -1,5 +1,10 @@
 2006-05-10  Riccardo Mottola <riccardo at kaffe.org>
 
+	* libraries/javalib/awt-implementations/kaffe/java/awt/Component.java:
+	changed getToolkit
+
+2006-05-10  Riccardo Mottola <riccardo at kaffe.org>
+
 	* libraries/javalib/awt-implementations/kaffe/java/awt/Component.java,
 	libraries/javalib/awt-implementations/kaffe/java/awt/FocusEvt.java,
 	libraries/javalib/awt-implementations/kaffe/java/awt/List.java,
Index: kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Component.java
diff -u kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Component.java:1.10 kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Component.java:1.11
--- kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Component.java:1.10	Wed May 10 15:43:09 2006
+++ kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Component.java	Wed May 10 19:51:22 2006
@@ -795,8 +795,24 @@
 	return null;
 }
 
-public Toolkit getToolkit () {
-	return Toolkit.singleton;
+/**
+* Returns the toolkit in use for this component. The toolkit is associated
+ * with the frame this component belongs to.
+ *
+ * @return the toolkit for this component
+ */
+public Toolkit getToolkit()
+{
+    if (peer != null)
+    {
+        Toolkit tk = peer.getToolkit();
+        if (tk != null)
+            return tk;
+    }
+    // Get toolkit for lightweight component.
+    if (parent != null)
+        return parent.getToolkit();
+    return Toolkit.getDefaultToolkit();
 }
 
 Component getToplevel () {




More information about the kaffe mailing list