summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2005-07-01 10:35:58 +0000
committerRoman Kennke <roman@kennke.org>2005-07-01 10:35:58 +0000
commit3f85a10e0abec9a02c814f051f4498641f69acf6 (patch)
tree3955162c16239b9aab0c666aa5fd992a6ca1bca0
parent2e1448ce07d2d45248b196dcdeb1d1e4a39ee21f (diff)
downloadclasspath-3f85a10e0abec9a02c814f051f4498641f69acf6.tar.gz
2005-07-01 Roman Kennke <roman@kennke.org>
* javax/swing/JLayeredPane.java (getLayer): Also search through the components parents to find the one that is actually directly contained in the JLayeredPane.
-rw-r--r--ChangeLog6
-rw-r--r--javax/swing/JLayeredPane.java15
2 files changed, 18 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 00aeb5469..029d2de1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-07-01 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JLayeredPane.java
+ (getLayer): Also search through the components parents to find
+ the one that is actually directly contained in the JLayeredPane.
+
2005-07-01 David Gilbert <david.gilbert@object-refinery.com>
* java/awt/image/DataBuffer.java: fixed API doc typos;
diff --git a/javax/swing/JLayeredPane.java b/javax/swing/JLayeredPane.java
index f07d36e99..1c64b0053 100644
--- a/javax/swing/JLayeredPane.java
+++ b/javax/swing/JLayeredPane.java
@@ -124,9 +124,18 @@ public class JLayeredPane extends JComponent implements Accessible
*/
public int getLayer(Component c)
{
- if (! componentToLayer.containsKey (c))
- throw new IllegalArgumentException ();
- return ((Integer) componentToLayer.get(c)).intValue();
+ Component myComp = c;
+ while(! componentToLayer.containsKey(myComp))
+ {
+ myComp = myComp.getParent();
+ if (myComp == null)
+ break;
+ }
+ if (myComp == null)
+ throw new IllegalArgumentException
+ ("component is not in this JLayeredPane");
+ Integer layerObj = (Integer) componentToLayer.get(myComp);
+ return layerObj.intValue();
}
/**