diff options
author | Roman Kennke <roman@kennke.org> | 2005-07-01 10:35:58 +0000 |
---|---|---|
committer | Roman Kennke <roman@kennke.org> | 2005-07-01 10:35:58 +0000 |
commit | 3f85a10e0abec9a02c814f051f4498641f69acf6 (patch) | |
tree | 3955162c16239b9aab0c666aa5fd992a6ca1bca0 | |
parent | 2e1448ce07d2d45248b196dcdeb1d1e4a39ee21f (diff) | |
download | classpath-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-- | ChangeLog | 6 | ||||
-rw-r--r-- | javax/swing/JLayeredPane.java | 15 |
2 files changed, 18 insertions, 3 deletions
@@ -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(); } /** |