diff options
author | Wolfgang Baer <WBaer@gmx.de> | 2006-02-21 15:20:56 +0000 |
---|---|---|
committer | Wolfgang Baer <WBaer@gmx.de> | 2006-02-21 15:20:56 +0000 |
commit | 6d283b7d69654fe618cea58e2b02479c2437bf6f (patch) | |
tree | b95570c89f12cd93294482850163807ba5c11388 | |
parent | 3a0d5b675fd491b85806c9155ad46e01817a24cc (diff) | |
download | classpath-6d283b7d69654fe618cea58e2b02479c2437bf6f.tar.gz |
2006-02-21 Wolfgang Baer <WBaer@gmx.de>
* java/awt/CardLayout.java:
(first): Updated api documentation.
(last): Likewise.
(next): Likewise.
(previous): Likewise.
(show): Clarified api docs. Return if name is null. Throw
IllegalArgumentException if layout of container is not this.
(gotoComponent): Updated api documentation. Throw
IllegalArgumentException if layout of container is not this.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | java/awt/CardLayout.java | 26 |
2 files changed, 31 insertions, 7 deletions
@@ -1,3 +1,15 @@ +2006-02-21 Wolfgang Baer <WBaer@gmx.de> + + * java/awt/CardLayout.java: + (first): Updated api documentation. + (last): Likewise. + (next): Likewise. + (previous): Likewise. + (show): Clarified api docs. Return if name is null. Throw + IllegalArgumentException if layout of container is not this. + (gotoComponent): Updated api documentation. Throw + IllegalArgumentException if layout of container is not this. + 2006-02-21 Roman Kennke <kennke@aicas.com> * javax/swing/text/NavigationFilter.java diff --git a/java/awt/CardLayout.java b/java/awt/CardLayout.java index 8582c5f09..8b3fea2ca 100644 --- a/java/awt/CardLayout.java +++ b/java/awt/CardLayout.java @@ -117,7 +117,7 @@ public class CardLayout implements LayoutManager2, Serializable /** * Cause the first component in the container to be displayed. * - * @param parent The parent container + * @param parent The parent container, not <code>null</code>. */ public void first (Container parent) { @@ -181,7 +181,7 @@ public class CardLayout implements LayoutManager2, Serializable /** * Cause the last component in the container to be displayed. * - * @param parent The parent container + * @param parent The parent container, not <code>null</code>. */ public void last (Container parent) { @@ -247,7 +247,7 @@ public class CardLayout implements LayoutManager2, Serializable * this current card is the last one in the deck, the first * component is displayed. * - * @param parent The parent container + * @param parent The parent container, not <code>null</code>. */ public void next (Container parent) { @@ -271,7 +271,7 @@ public class CardLayout implements LayoutManager2, Serializable * If this current card is the first one in the deck, the last * component is displayed. * - * @param parent The parent container + * @param parent The parent container, not <code>null</code>. */ public void previous (Container parent) { @@ -321,13 +321,19 @@ public class CardLayout implements LayoutManager2, Serializable /** * Cause the named component to be shown. If the component name is - * unknown, this method does nothing. + * unknown or <code>null</code>, this method does nothing. * - * @param parent The parent container - * @param name The name of the component to show + * @param parent The parent container, not <code>null</code>. + * @param name The name of the component to show */ public void show (Container parent, String name) { + if (name == null) + return; + + if (parent.getLayout() != this) + throw new IllegalArgumentException("parent's layout is not this CardLayout"); + Object target = tab.get (name); if (target != null) { @@ -362,9 +368,15 @@ public class CardLayout implements LayoutManager2, Serializable * * @param parent The parent container * @param what The type of goto: FIRST, LAST, NEXT or PREV + * + * @throws IllegalArgumentException if parent has not this + * CardLayout set as its layout. */ private void gotoComponent (Container parent, int what) { + if (parent.getLayout() != this) + throw new IllegalArgumentException("parent's layout is not this CardLayout"); + synchronized (parent.getTreeLock ()) { int num = parent.ncomponents; |