summaryrefslogtreecommitdiff
path: root/libjava/java/awt/Choice.java
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2003-01-02 00:14:24 +0000
committerTom Tromey <tromey@gcc.gnu.org>2003-01-02 00:14:24 +0000
commit62d2eed656d2b664b21f128afbdc27720fb3939f (patch)
tree16e5e7e16e0e667ba0696007d49bc3344f03cb6c /libjava/java/awt/Choice.java
parent3c32ae1c35f838a0d4ef571656b5427ade5c861d (diff)
downloadgcc-62d2eed656d2b664b21f128afbdc27720fb3939f.tar.gz
Makefile.in: Rebuilt.
* Makefile.in: Rebuilt. * Makefile.am (rmi_java_source_files): Added RMIClassLoaderSpi. * java/awt/AlphaComposite.java, java/awt/BasicStroke.java, java/awt/BufferCapabilities.java, java/awt/Button.java, java/awt/CheckboxMenuItem.java, java/awt/Choice.java, java/awt/Container.java, java/awt/Cursor.java, java/awt/EventQueue.java, java/awt/FileDialog.java, java/awt/Graphics2D.java, java/awt/Label.java, java/awt/Menu.java, java/awt/MenuBar.java, java/awt/MenuComponent.java, java/awt/PopupMenu.java, java/awt/ScrollPane.java, java/awt/Scrollbar.java, java/awt/TextArea.java, java/awt/TextField.java, java/awt/color/CMMException.java, java/awt/color/ColorSpace.java, java/awt/color/ICC_Profile.java, java/awt/color/ProfileDataException.java, java/awt/datatransfer/Clipboard.java, java/awt/datatransfer/DataFlavor.java, java/awt/datatransfer/FlavorMap.java, java/awt/datatransfer/SystemFlavorMap.java, java/awt/dnd/DragGestureEvent.java, java/awt/dnd/DragGestureRecognizer.java, java/awt/dnd/DragSource.java, java/awt/dnd/DropTarget.java, java/awt/event/WindowEvent.java, java/awt/geom/PathIterator.java, java/awt/im/InputMethodHighlight.java, java/io/PipedOutputStream.java, java/io/PipedWriter.java, java/rmi/server/RMIClassLoader.java: Merged from Classpath. * gnu/awt/j2d/Graphics2DImpl.java (drawImage): Changed type of `op' to BufferedImageOp. From-SVN: r60768
Diffstat (limited to 'libjava/java/awt/Choice.java')
-rw-r--r--libjava/java/awt/Choice.java34
1 files changed, 26 insertions, 8 deletions
diff --git a/libjava/java/awt/Choice.java b/libjava/java/awt/Choice.java
index 81a2a31c932..4c7b505535c 100644
--- a/libjava/java/awt/Choice.java
+++ b/libjava/java/awt/Choice.java
@@ -85,13 +85,17 @@ private ItemListener item_listeners;
* Constructors
*/
-/**
- * Initializes a new instance of <code>Choice</code>.
- */
-public
-Choice()
-{
-}
+ /**
+ * Initializes a new instance of <code>Choice</code>.
+ *
+ * @exception HeadlessException If GraphicsEnvironment.isHeadless()
+ * returns true
+ */
+ public Choice()
+ {
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException ();
+ }
/*************************************************************************/
@@ -146,12 +150,16 @@ getItem(int index)
* Adds the specified item to this choice box.
*
* @param item The item to add.
+ *
+ * @exception NullPointerException If the item's value is null
+ *
+ * @since 1.1
*/
public synchronized void
add(String item)
{
if (item == null)
- throw new IllegalArgumentException ("item must be non-null");
+ throw new NullPointerException ("item must be non-null");
pItems.addElement(item);
@@ -171,7 +179,12 @@ add(String item)
/**
* Adds the specified item to this choice box.
*
+ * This method is oboslete since Java 2 platform 1.1. Please use @see add
+ * instead.
+ *
* @param item The item to add.
+ *
+ * @exception NullPointerException If the item's value is equal to null
*/
public synchronized void
addItem(String item)
@@ -189,10 +202,15 @@ addItem(String item)
*
* @param item The item to add.
* @param index The index at which the item should be inserted.
+ *
+ * @exception IllegalArgumentException If index is less than 0
*/
public synchronized void
insert(String item, int index)
{
+ if (index < 0)
+ throw new IllegalArgumentException ("index may not be less then 0");
+
if (index > getItemCount ())
index = getItemCount ();