aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-22 22:03:04 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-22 22:03:04 +0000
commit720240645766dc1dbedb246c910be6966a1fe27a (patch)
tree317e29ad09d5c7d11f21d6999c1e4c2d70eb6650
parentbd8617890576e2e89ac5076e6a02bc97d7a3e705 (diff)
* java/awt/peer/ButtonPeer.java: Replace with Classpath version.
* java/awt/peer/CanvasPeer.java: Replace with Classpath version. * java/awt/peer/CheckboxMenuItemPeer.java: Replace with Classpath version. * java/awt/peer/CheckboxPeer.java: Replace with Classpath version. * java/awt/peer/ChoicePeer.java: Replace with Classpath version. * java/awt/peer/ComponentPeer.java: Replace with Classpath version. * java/awt/peer/ContainerPeer.java: Replace with Classpath version. * java/awt/peer/DialogPeer.java: Replace with Classpath version. * java/awt/peer/FileDialogPeer.java: Replace with Classpath version. * java/awt/peer/FontPeer.java: Replace with Classpath version. * java/awt/peer/FramePeer.java: Replace with Classpath version. * java/awt/peer/LabelPeer.java: Replace with Classpath version. * java/awt/peer/LightweightPeer.java: Replace with Classpath version. * java/awt/peer/ListPeer.java: Replace with Classpath version. * java/awt/peer/MenuBarPeer.java: Replace with Classpath version. * java/awt/peer/MenuComponentPeer.java: Replace with Classpath version. * java/awt/peer/MenuItemPeer.java: Replace with Classpath version. * java/awt/peer/MenuPeer.java: Replace with Classpath version. * java/awt/peer/PanelPeer.java: Replace with Classpath version. * java/awt/peer/PopupMenuPeer.java: Replace with Classpath version. * java/awt/peer/ScrollPanePeer.java: Replace with Classpath version. * java/awt/peer/ScrollbarPeer.java: Replace with Classpath version. * java/awt/peer/TextAreaPeer.java: Replace with Classpath version. * java/awt/peer/TextComponentPeer.java: Replace with Classpath version. * java/awt/peer/TextFieldPeer.java: Replace with Classpath version. * java/awt/peer/WindowPeer.java: Replace with Classpath version. * gnu/awt/xlib/XPanelPeer.java (insets): New method. * gnu/awt/xlib/XCanvasPeer.java (show, hide): New methods. (minimumSize, preferredSize, reshape): Likewise. * gnu/awt/xlib/XFramePeer.java (insets, enable, disable, getColorModel): New methods. * java/awt/PopupMenu.java: Merged with Classpath. * java/awt/MenuBar.java: Merged with Classpath. * java/awt/SystemColor.java: Replace with Classpath version. * java/awt/Panel.java: Merged with Classpath. * java/awt/PaintContext.java: Updated copyright. * java/awt/MenuShortcut.java: Merged with Classpath. * java/awt/MenuContainer.java: Merged with Classpath. * java/awt/Menu.java: Merged with Classpath. * java/awt/MediaEntry.java: New file from Classpath. * java/awt/MediaTracker.java: New file from Classpath. * java/awt/List.java: Merged with Classpath version. * java/awt/Insets.java: Merged with Classpath version. * java/awt/ImageMediaEntry.java: New file from Classpath. * java/awt/Image.java: Replaced with Classpath version. * java/awt/FontMetrics.java: Merged with Classpath version. * java/awt/Cursor.java (getDefaultCursor): Use DEFAULT_CURSOR constant. * java/awt/Font.java: Merged with Classpath version. * java/awt/Dialog.java: Merged with Classpath version. * java/awt/Color.java: Merged with Classpath version. * java/awt/Choice.java: Merged with Classpath version. * java/awt/CheckboxMenuItem.java: Merged with Classpath version. * java/awt/Adjustable.java: Replace with Classpath version. * java/awt/MenuItem.java (paramString): Don't include class name or brackets. Call superclass paramString. * java/awt/MenuComponent.java (toString): Call paramString. (paramString): Compute string; don't call toString. * java/awt/Label.java (paramString): Don't include class name or brackets. Call superclass paramString. * java/awt/Checkbox.java (paramString): Don't include class name or brackets. Call superclass paramString. * java/awt/Button.java (paramString): Don't include class name or brackets. Call superclass paramString. * java/awt/MenuComponent.java (getTreeLock): Now protected. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49099 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libjava/ChangeLog69
-rw-r--r--libjava/gnu/awt/xlib/XCanvasPeer.java42
-rw-r--r--libjava/gnu/awt/xlib/XFramePeer.java7
-rw-r--r--libjava/gnu/awt/xlib/XPanelPeer.java7
-rw-r--r--libjava/java/awt/Adjustable.java233
-rw-r--r--libjava/java/awt/Button.java4
-rw-r--r--libjava/java/awt/Checkbox.java4
-rw-r--r--libjava/java/awt/CheckboxMenuItem.java379
-rw-r--r--libjava/java/awt/Choice.java694
-rw-r--r--libjava/java/awt/Color.java618
-rw-r--r--libjava/java/awt/Cursor.java158
-rw-r--r--libjava/java/awt/Dialog.java444
-rw-r--r--libjava/java/awt/FileDialog.java396
-rw-r--r--libjava/java/awt/Font.java508
-rw-r--r--libjava/java/awt/FontMetrics.java466
-rw-r--r--libjava/java/awt/Image.java193
-rw-r--r--libjava/java/awt/ImageMediaEntry.java75
-rw-r--r--libjava/java/awt/Insets.java203
-rw-r--r--libjava/java/awt/Label.java4
-rw-r--r--libjava/java/awt/List.java1413
-rw-r--r--libjava/java/awt/MediaEntry.java106
-rw-r--r--libjava/java/awt/MediaTracker.java40
-rw-r--r--libjava/java/awt/Menu.java523
-rw-r--r--libjava/java/awt/MenuBar.java555
-rw-r--r--libjava/java/awt/MenuComponent.java6
-rw-r--r--libjava/java/awt/MenuContainer.java76
-rw-r--r--libjava/java/awt/MenuItem.java4
-rw-r--r--libjava/java/awt/MenuShortcut.java253
-rw-r--r--libjava/java/awt/PaintContext.java28
-rw-r--r--libjava/java/awt/Panel.java104
-rw-r--r--libjava/java/awt/PopupMenu.java155
-rw-r--r--libjava/java/awt/SystemColor.java561
-rw-r--r--libjava/java/awt/peer/ButtonPeer.java35
-rw-r--r--libjava/java/awt/peer/CanvasPeer.java33
-rw-r--r--libjava/java/awt/peer/CheckboxMenuItemPeer.java35
-rw-r--r--libjava/java/awt/peer/CheckboxPeer.java40
-rw-r--r--libjava/java/awt/peer/ChoicePeer.java40
-rw-r--r--libjava/java/awt/peer/ComponentPeer.java93
-rw-r--r--libjava/java/awt/peer/ContainerPeer.java41
-rw-r--r--libjava/java/awt/peer/DialogPeer.java38
-rw-r--r--libjava/java/awt/peer/FileDialogPeer.java40
-rw-r--r--libjava/java/awt/peer/FontPeer.java33
-rw-r--r--libjava/java/awt/peer/FramePeer.java42
-rw-r--r--libjava/java/awt/peer/LabelPeer.java38
-rw-r--r--libjava/java/awt/peer/LightweightPeer.java33
-rw-r--r--libjava/java/awt/peer/ListPeer.java55
-rw-r--r--libjava/java/awt/peer/MenuBarPeer.java40
-rw-r--r--libjava/java/awt/peer/MenuComponentPeer.java36
-rw-r--r--libjava/java/awt/peer/MenuItemPeer.java40
-rw-r--r--libjava/java/awt/peer/MenuPeer.java36
-rw-r--r--libjava/java/awt/peer/PanelPeer.java33
-rw-r--r--libjava/java/awt/peer/PopupMenuPeer.java39
-rw-r--r--libjava/java/awt/peer/ScrollPanePeer.java46
-rw-r--r--libjava/java/awt/peer/ScrollbarPeer.java40
-rw-r--r--libjava/java/awt/peer/TextAreaPeer.java43
-rw-r--r--libjava/java/awt/peer/TextComponentPeer.java50
-rw-r--r--libjava/java/awt/peer/TextFieldPeer.java41
-rw-r--r--libjava/java/awt/peer/WindowPeer.java38
58 files changed, 6882 insertions, 2524 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 008094740f8..6c659351c82 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,72 @@
+2002-01-22 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/peer/ButtonPeer.java: Replace with Classpath version.
+ * java/awt/peer/CanvasPeer.java: Replace with Classpath version.
+ * java/awt/peer/CheckboxMenuItemPeer.java: Replace with Classpath
+ version.
+ * java/awt/peer/CheckboxPeer.java: Replace with Classpath version.
+ * java/awt/peer/ChoicePeer.java: Replace with Classpath version.
+ * java/awt/peer/ComponentPeer.java: Replace with Classpath version.
+ * java/awt/peer/ContainerPeer.java: Replace with Classpath version.
+ * java/awt/peer/DialogPeer.java: Replace with Classpath version.
+ * java/awt/peer/FileDialogPeer.java: Replace with Classpath version.
+ * java/awt/peer/FontPeer.java: Replace with Classpath version.
+ * java/awt/peer/FramePeer.java: Replace with Classpath version.
+ * java/awt/peer/LabelPeer.java: Replace with Classpath version.
+ * java/awt/peer/LightweightPeer.java: Replace with Classpath version.
+ * java/awt/peer/ListPeer.java: Replace with Classpath version.
+ * java/awt/peer/MenuBarPeer.java: Replace with Classpath version.
+ * java/awt/peer/MenuComponentPeer.java: Replace with Classpath version.
+ * java/awt/peer/MenuItemPeer.java: Replace with Classpath version.
+ * java/awt/peer/MenuPeer.java: Replace with Classpath version.
+ * java/awt/peer/PanelPeer.java: Replace with Classpath version.
+ * java/awt/peer/PopupMenuPeer.java: Replace with Classpath version.
+ * java/awt/peer/ScrollPanePeer.java: Replace with Classpath version.
+ * java/awt/peer/ScrollbarPeer.java: Replace with Classpath version.
+ * java/awt/peer/TextAreaPeer.java: Replace with Classpath version.
+ * java/awt/peer/TextComponentPeer.java: Replace with Classpath version.
+ * java/awt/peer/TextFieldPeer.java: Replace with Classpath version.
+ * java/awt/peer/WindowPeer.java: Replace with Classpath version.
+ * gnu/awt/xlib/XPanelPeer.java (insets): New method.
+ * gnu/awt/xlib/XCanvasPeer.java (show, hide): New methods.
+ (minimumSize, preferredSize, reshape): Likewise.
+ * gnu/awt/xlib/XFramePeer.java (insets, enable, disable,
+ getColorModel): New methods.
+ * java/awt/PopupMenu.java: Merged with Classpath.
+ * java/awt/MenuBar.java: Merged with Classpath.
+ * java/awt/SystemColor.java: Replace with Classpath version.
+ * java/awt/Panel.java: Merged with Classpath.
+ * java/awt/PaintContext.java: Updated copyright.
+ * java/awt/MenuShortcut.java: Merged with Classpath.
+ * java/awt/MenuContainer.java: Merged with Classpath.
+ * java/awt/Menu.java: Merged with Classpath.
+ * java/awt/MediaEntry.java: New file from Classpath.
+ * java/awt/MediaTracker.java: New file from Classpath.
+ * java/awt/List.java: Merged with Classpath version.
+ * java/awt/Insets.java: Merged with Classpath version.
+ * java/awt/ImageMediaEntry.java: New file from Classpath.
+ * java/awt/Image.java: Replaced with Classpath version.
+ * java/awt/FontMetrics.java: Merged with Classpath version.
+ * java/awt/Cursor.java (getDefaultCursor): Use DEFAULT_CURSOR
+ constant.
+ * java/awt/Font.java: Merged with Classpath version.
+ * java/awt/Dialog.java: Merged with Classpath version.
+ * java/awt/Color.java: Merged with Classpath version.
+ * java/awt/Choice.java: Merged with Classpath version.
+ * java/awt/CheckboxMenuItem.java: Merged with Classpath version.
+ * java/awt/Adjustable.java: Replace with Classpath version.
+ * java/awt/MenuItem.java (paramString): Don't include class name
+ or brackets. Call superclass paramString.
+ * java/awt/MenuComponent.java (toString): Call paramString.
+ (paramString): Compute string; don't call toString.
+ * java/awt/Label.java (paramString): Don't include class name
+ or brackets. Call superclass paramString.
+ * java/awt/Checkbox.java (paramString): Don't include class name
+ or brackets. Call superclass paramString.
+ * java/awt/Button.java (paramString): Don't include class name or
+ brackets. Call superclass paramString.
+ * java/awt/MenuComponent.java (getTreeLock): Now protected.
+
2002-01-20 Andreas Schwab <schwab@suse.de>
* java/net/natPlainSocketImpl.cc (_Jv_recv): Change return type of
diff --git a/libjava/gnu/awt/xlib/XCanvasPeer.java b/libjava/gnu/awt/xlib/XCanvasPeer.java
index 5674f5bf2ad..a208be5c103 100644
--- a/libjava/gnu/awt/xlib/XCanvasPeer.java
+++ b/libjava/gnu/awt/xlib/XCanvasPeer.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
@@ -230,6 +230,11 @@ public class XCanvasPeer implements CanvasPeer
throw new UnsupportedOperationException("FIXME, not implemented");
}
+ public ColorModel getColorModel ()
+ {
+ return null;
+ }
+
public Graphics getGraphics()
{
DirectRasterGraphics gfxDevice = new XGraphics(window, config);
@@ -251,11 +256,21 @@ public class XCanvasPeer implements CanvasPeer
return MIN_SIZE;
}
+ public Dimension minimumSize ()
+ {
+ return getMinimumSize ();
+ }
+
public Dimension getPreferredSize ()
{
return component.getSize();
}
+ public Dimension preferredSize ()
+ {
+ return getPreferredSize();
+ }
+
public Toolkit getToolkit()
{
return getXToolkit();
@@ -318,6 +333,11 @@ public class XCanvasPeer implements CanvasPeer
ensureFlush();
}
+ public void reshape (int x, int y, int width, int height)
+ {
+ setBounds (x, y, width, height);
+ }
+
public void setCursor(Cursor cursor)
{
throw new UnsupportedOperationException("FIXME, not implemented");
@@ -328,6 +348,16 @@ public class XCanvasPeer implements CanvasPeer
throw new UnsupportedOperationException("FIXME, not implemented");
}
+ public void enable ()
+ {
+ setEnabled (true);
+ }
+
+ public void disable ()
+ {
+ setEnabled (false);
+ }
+
public void setEventMask(long eventMask)
{
WindowAttributes attributes = new WindowAttributes();
@@ -371,6 +401,16 @@ public class XCanvasPeer implements CanvasPeer
}
}
+ public void show ()
+ {
+ setVisible (true);
+ }
+
+ public void hide ()
+ {
+ setVisible (false);
+ }
+
static class DoMap implements Runnable
{
Window window;
diff --git a/libjava/gnu/awt/xlib/XFramePeer.java b/libjava/gnu/awt/xlib/XFramePeer.java
index 0f55088d023..80a972425e5 100644
--- a/libjava/gnu/awt/xlib/XFramePeer.java
+++ b/libjava/gnu/awt/xlib/XFramePeer.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
@@ -93,6 +93,11 @@ public class XFramePeer extends XCanvasPeer implements FramePeer
return (Insets) INSETS_0_PROTOTYPE.clone();
}
+ public Insets insets ()
+ {
+ return getInsets ();
+ }
+
public void beginValidate()
{
}
diff --git a/libjava/gnu/awt/xlib/XPanelPeer.java b/libjava/gnu/awt/xlib/XPanelPeer.java
index c4ff3f17b71..f4d3b4bffb1 100644
--- a/libjava/gnu/awt/xlib/XPanelPeer.java
+++ b/libjava/gnu/awt/xlib/XPanelPeer.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
@@ -40,6 +40,11 @@ public class XPanelPeer extends XCanvasPeer implements PanelPeer
return (Insets) INSETS_0_PROTOTYPE.clone();
}
+ public Insets insets()
+ {
+ return getInsets();
+ }
+
public void beginValidate()
{
// NOP
diff --git a/libjava/java/awt/Adjustable.java b/libjava/java/awt/Adjustable.java
index bfdbb39531b..eb773a07c69 100644
--- a/libjava/java/awt/Adjustable.java
+++ b/libjava/java/awt/Adjustable.java
@@ -1,39 +1,212 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* Adjustable.java -- Objects with a numeric adjustment scale.
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libjava.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libjava License. Please consult the file "LIBJAVA_LICENSE" for
-details. */
package java.awt;
-import java.awt.event.*;
+
+import java.awt.event.AdjustmentListener;
/**
- * @author Tom Tromey <tromey@cygnus.com>
- * @date April 8, 2000
+ * This interface is for objects that take a numeric value that
+ * can be adjusted within a bounded range. For example, a scroll bar.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
+public interface Adjustable
+{
+
+/*
+ * Static Variables
*/
-/* Status: Believed complete and correct to JDK 1.2. */
+/**
+ * Constant for a horizontal orientation
+ */
+public static final int HORIZONTAL = 0;
+
+/**
+ * Constant for a vertical orientation
+ */
+public static final int VERTICAL = 1;
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Returns the current value of the object.
+ *
+ * @return The current value of the object.
+ */
+public abstract int
+getValue();
+
+/*************************************************************************/
+
+/**
+ * Sets the current value of the object.
+ *
+ * @param value The current value of the object.
+ */
+public abstract void
+setValue(int value);
+
+/*************************************************************************/
+
+/**
+ * Returns the orientation of the object, either <code>HORIZONTAL</code>
+ * or <code>VERTICAL</code>.
+ *
+ * @return The orientation of this object.
+ */
+public abstract int
+getOrientation();
+
+/*************************************************************************/
+
+/**
+ * Returns the minimum value this object can take.
+ *
+ * @return The minimum value this object can take.
+ */
+public abstract int
+getMinimum();
+
+/*************************************************************************/
+
+/**
+ * Sets the minimum value this object can take to the specified value.
+ *
+ * @param minimum The new minimum value for this object.
+ */
+public abstract void
+setMinimum(int minimum);
+
+/*************************************************************************/
+
+/**
+ * Returns the maximum value this object can take.
+ *
+ * @return The maximum value this object can take.
+ */
+public abstract int
+getMaximum();
+
+/*************************************************************************/
+
+/**
+ * Sets the maximum value this object can take to the specified value.
+ *
+ * @param maximum The new maximum value for this object.
+ */
+public abstract void
+setMaximum(int maximum);
+
+/*************************************************************************/
+
+/**
+ * Returns the increment value for incrementing by units.
+ *
+ * @return The unit increment value.
+ */
+public abstract int
+getUnitIncrement();
+
+/*************************************************************************/
+
+/**
+ * Sets the increment value for incrementing by units to the specified value.
+ *
+ * @param increment The unit increment value.
+ */
+public abstract void
+setUnitIncrement(int increment);
+
+/*************************************************************************/
+
+/**
+ * Returns the increment value for incrementing by blocks.
+ *
+ * @return The block increment value.
+ */
+public abstract int
+getBlockIncrement();
+
+/*************************************************************************/
+
+/**
+ * Sets the increment value for incrementing by blocks to the specified value.
+ *
+ * @param increment The block increment value.
+ */
+public abstract void
+setBlockIncrement(int increment);
+
+/*************************************************************************/
+
+/**
+ * Returns the length of the indicator for this object.
+ *
+ * @return The indicator length.
+ */
+public abstract int
+getVisibleAmount();
+
+/*************************************************************************/
+
+/**
+ * Sets the length of the indicator for this object to the specified value.
+ *
+ * @param length The indicator length
+ */
+public abstract void
+setVisibleAmount(int length);
+
+/*************************************************************************/
+
+/**
+ * Adds a listener that will receive adjustment events for this object.
+ *
+ * @param listener The adjustment listener to add.
+ */
+public abstract void
+addAdjustmentListener(AdjustmentListener listener);
+
+/*************************************************************************/
+
+/**
+ * Removes an adjustment listener from this object. It will no longer
+ * receive adjustment events.
+ *
+ * @param listener The adjustment listener to remove.
+ */
+public abstract void
+removeAdjustmentListener(AdjustmentListener listener);
+
+} // interface Adjustable
-public interface Adjustable
-{
- public static final int HORIZONTAL = 0;
- public static final int VERTICAL = 1;
-
- public void addAdjustmentListener (AdjustmentListener l);
- public int getBlockIncrement ();
- public int getMaximum ();
- public int getMinimum ();
- public int getOrientation ();
- public int getUnitIncrement ();
- public int getValue ();
- public int getVisibleAmount ();
- public void removeAdjustmentListener (AdjustmentListener l);
- public void setBlockIncrement (int b);
- public void setMaximum (int max);
- public void setMinimum (int min);
- public void setUnitIncrement (int u);
- public void setValue (int v);
- public void setVisibleAmount (int v);
-}
diff --git a/libjava/java/awt/Button.java b/libjava/java/awt/Button.java
index 1626047bb68..64c55cb5cf2 100644
--- a/libjava/java/awt/Button.java
+++ b/libjava/java/awt/Button.java
@@ -269,8 +269,8 @@ dispatchEventImpl(AWTEvent e)
protected String
paramString()
{
- return(getClass().getName() + "(label=" + getLabel() + ",actionCommand=" +
- getActionCommand() + ")");
+ return ("label=" + getLabel() + ",actionCommand=" + getActionCommand()
+ + "," + super.paramString());
}
} // class Button
diff --git a/libjava/java/awt/Checkbox.java b/libjava/java/awt/Checkbox.java
index 60795ae7405..a7d12ad5fe0 100644
--- a/libjava/java/awt/Checkbox.java
+++ b/libjava/java/awt/Checkbox.java
@@ -362,8 +362,8 @@ processItemEvent(ItemEvent event)
protected String
paramString()
{
- return(getClass().getName() + "[label=" + label + ",state=" + state
- + ",group=" + group + "]");
+ return ("label=" + label + ",state=" + state + ",group=" + group
+ + "," + super.paramString());
}
} // class Checkbox
diff --git a/libjava/java/awt/CheckboxMenuItem.java b/libjava/java/awt/CheckboxMenuItem.java
index 007d3dc4e2a..bdede7b85a8 100644
--- a/libjava/java/awt/CheckboxMenuItem.java
+++ b/libjava/java/awt/CheckboxMenuItem.java
@@ -1,134 +1,265 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* CheckboxMenuItem.java -- A menu option with a checkbox on it.
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt;
+
import java.awt.peer.CheckboxMenuItemPeer;
-import java.awt.event.ItemListener;
+import java.awt.peer.MenuItemPeer;
+import java.awt.peer.MenuComponentPeer;
import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+
+/**
+ * This class implements a menu item that has a checkbox on it indicating
+ * the selected state of some option.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@redhat.com>
+ */
+public class CheckboxMenuItem extends MenuItem implements ItemSelectable,
+ java.io.Serializable
+{
-/** This implements a menu item which keeps track of a boolean state.
- * @author Tom Tromey <tromey@redhat.com>
- * @date December 25, 2000
+/*
+ * Static Variables
*/
-public class CheckboxMenuItem extends MenuItem implements ItemSelectable
+
+// Serialization constant
+private static final long serialVersionUID = 6190621106981774043L;
+
+/*
+ * Instance Variables
+ */
+
+/**
+ * @serial The state of the checkbox, with <code>true</code> being on and
+ * <code>false</code> being off.
+ */
+private boolean state;
+
+// List of registered ItemListeners
+private transient ItemListener item_listeners;
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * Initializes a new instance of <code>CheckboxMenuItem</code> with no
+ * label and an initial state of off.
+ */
+public
+CheckboxMenuItem()
{
- /** Create a new CheckboxMenuItem.
- * @param label The checkbox label. A null value is the same as "";
- * null is the default.
- * @param state The initial check state; defaults to false.
- */
- public CheckboxMenuItem ()
- {
- this (null, false);
- }
-
- public CheckboxMenuItem (String label)
- {
- this (label, false);
- }
-
- public CheckboxMenuItem (String label, boolean state)
- {
- this.label = label;
- this.state = state;
- }
-
- /** Add a listener for item events.
- * @param listener The listener to add.
- */
- public synchronized void addItemListener (ItemListener listener)
- {
- listeners = AWTEventMulticaster.add (listeners, listener);
- }
-
- /** This creates the component's peer. */
- public void addNotify ()
- {
- if (peer != null)
- {
- // This choice of toolkit seems unsatisfying, but I'm not sure
- // what else to do.
- peer = Toolkit.getDefaultToolkit ().createCheckboxMenuItem (this);
- }
- super.addNotify ();
- }
-
- /** Returns this checkbox's label if this checkbox is selected. */
- public Object[] getSelectedObjects ()
- {
- Object[] r;
- if (state)
- {
- r = new Object[1];
- r[0] = label;
- }
- else
- r = new Object[0];
- return r;
- }
-
- /** Returns the current state of this checkbox. */
- public boolean getState ()
- {
- return state;
- }
-
- /** Generates a String representation of this Checkbox's state. */
- public String paramString ()
- {
- return ("[" + getClass ().getName ()
- + "state=" + state + ","
- + "label=" + label + "]");
- }
-
- /** Process an event for this Checkbox.
- * @param event The event the process.
- */
- protected void processEvent (AWTEvent event)
- {
- if (event instanceof ItemEvent)
- processItemEvent ((ItemEvent) event);
- else
- super.processEvent (event);
- }
-
- /** Process an item event for this Checkbox.
- * @param event The ItemEvent to process
- */
- protected void processItemEvent (ItemEvent event)
- {
- if (listeners != null)
- listeners.itemStateChanged (event);
- }
-
- /** Remove an item listener.
- * @param listener Item listener to remove.
- */
- public synchronized void removeItemListener (ItemListener listener)
- {
- listeners = AWTEventMulticaster.remove (listeners, listener);
- }
-
- /** Set the checkbox's state.
- * @param state The new state.
- */
- public void setState (boolean state)
- {
- this.state = state;
- if (peer != null)
- {
- CheckboxMenuItemPeer cp = (CheckboxMenuItemPeer) peer;
- cp.setState (state);
- }
- }
-
- // Private state.
- String label;
- boolean state;
- ItemListener listeners;
+ this("", false);
}
+
+/*************************************************************************/
+
+/**
+ * Initializes a new instance of <code>CheckboxMenuItem</code> with the
+ * specified label and an initial state of off.
+ *
+ * @param label The label of the menu item.
+ */
+public
+CheckboxMenuItem(String label)
+{
+ this(label, false);
+}
+
+/*************************************************************************/
+
+/**
+ * Initializes a new instance of <code>CheckboxMenuItem</code> with the
+ * specified label and initial state.
+ *
+ * @param label The label of the menu item.
+ * @param state The initial state of the menu item, where <code>true</code>
+ * is on, and <code>false</code> is off.
+ */
+public
+CheckboxMenuItem(String label, boolean state)
+{
+ super(label);
+ this.state = state;
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Returns the state of this menu item.
+ *
+ * @return The state of this menu item.
+ */
+public boolean
+getState()
+{
+ return(state);
+}
+
+/*************************************************************************/
+
+/**
+ * Sets the state of this menu item.
+ *
+ * @param state The initial state of the menu item, where <code>true</code>
+ * is on, and <code>false</code> is off.
+ */
+public synchronized void
+setState(boolean state)
+{
+ this.state = state;
+ if (peer != null)
+ {
+ CheckboxMenuItemPeer cp = (CheckboxMenuItemPeer) peer;
+ cp.setState (state);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Returns an array of length 1 with the menu item label for this object
+ * if the state is on. Otherwise <code>null</code> is returned.
+ *
+ * @param An array with this menu item's label if it has a state of on,
+ * or <code>null</code> otherwise.
+ */
+public Object[]
+getSelectedObjects()
+{
+ if (state == false)
+ return(null);
+
+ Object[] obj = new Object[1];
+ obj[0] = getLabel();
+
+ return(obj);
+}
+
+/*************************************************************************/
+
+/**
+ * Create's this object's native peer
+ */
+public synchronized void
+addNotify()
+{
+ if (peer != null)
+ {
+ // This choice of toolkit seems unsatisfying, but I'm not sure
+ // what else to do.
+ peer = getToolkit().createCheckboxMenuItem(this);
+ }
+ super.addNotify ();
+}
+
+/*************************************************************************/
+
+/**
+ * Adds the specified listener to the list of registered item listeners
+ * for this object.
+ *
+ * @param listener The listener to add.
+ */
+public synchronized void
+addItemListener(ItemListener listener)
+{
+ item_listeners = AWTEventMulticaster.add(item_listeners, listener);
+
+ enableEvents(AWTEvent.ITEM_EVENT_MASK);
+}
+
+/*************************************************************************/
+
+/**
+ * Removes the specified listener from the list of registered item
+ * listeners for this object.
+ *
+ * @param listener The listener to remove.
+ */
+public synchronized void
+removeItemListener(ItemListener listener)
+{
+ item_listeners = AWTEventMulticaster.remove(item_listeners, listener);
+}
+
+/*************************************************************************/
+
+/**
+ * Processes the specified event by calling <code>processItemEvent()</code>
+ * if it is an instance of <code>ItemEvent</code> or calling the superclass
+ * method otherwise.
+ *
+ * @param event The event to process.
+ */
+protected void
+processEvent(AWTEvent event)
+{
+ if (event instanceof ItemEvent)
+ processItemEvent((ItemEvent)event);
+ else
+ super.processEvent(event);
+}
+
+/*************************************************************************/
+
+/**
+ * Processes the specified event by dispatching it to any registered listeners.
+ *
+ * @param event The event to process.
+ */
+protected void
+processItemEvent(ItemEvent event)
+{
+ if (item_listeners != null)
+ item_listeners.itemStateChanged(event);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a debugging string for this object.
+ *
+ * @return A debugging string for this object.
+ */
+public String
+paramString()
+{
+ return ("label=" + getLabel() + ",state=" + state
+ + "," + super.paramString());
+}
+
+} // class CheckboxMenuItem
+
diff --git a/libjava/java/awt/Choice.java b/libjava/java/awt/Choice.java
index 6b9a112ecb8..68064356de6 100644
--- a/libjava/java/awt/Choice.java
+++ b/libjava/java/awt/Choice.java
@@ -1,276 +1,436 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* Choice.java -- Java choice button widget.
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt;
-import java.awt.event.*;
+
import java.awt.peer.ChoicePeer;
-import java.util.ArrayList;
+import java.awt.peer.ComponentPeer;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.Serializable;
+import java.util.Vector;
+
+/**
+ * This class implements a drop down choice list.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
+public class Choice extends Component implements ItemSelectable, Serializable
+{
+
+/*
+ * Static Variables
+ */
+
+// Serialization constant
+private static final long serialVersionUID = -4075310674757313071L;
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
+ */
+
+/**
+ * @serial A list of items for the choice box, which can be <code>null</code>.
+ */
+private Vector pItems = new Vector();
+
+/**
+ * @serial The index of the selected item in the choice box.
+ */
+private int selectedIndex = -1;
+
+// Listener chain
+private ItemListener item_listeners;
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * Initializes a new instance of <code>Choice</code>.
+ */
+public
+Choice()
+{
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Returns the number of items in the list.
+ *
+ * @return The number of items in the list.
+ */
+public int
+getItemCount()
+{
+ return(pItems.size());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the number of items in the list.
+ *
+ * @return The number of items in the list.
+ *
+ * @deprecated This method is deprecated in favor of <code>getItemCount</code>.
+ */
+public int
+countItems()
+{
+ return(pItems.size());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the item at the specified index in the list.
+ *
+ * @param index The index into the list to return the item from.
+ *
+ * @exception ArrayIndexOutOfBoundsException If the index is invalid.
+ */
+public String
+getItem(int index)
+{
+ return((String)pItems.elementAt(index));
+}
+
+/*************************************************************************/
+
+/**
+ * Adds the specified item to this choice box.
+ *
+ * @param item The item to add.
+ */
+public synchronized void
+add(String item)
+{
+ if (item == null)
+ throw new IllegalArgumentException ("item must be non-null");
+
+ pItems.addElement(item);
+
+ int i = pItems.size () - 1;
+ if (peer != null)
+ {
+ ChoicePeer cp = (ChoicePeer) peer;
+ cp.add (item, i);
+ }
+
+ if (i == 0)
+ select (0);
+}
+
+/*************************************************************************/
-/** This component lets the user choose an item from a list of
- * Strings.
- * @author Tom Tromey <tromey@redhat.com>
- * @date December 25, 2000
+/**
+ * Adds the specified item to this choice box.
+ *
+ * @param item The item to add.
+ */
+public synchronized void
+addItem(String item)
+{
+ add(item);
+}
+
+/*************************************************************************/
+
+/** Inserts an item into this Choice. Existing items are shifted
+ * upwards. If the new item is the only item, then it is selected.
+ * If the currently selected item is shifted, then the first item is
+ * selected. If the currently selected item is not shifted, then it
+ * remains selected.
+ *
+ * @param item The item to add.
+ * @param index The index at which the item should be inserted.
*/
-public class Choice extends Component implements ItemSelectable
+public synchronized void
+insert(String item, int index)
{
- /** Create a new Choice object. */
- public Choice ()
- {
- items = new ArrayList ();
- selected = -1;
- }
-
- /** Add a new item to this Choice object. If the item is the first
- * item on the list, then it is selected.
- * @param item The new item; must be non-null.
- */
- public synchronized void add (String item)
- {
- if (item == null)
- throw new IllegalArgumentException ("item must be non-null");
- items.add (item);
-
- int i = items.size () - 1;
- if (peer != null)
- {
- ChoicePeer cp = (ChoicePeer) peer;
- cp.add (item, i);
- }
-
- if (i == 0)
- select (0);
- }
-
- /** Add a new item to this Choice object. This is the same as the
- * add method. */
- public void addItem (String item)
- {
- add (item);
- }
-
- /** Add a listener for item events.
- * @param listener The listener to add.
- */
- public synchronized void addItemListener (ItemListener listener)
- {
- listeners = AWTEventMulticaster.add (listeners, listener);
- }
-
- /** This creates the component's peer. */
- public void addNotify ()
- {
- if (peer == null)
- peer = getToolkit ().createChoice (this);
- super.addNotify ();
- }
-
- /** Returns number of items.
- * @deprecated
- */
- public int countItems ()
- {
- return getItemCount ();
- }
-
- /** Returns an item from this choice.
- * @param index Index of the item. Indices start at zero.
- */
- public String getItem (int index)
- {
- return (String) items.get (index);
- }
-
- /** Returns number of items in Choice. */
- public int getItemCount ()
- {
- return items.size ();
- }
-
- /** Returns index of selected item; -1 if no item is selected. */
- public int getSelectedIndex ()
- {
- return selected;
- }
-
- /** Returns currently selected item; null if no item is selected. */
- public synchronized String getSelectedItem ()
- {
- return selected == -1 ? null : (String) items.get (selected);
- }
-
- /** Returns the currently selected item. */
- public synchronized Object[] getSelectedObjects ()
- {
- // The JCL says this can return null but that breaks the contract
- // for ItemSelectable.
- Object[] r;
- if (selected != -1)
- {
- r = new Object[1];
- r[0] = items.get (selected);
- }
- else
- r = new Object[0];
- return r;
- }
-
- /** Inserts an item into this Choice. Existing items are shifted
- * upwards. If the new item is the only item, then it is selected.
- * If the currently selected item is shifted, then the first item is
- * selected. If the currently selected item is not shifted, then it
- * remains selected.
- * @param item The new item
- * @param index The position at which to insert it.
- */
- public synchronized void insert (String item, int index)
- {
- if (index > items.size ())
- index = items.size ();
- items.add (index, item);
-
- if (peer != null)
- {
- ChoicePeer cp = (ChoicePeer) peer;
- cp.add (item, index);
- }
-
- if (items.size () == 1 || selected >= index)
- select (0);
- }
-
- /** Generates a String representation of this Choice's state. */
- protected String paramString ()
- {
- return ("Choice["
- + "selected=" + selected
- + "]");
- }
-
- /** Process an event for this Choice
- * @param event The event the process.
- */
- protected void processEvent (AWTEvent event)
- {
- if (event instanceof ItemEvent)
- processItemEvent ((ItemEvent) event);
- else
- super.processEvent (event);
- }
-
- /** Process an item event for this Choice.
- * @param event The ItemEvent to process
- */
- protected void processItemEvent (ItemEvent event)
- {
- if (listeners != null)
- listeners.itemStateChanged (event);
- }
-
- /** Remove an item from this Choice. If several matches exist, the
- * first one is removed. If the removed item is selected, the the
- * first item is selected.
- * @param item The item string.
- */
- public synchronized void remove (String item)
- {
- int size = items.size ();
- for (int i = 0; i < size; ++i)
- {
- if (item.equals (items.get (i)))
- {
- remove (i);
- break;
- }
- }
- throw new IllegalArgumentException ("item \"" + item + "\" not in Choice");
- }
-
- /** Remove an item from this Choice. If the removed item is
- * selected, the the first item is selected.
- * @param index Index of the item to remove
- */
- public synchronized void remove (int index)
- {
- items.remove (index);
-
- if (peer != null)
- {
- ChoicePeer cp = (ChoicePeer) peer;
- cp.remove (index);
- }
-
- if (index == selected)
- select (0);
- else if (selected > index)
- --selected;
- }
-
- /** Remove all items from this choice. */
- public synchronized void removeAll ()
- {
- int oldsize = items.size ();
- items.clear ();
- selected = -1;
-
- if (peer != null)
- {
- ChoicePeer cp = (ChoicePeer) peer;
- for (int i = 0; i < oldsize; ++i)
- {
- // Always remove item 0.
- cp.remove (0);
- }
- }
- }
-
- /** Remove an item listener.
- * @param listener Item listener to remove.
- */
- public synchronized void removeItemListener (ItemListener listener)
- {
- listeners = AWTEventMulticaster.remove (listeners, listener);
- }
-
- /** Select an item in this Choice.
- * @param item Name of the item to select.
- */
- public synchronized void select (String item)
- {
- int size = items.size ();
- for (int i = 0; i < size; ++i)
- {
- if (item.equals (items.get (i)))
- {
- select (i);
- break;
- }
- }
- }
-
- /** Select an item in this choice.
- * @param index Index of item to select.
- */
- public synchronized void select (int index)
- {
- if (index < 0 || index > items.size ())
- throw new IllegalArgumentException ("index out of range");
- selected = index;
- if (peer != null)
- {
- ChoicePeer cp = (ChoicePeer) peer;
- cp.select (index);
- }
- }
-
- private ItemListener listeners;
-
- // List of items.
- ArrayList items;
- // Index of selected item.
- int selected;
+ if (index > getItemCount ())
+ index = getItemCount ();
+
+ pItems.insertElementAt(item, index);
+
+ if (peer != null)
+ {
+ ChoicePeer cp = (ChoicePeer) peer;
+ cp.add (item, index);
+ }
+
+ if (getItemCount () == 1 || selectedIndex >= index)
+ select (0);
+}
+
+/*************************************************************************/
+
+/**
+ * Removes the specified item from the choice box.
+ *
+ * @param item The item to remove.
+ *
+ * @param IllegalArgumentException If the specified item doesn't exist.
+ */
+public synchronized void
+remove(String item)
+{
+ int index = pItems.indexOf(item);
+ if (index == -1)
+ throw new IllegalArgumentException ("item \""
+ + item + "\" not found in Choice");
+ remove(index);
}
+
+/*************************************************************************/
+
+/**
+ * Removes the item at the specified index from the choice box.
+ *
+ * @param index The index of the item to remove.
+ *
+ * @exception ArrayIndexOutOfBoundException If the index is not valid.
+ */
+public synchronized void
+remove(int index)
+{
+ pItems.removeElementAt(index);
+
+ if (peer != null)
+ {
+ ChoicePeer cp = (ChoicePeer) peer;
+ cp.remove (index);
+ }
+
+ if (index == selectedIndex)
+ select (0);
+ else if (selectedIndex > index)
+ --selectedIndex;
+}
+
+/*************************************************************************/
+
+/**
+ * Removes all of the objects from this choice box.
+ */
+public synchronized void
+removeAll()
+{
+ int count = getItemCount();
+
+ for (int i = 0; i < count; i++)
+ {
+ // Always remove 0.
+ remove(0);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the currently selected item, or null if no item is
+ * selected.
+ *
+ * @return The currently selected item.
+ */
+public synchronized String
+getSelectedItem()
+{
+ return (selectedIndex == -1
+ ? null
+ : ((String)pItems.elementAt(selectedIndex)));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns an array with one row containing the selected item.
+ *
+ * @return An array containing the selected item.
+ */
+public synchronized Object[]
+getSelectedObjects()
+{
+ if (selectedIndex == -1)
+ return null;
+
+ Object[] objs = new Object[1];
+ objs[0] = pItems.elementAt(selectedIndex);
+
+ return(objs);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the index of the selected item.
+ *
+ * @return The index of the selected item.
+ */
+public int
+getSelectedIndex()
+{
+ return(selectedIndex);
+}
+
+/*************************************************************************/
+
+/**
+ * Forces the item at the specified index to be selected.
+ *
+ * @param index The index of the row to make selected.
+ *
+ * @param IllegalArgumentException If the specified index is invalid.
+ */
+public synchronized void
+select(int index)
+{
+ if ((index < 0) || (index > getItemCount()))
+ throw new IllegalArgumentException("Bad index: " + index);
+
+ this.selectedIndex = index;
+ if (peer != null)
+ {
+ ChoicePeer cp = (ChoicePeer) peer;
+ cp.select (index);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Forces the named item to be selected.
+ *
+ * @param item The item to be selected.
+ *
+ * @exception IllegalArgumentException If the specified item does not exist.
+ */
+public synchronized void
+select(String item)
+{
+ int index = pItems.indexOf(item);
+ if (index >= 0)
+ select(index);
+}
+
+/*************************************************************************/
+
+/**
+ * Creates the native peer for this object.
+ */
+public void
+addNotify()
+{
+ if (peer == null)
+ peer = getToolkit ().createChoice (this);
+ super.addNotify ();
+}
+
+/*************************************************************************/
+
+/**
+ * Adds the specified listener to the list of registered listeners for
+ * this object.
+ *
+ * @param listener The listener to add.
+ */
+public synchronized void
+addItemListener(ItemListener listener)
+{
+ item_listeners = AWTEventMulticaster.add(item_listeners, listener);
+}
+
+/*************************************************************************/
+
+/**
+ * Removes the specified listener from the list of registered listeners for
+ * this object.
+ *
+ * @param listener The listener to remove.
+ */
+public synchronized void
+removeItemListener(ItemListener listener)
+{
+ item_listeners = AWTEventMulticaster.remove(item_listeners, listener);
+}
+
+/*************************************************************************/
+
+/**
+ * Processes this event by invoking <code>processItemEvent()</code> if the
+ * event is an instance of <code>ItemEvent</code>, otherwise the event
+ * is passed to the superclass.
+ *
+ * @param event The event to process.
+ */
+protected void
+processEvent(AWTEvent event)
+{
+ if (event instanceof ItemEvent)
+ processItemEvent((ItemEvent)event);
+ else
+ super.processEvent(event);
+}
+
+/*************************************************************************/
+
+/**
+ * Processes item event by dispatching to any registered listeners.
+ *
+ * @param event The event to process.
+ */
+protected void
+processItemEvent(ItemEvent event)
+{
+ if (item_listeners != null)
+ item_listeners.itemStateChanged(event);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a debugging string for this object.
+ *
+ * @return A debugging string for this object.
+ */
+protected String
+paramString()
+{
+ return ("selectedIndex=" + selectedIndex + "," + super.paramString());
+}
+
+} // class Choice
diff --git a/libjava/java/awt/Color.java b/libjava/java/awt/Color.java
index 6ae4621d5be..52db41c8f47 100644
--- a/libjava/java/awt/Color.java
+++ b/libjava/java/awt/Color.java
@@ -1,122 +1,522 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Color.java -- Class representing a color in Java
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt;
/**
- * @author Warren Levy <warrenl@cygnus.com>
- * @date March 15, 2000.
+ * This class represents a color value in the AWT system.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
+public class Color implements java.io.Serializable
+{
+
+/*
+ * Static Variables
+ */
+
+/**
+ * Constant for the color white
+ */
+public static final Color white = new Color(255,255,255,255);
+
+/**
+ * Constant for the color light gray
+ */
+public static final Color lightGray = new Color(192,192,192,255);
+
+/**
+ * Constant for the color gray
+ */
+public static final Color gray = new Color(128,128,128,255);
+
+/**
+ * Constant for the color dark gray
+ */
+public static final Color darkGray = new Color(64,64,64,255);
+
+/**
+ * Constant for the color black
+ */
+public static final Color black = new Color(0,0,0,255);
+
+/**
+ * Constant for the color red
+ */
+public static final Color red = new Color(255,0,0,255);
+
+/**
+ * Constant for the color pink
+ */
+public static final Color pink = new Color(255, 175, 175,255);
+
+/**
+ * Constant for the color orange
+ */
+public static final Color orange = new Color(255, 200, 0,255);
+
+/**
+ * Constant for the color yellow
+ */
+public static final Color yellow = new Color(255,255,0,255);
+
+/**
+ * Constant for the color green
+ */
+public static final Color green = new Color(0,255,0,255);
+
+/**
+ * Constant for the color magenta
+ */
+public static final Color magenta = new Color(255,0,255,255);
+
+/**
+ * Constant for the color cyan
+ */
+public static final Color cyan = new Color(0,255,255,255);
+
+/**
+ * Constant for the color blue
+ */
+public static final Color blue = new Color(0,0,255,255);
+
+// Serialization Constant
+private static final long serialVersionUID = 118526816881161077L;
+
+// Masks for individual color components
+private static final int redmask = 255 << 16;
+private static final int greenmask = 255 << 8;
+private static final int bluemask = 255;
+private static final int alphamask = 255 << 24;
+
+private static final int BRIGHT_STEP = 0x30;
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
*/
/**
- * Written using on-line Java Platform 1.2 API Specification, as well
- * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
- * Status: Stubbed; A very incomplete implementation.
+ * @serial The RGB value of the color.
+ */
+private int value = 0xFFFFFFFF;
+
+/*************************************************************************/
+
+/*
+ * Static Methods
*/
-public class Color extends Object implements Paint, java.io.Serializable
-{
- public static final Color white = new Color(0xFFFFFFFF, true);
- public static final Color lightGray = new Color(0xFFC0C0C0, true);
- public static final Color gray = new Color(0xFF808080, true);
- public static final Color darkGray = new Color(0xFF404040, true);
- public static final Color black = new Color(0xFF000000, true);
- public static final Color red = new Color(0xFFFF0000, true);
- public static final Color pink = new Color(0xFFFFAFAF, true);
- public static final Color orange = new Color(0xFFFFC800, true);
- public static final Color yellow = new Color(0xFFFFFF00, true);
- public static final Color green = new Color(0xFF00FF00, true);
- public static final Color magenta = new Color(0xFFFF00FF, true);
- public static final Color cyan = new Color(0xFF00FFFF, true);
- public static final Color blue = new Color(0xFF0000FF, true);
-
- // The internal sRGB representation.
- // Alpha is bits 24-31, if hasalpha is true.
- // Red is bits 16-23; Green is bits 8-15; Blue is bits 0-7.
- int rgba = 0xFFFFFFFF;
-
- public Color(int rgb)
- {
- this(rgb, false);
- }
-
- public Color(int rgba, boolean hasalpha)
- {
- this.rgba = rgba;
- if (!hasalpha)
- rgba |= 0xFF000000;
- }
-
- public Color(int r, int g, int b)
- {
- this(r, g, b, 0xFF);
- }
-
- public Color(int r, int g, int b, int a)
- {
- rgba = a << 24 | ((r << 16) & 0x00FF0000) | ((g << 8) & 0x0000FF00) |
- (b & 0x000000FF);
- }
-
- public int getRed()
- {
- return (rgba >> 16) & 0xFF;
- }
-
- public int getGreen()
- {
- return (rgba >> 8) & 0xFF;
- }
-
- public int getBlue()
- {
- return rgba & 0xFF;
- }
-
- public int getAlpha()
- {
- return (rgba >> 24) & 0xFF;
- }
-
- public int getRGB()
- {
- return rgba;
- }
-
- static final int BRIGHT_STEP = 0x30;
-
- public Color brighter()
- {
- return new Color(Math.min(255, getRed() + BRIGHT_STEP),
- Math.min(255, getGreen() + BRIGHT_STEP),
- Math.min(255, getBlue() + BRIGHT_STEP),
- getAlpha());
- }
-
- public Color darker()
- {
- return new Color(Math.max(0, getRed() - BRIGHT_STEP),
- Math.max(0, getGreen() - BRIGHT_STEP),
- Math.max(0, getBlue() - BRIGHT_STEP),
- getAlpha());
- }
-
- public int hashCode()
- {
- return rgba;
- }
-
- public int getTransparency()
- {
- if (getAlpha() == 0xFF)
- return Transparency.OPAQUE;
- else
- return Transparency.TRANSLUCENT;
- }
+/**
+ * Converts the specified string to a number and creates a new instance
+ * of <code>Color</code> from the value.
+ *
+ * @param str The numeric color string.
+ *
+ * @return A new instance of <code>Color</code> for the string.
+ *
+ * @exception NumberFormatException If the string cannot be parsed.
+ */
+public static Color
+decode(String str) throws NumberFormatException
+{
+ Integer i = Integer.decode(str);
+ return(new Color(i.intValue()));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a new instance of <code>Color</code> from the value of
+ * the system property named by the specified string. If the property
+ * does not exist, or cannot be parsed, then <code>null</code> will be
+ * returned.
+ *
+ * @param prop The system property to retrieve.
+ */
+public static Color
+getColor(String prop)
+{
+ return(getColor(prop, null));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a new instance of <code>Color</code> from the value of the
+ * system property named by the specified string. If the property does
+ * not exist, or cannot be parsed, then the default RGB value will be
+ * used to create a return value.
+ *
+ * @param prop The system property to retrieve.
+ * @param defrgb The default RGB value.
+ */
+public static Color
+getColor(String prop, int defrgb)
+{
+ return(getColor(prop, new Color(defrgb)));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a new instance of <code>Color</code> from the value of the
+ * system property named by the specified string. If the property does
+ * not exist, or cannot be parsed, then the default color value will be
+ * returned
+ *
+ * @param prop The system property to retrieve.
+ * @param defcolor The default color
+ */
+public static Color
+getColor(String prop, Color defcolor)
+{
+ String val = System.getProperty(prop);
+ if (val == null)
+ return(defcolor);
+
+ try
+ {
+ return(decode(val));
+ }
+ catch(NumberFormatException e)
+ {
+ return(defcolor);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Converts from the HSB (hue, saturation, brightness) color model to
+ * the RGB (red, green, blue) color model.
+ *
+ * @param hue The hue of the HSB value.
+ * @param saturation The saturation of the HSB value.
+ * @param brightness The brightness of the HSB value.
+ *
+ * @return The RGB value.
+ */
+public static int
+HSBtoRGB(float hue, float saturation, float brightness)
+{
+ // FIXME: Implement
+ throw new RuntimeException("Not implemented yet");
+}
+
+/*************************************************************************/
+
+/**
+ * Converts from the RGB (red, green, blue) color model to the HSB
+ * (hue, saturation, brightness) color model.
+ *
+ * @param red The red part of the RGB value.
+ * @param green The green part of the RGB value.
+ * @param blue The blue part of the RGB value.
+ * @param hsbvals An array of three floats used for storing the HSB values,
+ * or <code>null</code> if this return mechanism is not used.
+ *
+ * @return The HSB value.
+ */
+public static float[]
+RGBtoHSB(int red, int green, int blue, float hsbvals[])
+{
+ // FIXME: Implement
+ throw new RuntimeException("Not implemented yet");
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a new instance of <code>Color</code> based on the specified
+ * HSB values.
+ *
+ * @param hue The hue of the HSB value.
+ * @param saturation The saturation of the HSB value.
+ * @param brightness The brightness of the HSB value.
+ *
+ * @return The new <code>Color</code> object.
+ */
+public static Color
+getHSBColor(float hue, float saturation, float brightness)
+{
+ return(new Color(HSBtoRGB(hue, saturation, brightness)));
}
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * Initializes a new instance of <code>Color</code> using the specified
+ * red, green, and blue values, which must be given as integers in the
+ * range of 0-255.
+ *
+ * @param red The red component of the RGB value.
+ * @param green The green component of the RGB value.
+ * @param blue The blue component of the RGB value.
+ *
+ * @exception IllegalArgumentException If the values are out of range.
+ */
+public
+Color(int red, int green, int blue)
+{
+ if ((red < 0) || (red > 255) || (green < 0) || (green > 255) ||
+ (blue < 0) || (blue > 255))
+ throw new IllegalArgumentException("Bad RGB values");
+
+ value = blue + (green << 8) + (red << 16);
+}
+
+public
+Color(int red, int green, int blue, int alpha)
+{
+ if ((red < 0) || (red > 255) || (green < 0) || (green > 255) ||
+ (blue < 0) || (blue > 255))
+ throw new IllegalArgumentException("Bad RGB values");
+
+ value = blue + (green << 8) + (red << 16) + (alpha << 24);
+}
+
+/*************************************************************************/
+
+/**
+ * Initializes a new instance of <code>Color</code> using the specified
+ * RGB value. The blue value is in bits 0-7, green in bits 8-15, and
+ * red in bits 16-23. The other bits are ignored.
+ *
+ * @param value The RGB value
+ */
+public
+Color(int value)
+{
+ this.value = value;
+}
+
+public
+Color(int value, boolean hasalpha)
+{
+ this.value = value;
+ if (! hasalpha)
+ this.value |= 0xFF000000;
+}
+
+/*************************************************************************/
+
+/**
+ * Initializes a new instance of <code>Color</code> using the specified
+ * RGB values. These must be in the range of 0.0-1.0.
+ *
+ * @param red The red component of the RGB value.
+ * @param green The green component of the RGB value.
+ * @param blue The blue component of the RGB value.
+ *
+ * @exception IllegalArgumentException If the values are out of range.
+ */
+public
+Color(float red, float green, float blue)
+{
+ if ((red < 0.0) || (red > 1.0) || (green < 0.0) || (green > 1.0) ||
+ (blue < 0.0) || (blue > 1.0))
+ throw new IllegalArgumentException("Bad RGB values");
+
+ int redval = (int)(255 * red);
+ int greenval = (int)(255 * green);
+ int blueval = (int)(255 * blue);
+
+ value = blueval + (greenval << 8) + (redval << 16);
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Returns the red value for this color.
+ *
+ * @return The red value for this color.
+ */
+public int
+getRed()
+{
+ int redval = (value & redmask) >> 16;
+
+ return(redval);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the green value for this color.
+ *
+ * @return The green value for this color.
+ */
+public int
+getGreen()
+{
+ int greenval = (value & greenmask) >> 8;
+
+ return(greenval);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the blue value for this color.
+ *
+ * @return The blue value for this color.
+ */
+public int
+getBlue()
+{
+ int blueval = (value & bluemask);
+
+ return(blueval);
+}
+
+public int
+getAlpha()
+{
+ int alphaval = (value & alphamask);
+
+ return(alphaval);
+}
+
+public int
+getTransparency()
+{
+ if (getAlpha() == 0xFF)
+ return Transparency.OPAQUE;
+ else
+ return Transparency.TRANSLUCENT;
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the RGB value for this color. The blue value will be in bits
+ * 0-7, green in 8-15, and red in 6-23. The upper bits should be ignored.
+ *
+ * @return The RGB value for this color.
+ */
+public int
+getRGB()
+{
+ return(value);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a brighter version of this color. This is done by increasing
+ * the RGB values by an arbitrary scale factor. Note that this method
+ * and the <code>darker()</code> method are not necessarily inverses.
+ *
+ * @return A brighter version of this color.
+ */
+public Color
+brighter()
+{
+ return new Color(Math.min(255, getRed() + BRIGHT_STEP),
+ Math.min(255, getGreen() + BRIGHT_STEP),
+ Math.min(255, getBlue() + BRIGHT_STEP),
+ getAlpha());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a darker version of this color. This is done by decreasing
+ * the RGB values by an arbitrary scale factor. Note that this method
+ * and the <code>brighter()</code> method are not necessarily inverses.
+ *
+ * @return A darker version of this color.
+ */
+public Color
+darker()
+{
+ return new Color(Math.max(0, getRed() - BRIGHT_STEP),
+ Math.max(0, getGreen() - BRIGHT_STEP),
+ Math.max(0, getBlue() - BRIGHT_STEP),
+ getAlpha());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a hash value for this color.
+ *
+ * @return A hash value for this color.
+ */
+public int
+hashCode()
+{
+ return(value);
+}
+
+/*************************************************************************/
+
+/**
+ * Tests this object for equality against the specified object. This will
+ * be true if and only if the specified object is an instance of
+ * <code>Color</code> and has the same red, green, and blue values as
+ * this object.
+ *
+ * @return <code>true</code> if the specified object is equal to this one,
+ * <code>false</code> otherwise.
+ */
+public boolean
+equals(Object obj)
+{
+ if (!(obj instanceof Color))
+ return(false);
+
+ Color c = (Color)obj;
+ return value == c.value;
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a string representation of this object.
+ *
+ * @return A string representation of this object.
+ */
+public String
+toString()
+{
+ return(getClass().getName() + "(red=" + getRed() + ",green=" + getGreen() +
+ ",blue=" + getBlue() + ")");
+}
+
+} // class Color
+
diff --git a/libjava/java/awt/Cursor.java b/libjava/java/awt/Cursor.java
index 80f28e6ed73..79b1d6c52ed 100644
--- a/libjava/java/awt/Cursor.java
+++ b/libjava/java/awt/Cursor.java
@@ -1,39 +1,126 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
-package java.awt;
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-/* A somewhat incomplete placeholder. */
+package java.awt;
+
+/**
+ * This class represents various predefined cursor types.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
public class Cursor implements java.io.Serializable
{
- public static final int DEFAULT_CURSOR = 0,
- CROSSHAIR_CURSOR = 1,
- TEXT_CURSOR = 2,
- WAIT_CURSOR = 3,
- SW_RESIZE_CURSOR = 4,
- SE_RESIZE_CURSOR = 5,
- NW_RESIZE_CURSOR = 6,
- NE_RESIZE_CURSOR = 7,
- N_RESIZE_CURSOR = 8,
- S_RESIZE_CURSOR = 9,
- W_RESIZE_CURSOR = 10,
- E_RESIZE_CURSOR = 11,
- HAND_CURSOR = 12,
- MOVE_CURSOR = 13,
- CUSTOM_CURSOR = 0xFFFFFFFF;
+ /**
+ * Constant for the system default cursor type
+ */
+ public static final int DEFAULT_CURSOR = 0;
+
+ /**
+ * Constant for a cross-hair cursor.
+ */
+ public static final int CROSSHAIR_CURSOR = 1;
+
+ /**
+ * Constant for a cursor over a text field.
+ */
+ public static final int TEXT_CURSOR = 2;
+
+ /**
+ * Constant for a cursor to display while waiting for an action to complete.
+ */
+ public static final int WAIT_CURSOR = 3;
+
+ /**
+ * Cursor used over SW corner of window decorations.
+ */
+ public static final int SW_RESIZE_CURSOR = 4;
+
+ /**
+ * Cursor used over SE corner of window decorations.
+ */
+ public static final int SE_RESIZE_CURSOR = 5;
+
+ /**
+ * Cursor used over NW corner of window decorations.
+ */
+ public static final int NW_RESIZE_CURSOR = 6;
+
+ /**
+ * Cursor used over NE corner of window decorations.
+ */
+ public static final int NE_RESIZE_CURSOR = 7;
+
+ /**
+ * Cursor used over N edge of window decorations.
+ */
+ public static final int N_RESIZE_CURSOR = 8;
+
+ /**
+ * Cursor used over S edge of window decorations.
+ */
+ public static final int S_RESIZE_CURSOR = 9;
+
+ /**
+ * Cursor used over W edge of window decorations.
+ */
+ public static final int W_RESIZE_CURSOR = 10;
+
+ /**
+ * Cursor used over E edge of window decorations.
+ */
+ public static final int E_RESIZE_CURSOR = 11;
+
+ /**
+ * Constant for a hand cursor.
+ */
+ public static final int HAND_CURSOR = 12;
+
+ /**
+ * Constant for a cursor used during window move operations.
+ */
+ public static final int MOVE_CURSOR = 13;
+
+ public static final int CUSTOM_CURSOR = 0xFFFFFFFF;
private static final int PREDEFINED_COUNT = 14;
protected static Cursor[] predefined = new Cursor[PREDEFINED_COUNT];
protected String name;
+
+ /**
+ * @serial The numeric id of this cursor.
+ */
int type;
+ /**
+ * Initializes a new instance of <code>Cursor</code> with the specified
+ * type.
+ *
+ * @param type The cursor type.
+ */
public Cursor(int type)
{
if (type < 0 || type >= PREDEFINED_COUNT)
@@ -43,14 +130,25 @@ public class Cursor implements java.io.Serializable
}
/** This constructor is used internally only.
- * Application code should call Toolkit.createCustomCursor().
- */
+ * Application code should call Toolkit.createCustomCursor().
+ */
protected Cursor(String name)
{
this.name = name;
this.type = CUSTOM_CURSOR;
}
+ /**
+ * Returns an instance of <code>Cursor</code> for one of the specified
+ * predetermined types.
+ *
+ * @param type The type contant from this class.
+ *
+ * @return The requested predefined cursor.
+ *
+ * @exception IllegalArgumentException If the constant is not one of the
+ * predefined cursor type constants from this class.
+ */
public static Cursor getPredefinedCursor(int type)
{
if (type < 0 || type >= PREDEFINED_COUNT)
@@ -67,11 +165,21 @@ public class Cursor implements java.io.Serializable
return null;
}
+ /**
+ * Returns an instance of the system default cursor type.
+ *
+ * @return The system default cursor.
+ */
public static Cursor getDefaultCursor()
{
- return getPredefinedCursor(0);
+ return getPredefinedCursor(DEFAULT_CURSOR);
}
+ /**
+ * Returns the numeric type identifier for this cursor.
+ *
+ * @return The cursor id.
+ */
public int getType()
{
return type;
diff --git a/libjava/java/awt/Dialog.java b/libjava/java/awt/Dialog.java
index 7b849079316..5469d8de906 100644
--- a/libjava/java/awt/Dialog.java
+++ b/libjava/java/awt/Dialog.java
@@ -1,163 +1,303 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* Dialog.java -- An AWT dialog box
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt;
import java.awt.peer.DialogPeer;
+import java.awt.peer.WindowPeer;
+import java.awt.peer.ContainerPeer;
+import java.awt.peer.ComponentPeer;
+
+/**
+ * A dialog box widget class.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@redhat.com>
+ */
+public class Dialog extends Window implements java.io.Serializable
+{
+
+/*
+ * Static Variables
+ */
+
+// Serialization constant
+private static final long serialVersionUID = 5920926903803293709L;
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
+ */
+
+/**
+ * @serial Indicates whether or not this dialog box is modal.
+ */
+private boolean modal;
+
+/**
+ * @serial Indicates whether or not this dialog box is resizable.
+ */
+private boolean resizable;
+
+/**
+ * @serial The title string for this dialog box, which can be
+ * <code>null</code>.
+ */
+private String title;
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * Initializes a new instance of <code>Dialog</code> with the specified
+ * parent, that is not resizable and not modal, and which has no title.
+ *
+ * @param parent The parent frame of this dialog box.
+ */
+public
+Dialog(Frame parent)
+{
+ this(parent, "", false);
+}
+
+/*************************************************************************/
+
+/**
+ * Initializes a new instance of <code>Dialog</code> with the specified
+ * parent and modality, that is not resizable and which has no title.
+ *
+ * @param parent The parent frame of this dialog box.
+ * @param modal <true> if this dialog box is modal, <code>false</code>
+ * otherwise.
+ */
+public
+Dialog(Frame parent, boolean modal)
+{
+ this(parent, "", modal);
+}
+
+/*************************************************************************/
+
+/**
+ * Initializes a new instance of <code>Dialog</code> with the specified
+ * parent, that is not resizable and not modal, and which has the specified
+ * title.
+ *
+ * @param parent The parent frame of this dialog box.
+ * @param title The title string for this dialog box.
+ */
+public
+Dialog(Frame parent, String title)
+{
+ this(parent, title, false);
+}
+
+/*************************************************************************/
/**
- * @author Tom Tromey <tromey@redhat.com>
- * @date April 17, 2001
+ * Initializes a new instance of <code>Dialog</code> with the specified,
+ * parent, title, and modality, that is not resizable.
+ *
+ * @param parent The parent frame of this dialog box.
+ * @param title The title string for this dialog box.
+ * @param modal <true> if this dialog box is modal, <code>false</code>
+ * otherwise.
+ */
+public
+Dialog(Frame parent, String title, boolean modal)
+{
+ super(parent);
+
+ this.title = title;
+ this.modal = modal;
+ resizable = false;
+
+ setLayout(new BorderLayout());
+}
+
+public
+Dialog (Dialog owner)
+{
+ this (owner, "", false);
+}
+
+public
+Dialog (Dialog owner, String title)
+{
+ this (owner, title, false);
+}
+
+public
+Dialog (Dialog owner, String title, boolean modal)
+{
+ super (owner);
+ this.modal = modal;
+ this.title = title;
+ setLayout (new BorderLayout ());
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
*/
-public class Dialog extends Window
-{
- public Dialog (Dialog owner)
- {
- this (owner, "", false);
- }
-
- public Dialog (Dialog owner, String title)
- {
- this (owner, title, false);
- }
-
- public Dialog (Dialog owner, String title, boolean modal)
- {
- super (owner);
- this.modal = modal;
- this.title = title;
- setLayout (new BorderLayout ());
- }
-
- public Dialog (Frame owner)
- {
- this (owner, "", false);
- }
-
- public Dialog (Frame owner, boolean modal)
- {
- this (owner, "", modal);
- }
-
- public Dialog (Frame owner, String title)
- {
- this (owner, title, false);
- }
-
- public Dialog (Frame owner, String title, boolean modal)
- {
- super (owner);
- this.modal = modal;
- this.title = title;
- setLayout (new BorderLayout ());
- }
-
- /** Create the peer if it does not already exist. */
- public void addNotify ()
- {
- if (peer == null)
- peer = getToolkit ().createDialog (this);
- super.addNotify ();
- }
-
- public boolean isModal ()
- {
- return modal;
- }
-
- public void setModal (boolean modal)
- {
- this.modal = modal;
- }
-
- public String getTitle ()
- {
- return title;
- }
-
- public void setTitle (String title)
- {
- this.title = title;
- if (peer != null)
- {
- DialogPeer d = (DialogPeer) peer;
- d.setTitle (title);
- }
- }
-
- public void show ()
- {
- boolean vis = isVisible ();
- super.show ();
- if (modal && vis)
- {
- // Don't return until something happens. We lock on the peer
- // instead of `this' so that we don't interfere with whatever
- // locks the caller might want to use.
- synchronized (peer)
- {
- try
- {
- peer.wait ();
- }
- catch (InterruptedException _)
- {
- }
- }
- }
- }
-
- public void hide ()
- {
- super.hide ();
- synchronized (peer)
- {
- peer.notify ();
- }
- }
-
- public void dispose ()
- {
- super.dispose ();
- synchronized (peer)
- {
- peer.notify ();
- }
- }
-
- public boolean isResizable ()
- {
- return resizable;
- }
-
- public void setResizable (boolean resizable)
- {
- this.resizable = resizable;
- if (peer != null)
- {
- DialogPeer d = (DialogPeer) peer;
- d.setResizable (resizable);
- }
- }
-
- protected String paramString ()
- {
- return ("Dialog["
- + title + ","
- + modal + ","
- + resizable + "]");
- }
-
- // True if dialog is modal.
- private boolean modal;
- // True if dialog is resizable by the user.
- private boolean resizable = false;
- // Dialog title.
- private String title;
+/**
+ * Returns the title of this dialog box.
+ *
+ * @return The title of this dialog box.
+ */
+public String
+getTitle()
+{
+ return(title);
+}
+
+/*************************************************************************/
+
+/**
+ * Sets the title of this dialog box to the specified string.
+ *
+ * @param title The new title.
+ */
+public synchronized void
+setTitle(String title)
+{
+ this.title = title;
+ if (peer != null)
+ {
+ DialogPeer d = (DialogPeer) peer;
+ d.setTitle (title);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Tests whether or not this dialog box is modal.
+ *
+ * @return <code>true</code> if this dialog box is modal,
+ * <code>false</code> otherwise.
+ */
+public boolean
+isModal()
+{
+ return(modal);
+}
+
+/*************************************************************************/
+
+/**
+ * Changes the modality of this dialog box. This can only be done before
+ * the peer is created.
+ *
+ * @param modal <code>true</code> to make this dialog box modal,
+ * <code>false</code> to make it non-modal.
+ */
+public void
+setModal(boolean modal)
+{
+ this.modal = modal;
+}
+
+/*************************************************************************/
+
+/**
+ * Tests whether or not this dialog box is resizable.
+ *
+ * @return <code>true</code> if this dialog is resizable, <code>false</code>,
+ * otherwise.
+ */
+public boolean
+isResizable()
+{
+ return(resizable);
+}
+
+/*************************************************************************/
+
+/**
+ * Changes the resizability of this dialog box.
+ *
+ * @param resizable <code>true</code> to make this dialog resizable,
+ * <code>false</code> to make it non-resizable.
+ */
+public synchronized void
+setResizable(boolean resizable)
+{
+ this.resizable = resizable;
+ if (peer != null)
+ {
+ DialogPeer d = (DialogPeer) peer;
+ d.setResizable (resizable);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Creates this object's native peer.
+ */
+public synchronized void
+addNotify()
+{
+ if (peer == null)
+ peer = getToolkit ().createDialog (this);
+ super.addNotify ();
}
+
+/*************************************************************************/
+
+/**
+ * Makes this dialog visible and brings it to the front.
+ */
+public void
+show()
+{
+ super.show();
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a debugging string for this component.
+ *
+ * @return A debugging string for this component.
+ */
+protected String
+paramString()
+{
+ return ("title+" + title + ",modal=" + modal +
+ ",resizable=" + resizable + "," + super.paramString());
+}
+
+} // class Dialog
+
diff --git a/libjava/java/awt/FileDialog.java b/libjava/java/awt/FileDialog.java
index f1ba23c358a..247ee596d4d 100644
--- a/libjava/java/awt/FileDialog.java
+++ b/libjava/java/awt/FileDialog.java
@@ -1,119 +1,303 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* FileDialog.java -- A filename selection dialog box
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt;
import java.awt.peer.FileDialogPeer;
+import java.awt.peer.DialogPeer;
+import java.awt.peer.WindowPeer;
+import java.awt.peer.ContainerPeer;
+import java.awt.peer.ComponentPeer;
import java.io.FilenameFilter;
/**
- * @author Tom Tromey <tromey@redhat.com>
- * @date April 20, 2001
+ * This class implements a file selection dialog box widget.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@redhat.com>
+ */
+public class FileDialog extends Dialog implements java.io.Serializable
+{
+
+/*
+ * Static Variables
+ */
+
+/**
+ * Indicates that the purpose of the dialog is for opening a file.
+ */
+public static final int LOAD = 0;
+
+/**
+ * Indicates that the purpose of the dialog is for saving a file.
+ */
+public static final int SAVE = 1;
+
+// Serialization constant
+private static final long serialVersionUID = 5035145889651310422L;
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
*/
-public class FileDialog extends Dialog
+/**
+ * @serial The directory for this file dialog.
+ */
+private String dir;
+
+/**
+ * @serial The filename for this file dialog
+ */
+private String file;
+
+/**
+ * @serial The filter for selecting filenames to display
+ */
+private FilenameFilter filter;
+
+/**
+ * @serial The mode of this dialog, either <code>LOAD</code> or
+ * <code>SAVE</code>.
+ */
+private int mode;
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * Initializes a new instance of <code>FileDialog</code> with the
+ * specified parent. This dialog will have no title and will be for
+ * loading a file.
+ *
+ * @param parent The parent frame for this dialog.
+ */
+public
+FileDialog(Frame parent)
+{
+ this(parent, "", LOAD);
+}
+
+/*************************************************************************/
+
+/**
+ * Initialized a new instance of <code>FileDialog</code> with the
+ * specified parent and title. This dialog will be for opening a file.
+ *
+ * @param parent The parent frame for this dialog.
+ * @param title The title for this dialog.
+ */
+public
+FileDialog(Frame parent, String title)
{
- public static int LOAD = 0;
- public static int SAVE = 1;
-
- public FileDialog (Frame parent)
- {
- this (parent, "", LOAD);
- }
-
- public FileDialog (Frame parent, String title)
- {
- this (parent, title, LOAD);
- }
-
- public FileDialog (Frame parent, String title, int mode)
- {
- super (parent, title, true);
- if (mode != LOAD && mode != SAVE)
- throw new IllegalArgumentException ("unknown mode: " + mode);
- this.mode = mode;
- }
-
- public void addNotify ()
- {
- if (peer == null)
- peer = getToolkit ().createFileDialog (this);
- super.addNotify ();
- }
-
- public String getDirectory ()
- {
- return dir;
- }
-
- public String getFile ()
- {
- return file;
- }
-
- public FilenameFilter getFilenameFilter ()
- {
- return filter;
- }
-
- public int getMode ()
- {
- return mode;
- }
-
- protected String paramString ()
- {
- return ("FileDialog[mode=" + mode
- + ",dir=" + dir
- + ",file=" + file + "]");
- }
-
- public void setDirectory (String dir)
- {
- this.dir = dir;
- if (peer != null)
- {
- FileDialogPeer f = (FileDialogPeer) peer;
- f.setDirectory (dir);
- }
- }
-
- public void setFile (String file)
- {
- this.file = file;
- if (peer != null)
- {
- FileDialogPeer f = (FileDialogPeer) peer;
- f.setFile (file);
- }
- }
-
- public void setFilenameFilter (FilenameFilter filter)
- {
- this.filter = filter;
- if (peer != null)
- {
- FileDialogPeer f = (FileDialogPeer) peer;
- f.setFilenameFilter (filter);
- }
- }
-
- public void setMode (int mode)
- {
- if (mode != LOAD && mode != SAVE)
- throw new IllegalArgumentException ("unknown mode: " + mode);
- this.mode = mode;
- // FIXME: update peer?
- }
-
- // Names here from serialization spec.
- private int mode;
- private String dir;
- private String file;
- private FilenameFilter filter;
+ this(parent, title, LOAD);
}
+
+/*************************************************************************/
+
+/**
+ * Initialized a new instance of <code>FileDialog</code> with the
+ * specified parent, title, and mode.
+ *
+ * @param parent The parent frame for this dialog.
+ * @param title The title for this dialog.
+ * @param mode The mode of the dialog, either <code>LOAD</code> or
+ * <code>SAVE</code>.
+ */
+public
+FileDialog(Frame parent, String title, int mode)
+{
+ super(parent, title, true);
+
+ if ((mode != LOAD) && (mode != SAVE))
+ throw new IllegalArgumentException("Bad mode: " + mode);
+
+ this.mode = mode;
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Returns the mode of this dialog, either <code>LOAD</code> or
+ * <code>SAVE</code>.
+ *
+ * @return The mode of this dialog.
+ */
+public int
+getMode()
+{
+ return(mode);
+}
+
+/*************************************************************************/
+
+/**
+ * Sets the mode of this dialog to either <code>LOAD</code> or
+ * <code>SAVE</code>. This method is only effective before the native
+ * peer is created.
+ *
+ * @param mode The new mode of this file dialog.
+ */
+public void
+setMode(int mode)
+{
+ if ((mode != LOAD) && (mode != SAVE))
+ throw new IllegalArgumentException("Bad mode: " + mode);
+
+ this.mode = mode;
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the directory for this file dialog.
+ *
+ * @return The directory for this file dialog.
+ */
+public String
+getDirectory()
+{
+ return(dir);
+}
+
+/*************************************************************************/
+
+/**
+ * Sets the directory for this file dialog.
+ *
+ * @param dir The new directory for this file dialog.
+ */
+public synchronized void
+setDirectory(String dir)
+{
+ this.dir = dir;
+ if (peer != null)
+ {
+ FileDialogPeer f = (FileDialogPeer) peer;
+ f.setDirectory (dir);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the file that is selected in this dialog.
+ *
+ * @return The file that is selected in this dialog.
+ */
+public String
+getFile()
+{
+ return(file);
+}
+
+/*************************************************************************/
+
+/**
+ * Sets the selected file for this dialog.
+ *
+ * @param file The selected file for this dialog.
+ */
+public synchronized void
+setFile(String file)
+{
+ this.file = file;
+ if (peer != null)
+ {
+ FileDialogPeer f = (FileDialogPeer) peer;
+ f.setFile (file);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the filename filter being used by this dialog.
+ *
+ * @param The filename filter being used by this dialog.
+ */
+public FilenameFilter
+getFilenameFilter()
+{
+ return(filter);
+}
+
+/*************************************************************************/
+
+/**
+ * Sets the filename filter used by this dialog.
+ *
+ * @param filter The new filename filter for this file dialog box.
+ */
+public synchronized void
+setFilenameFilter(FilenameFilter filter)
+{
+ this.filter = filter;
+ if (peer != null)
+ {
+ FileDialogPeer f = (FileDialogPeer) peer;
+ f.setFilenameFilter (filter);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Creates the native peer for this file dialog box.
+ */
+public void
+addNotify()
+{
+ if (peer == null)
+ peer = getToolkit ().createFileDialog (this);
+ super.addNotify ();
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a debugging string for this object.
+ *
+ * @return A debugging string for this object.
+ */
+protected String
+paramString()
+{
+ return ("dir=" + dir + ",file=" + file +
+ ",mode=" + mode + "," + super.paramString());
+}
+
+} // class FileDialog
+
diff --git a/libjava/java/awt/Font.java b/libjava/java/awt/Font.java
index 833b3c85b2b..266a358e30f 100644
--- a/libjava/java/awt/Font.java
+++ b/libjava/java/awt/Font.java
@@ -1,120 +1,414 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* Font.java -- Font object
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
- This file is part of libjava.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libjava License. Please consult the file "LIBJAVA_LICENSE" for
-details. */
package java.awt;
-import java.util.Locale;
+import java.awt.peer.FontPeer;
+import java.util.StringTokenizer;
+
+/**
+ * This class represents a windowing system font.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy <warrenl@cygnus.com>
+ */
+public class Font implements java.io.Serializable
+{
+
+/*
+ * Static Variables
+ */
+
+/**
+ * Constant indicating a "plain" font.
+ */
+public static final int PLAIN = 0;
+
+/**
+ * Constant indicating a "bold" font.
+ */
+public static final int BOLD = 1;
+
+/**
+ * Constant indicating an "italic" font.
+ */
+public static final int ITALIC = 2;
+
+public static final int ROMAN_BASELINE = 0;
+public static final int CENTER_BASELINE = 1;
+public static final int HANGING_BASELINE = 2;
+
+// Serialization constant
+private static final long serialVersionUID = -4206021311591459213L;
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
+ */
+
+/**
+ * The name of this font
+ */
+protected String name;
+
+/**
+ * The font style, which is a combination (by summing, not OR-ing) of
+ * the font style constants in this class.
+ */
+protected int style;
+
+/**
+ * The font point size.
+ */
+protected int size;
+
+protected float pointSize;
+
+// The native peer for this font
+private FontPeer peer;
+
+/*************************************************************************/
+
+/*
+ * Static Methods
+ */
/**
- * @author Warren Levy <warrenl@cygnus.com>
- * @date March 16, 2000.
+ * Creates a <code>Font</code> object from the specified string, which
+ * is in one of the following formats:
+ * <p>
+ * <ul>
+ * <li>fontname-style-pointsize
+ * <li>fontname-style
+ * <li>fontname-pointsize
+ * <li>fontname
+ * </ul>
+ * <p>
+ * The style should be one of BOLD, ITALIC, or BOLDITALIC. The default
+ * style if none is specified is PLAIN. The default size if none
+ * is specified is 12.
+ */
+public static Font
+decode(String fontspec)
+{
+ String name = null;
+ int style = PLAIN;
+ int size = 12;
+
+ StringTokenizer st = new StringTokenizer(fontspec, "-");
+ while (st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ if (name == null)
+ {
+ name = token;
+ continue;
+ }
+
+ if (token.toUpperCase().equals("BOLD"))
+ {
+ style = BOLD;
+ continue;
+ }
+ if (token.toUpperCase().equals("ITALIC"))
+ {
+ style = ITALIC;
+ continue;
+ }
+ if (token.toUpperCase().equals("BOLDITALIC"))
+ {
+ style = BOLD + ITALIC;
+ continue;
+ }
+
+ int tokenval = 0;
+ try
+ {
+ tokenval = Integer.parseInt(token);
+ }
+ catch(Exception e) { ; }
+
+ if (tokenval != 0)
+ size = tokenval;
+ }
+
+ return(new Font(name, style, size));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a <code>Font</code> object from the passed property name.
+ *
+ * @param propname The name of the system property.
+ * @param default Value to use if the property is not found.
+ *
+ * @return The requested font, or <code>default</code> if the property
+ * not exist or is malformed.
+ */
+public static Font
+getFont(String propname, Font defval)
+{
+ String propval = System.getProperty(propname);
+ if (propval != null)
+ return(decode(propval));
+
+ return(defval);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a <code>Font</code> object from the passed property name.
+ *
+ * @param propname The name of the system property.
+ *
+ * @return The requested font, or <code>null</code> if the property
+ * not exist or is malformed.
+ */
+public static Font
+getFont(String propname)
+{
+ return(getFont(propname, null));
+}
+
+/*************************************************************************/
+
+/*
+ * Constructors
*/
/**
- * Written using on-line Java Platform 1.2 API Specification, as well
- * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
- * Status: Stubbed; A very incomplete implementation.
+ * Initializes a new instance of <code>Font</code> with the specified
+ * attributes.
+ *
+ * @param name The name of the font.
+ * @param style The font style.
+ * @param size The font point size.
+ */
+public
+Font(String name, int style, int size)
+{
+ this.name = name;
+ this.style = style;
+ this.size = size;
+ this.pointSize = size;
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
*/
-public class Font
-{
- // FIXME
-
- public static final int PLAIN = 0;
- public static final int BOLD = 1;
- public static final int ITALIC = 2;
- public static final int ROMAN_BASELINE = 0;
- public static final int CENTER_BASELINE = 1;
- public static final int HANGING_BASELINE = 2;
- protected String name;
- protected int style;
- protected int size;
- protected float pointSize;
-
- public Font(String name, int style, int size)
- {
- this.name = name;
- this.style = style & 0x3; // Only use lowest 2 bits.
- this.size = size;
- pointSize = size; // Assume some subclass can set a different val.
- }
-
- public boolean isPlain()
- {
- if (style == PLAIN)
- return true;
-
- return false;
- }
-
- public boolean isBold()
- {
- if ((style & BOLD) == BOLD)
- return true;
-
- return false;
- }
-
- public boolean isItalic()
- {
- if ((style & ITALIC) == ITALIC)
- return true;
-
- return false;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getFamily()
- {
- // FIXME
- return null;
- }
-
- public String getFamily(Locale l)
- {
- // FIXME
- return null;
- }
-
- public int getStyle()
- {
- return style;
- }
-
- public int getSize()
- {
- return size;
- }
-
- public float getSize2D()
- {
- return pointSize;
- }
-
- public static Font decode(String str) { return null; } // FIXME
-
- public String toString()
- {
- String style_str = "";
- if (isPlain())
- style_str = "plain";
- else
- {
- if (isBold())
- style_str += "bold";
- if (isItalic())
- style_str += "italic";
- }
- return getClass().getName() + "[family=" + getFamily() + ",name=" +
- getName() + ",style=" + style_str + ",size=" + getSize() + "]";
- }
+/**
+ * Returns the name of the font.
+ *
+ * @return The name of the font.
+ */
+public String
+getName()
+{
+ return(name);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the style of the font.
+ *
+ * @return The font style.
+ */
+public int
+getSize()
+{
+ return(size);
+}
+
+public float
+getSize2D()
+{
+ return pointSize;
+}
+
+/*************************************************************************/
+
+/**
+ * Tests whether or not this is a plain font. This will be true if
+ * and only if neither the bold nor the italics style is set.
+ *
+ * @return <code>true</code> if this is a plain font, <code>false</code>
+ * otherwise.
+ */
+public boolean
+isPlain()
+{
+ if (style == PLAIN)
+ return(true);
+ else
+ return(false);
+}
+
+/*************************************************************************/
+
+/**
+ * Tests whether or not this font is bold.
+ *
+ * @return <code>true</code> if this font is bold, <code>false</code>
+ * otherwise.
+ */
+public boolean
+isBold()
+{
+ if ((style == BOLD) || (style == (BOLD+ITALIC)))
+ return(true);
+ else
+ return(false);
+}
+
+/*************************************************************************/
+
+/**
+ * Tests whether or not this font is italic.
+ *
+ * @return <code>true</code> if this font is italic, <code>false</code>
+ * otherwise.
+ */
+public boolean
+isItalic()
+{
+ if ((style == ITALIC) || (style == (BOLD+ITALIC)))
+ return(true);
+ else
+ return(false);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the system specific font family name.
+ *
+ * @return The system specific font family name.
+ */
+public String
+getFamily()
+{
+ // FIXME: How do I implement this?
+ return(name);
+}
+
+public int
+getStyle()
+{
+ return style;
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a native peer object for this font.
+ *
+ * @return A native peer object for this font.
+ */
+public FontPeer
+getPeer()
+{
+ if (peer != null)
+ return(peer);
+
+ peer = Toolkit.getDefaultToolkit().getFontPeer(name, style);
+ return(peer);
}
+
+/*************************************************************************/
+
+/**
+ * Returns a hash value for this font.
+ *
+ * @return A hash for this font.
+ */
+public int
+hashCode()
+{
+ return((new String(name + size + style)).hashCode());
+}
+
+/*************************************************************************/
+
+/**
+ * Tests whether or not the specified object is equal to this font. This
+ * will be true if and only if:
+ * <P>
+ * <ul>
+ * <li>The object is not <code>null</code>.
+ * <li>The object is an instance of <code>Font</code>.
+ * <li>The object has the same name, style, and size as this object.
+ * </ul>
+ *
+ * @return <code>true</code> if the specified object is equal to this
+ * object, <code>false</code> otherwise.
+ */
+public boolean
+equals(Object obj)
+{
+ if (obj == null)
+ return(false);
+
+ if (!(obj instanceof Font))
+ return(false);
+
+ Font f = (Font)obj;
+
+ if (!f.name.equals(name))
+ return(false);
+
+ if (f.size != size)
+ return(false);
+
+ if (f.style != style)
+ return(false);
+
+ return(true);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a string representation of this font.
+ *
+ * @return A string representation of this font.
+ */
+public String
+toString()
+{
+ return(getClass().getName() + "(name=" + name + ",style=" + style +
+ ",size=" + size + ")");
+}
+
+} // class Font
+
diff --git a/libjava/java/awt/FontMetrics.java b/libjava/java/awt/FontMetrics.java
index dcd0946fa5b..890ffd164ed 100644
--- a/libjava/java/awt/FontMetrics.java
+++ b/libjava/java/awt/FontMetrics.java
@@ -1,146 +1,338 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* FontMetrics.java -- Information about about a fonts display characteristics
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt;
+// FIXME: I leave many methods basically unimplemented. This
+// should be reviewed.
+
/**
- * Status: Stubbed; A very incomplete implementation.
+ * This class returns information about the display characteristics of
+ * a font. It is abstract, and concrete subclasses should implement at
+ * least the following methods:
+ * <p>
+ * <ul>
+ * <li>getAscent
+ * <li>getDescent
+ * <li>getLeading()
+ * <li>getMaxAdvance()
+ * <li>charWidth(char)
+ * <li>charsWidth(char[], int, int)
+ * </ul>
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
+public abstract class FontMetrics implements java.io.Serializable
+{
+
+/*
+ * Static Variables
*/
-public class FontMetrics implements java.io.Serializable
-{
- protected Font font;
-
- protected FontMetrics(Font font)
- {
- this.font = font;
- }
-
- public Font getFont()
- {
- return font;
- }
-
- public int getLeading()
- {
- return getMaxAscent() + getMaxDescent() - (getAscent() + getDescent());
- }
-
- public int getAscent()
- {
- return getHeight() - (getDescent() + getLeading());
- }
-
- public int getDescent()
- {
- return getHeight() - (getLeading() + getDescent());
- }
-
- public int getHeight()
- {
- return getLeading() + getAscent() + getDescent();
- }
-
- public int getMaxAscent()
- {
- return getAscent();
- }
-
- public int getMaxDescent()
- {
- return getDescent();
- }
-
- /* @deprecated Use getMaxDescent() instead. */
- public int getMaxDecent()
- {
- return getMaxDescent();
- }
-
- /** @return max advance, or -1 if unknown. */
- public int getMaxAdvance()
- {
- return -1;
- }
-
-
- public int charWidth(int ch)
- {
- return charWidth((char) ch);
- }
-
- public int charWidth(char ch)
- {
- Character chObj = new Character(ch);
- return stringWidth(chObj.toString());
- }
-
- public int stringWidth(String str)
- {
- return charsWidth(str.toCharArray(), 0, str.length());
- }
-
- public int charsWidth(char[] data, int off, int len)
- {
- return stringWidth(new String(data, off, len));
- }
-
- public int bytesWidth(byte[] data, int off, int len)
- {
- return stringWidth(new String(data, off, len));
- }
-
- public int[] getWidths()
- {
- int[] widths = new int[256];
- for (char c=0; c<256; c++) widths[c] = charWidth(c);
- return widths;
- }
-
- public boolean hasUniformLineMetrics()
- {
- // FIXME
- return false;
- }
-
- // Don't have LineMetrics yet...
- /*
- public LineMetrics getLineMetrics(String str, Graphics context)
-
- public LineMetrics getLineMetrics(String str, int beginIndex, int limit,
- Graphics context)
-
- public LineMetrics getLineMetrics(char[] chars, int beginIndex, int limit,
- Graphics context)
-
- public LineMetrics getLineMetrics(CharacterIterator ci, int beginIndex,
- int limit, Graphics context)
- */
-
- // Don't have Java2D yet.
- /*
- public Rectangle2D getStringBounds(String str, Graphics context)
-
- public Rectangle2D getStringBounds(String str, int beginIndex, int limit,
- Graphics context)
-
- public Rectangle2D getStringBounds(char[] chars, int beginIndex, int limit,
- Graphics context)
-
- public Rectangle2D getStringBounds(CharacterIterator ci, int beginIndex,
- int limit, Graphics context)
-
- public Rectangle2D getMaxCharBounds(Graphics context)
- */
-
- public String toString()
- {
- return this.getClass() + "[font=" + font + ",ascent=" + getAscent()
- + ",descent=" + getDescent() + ",height=" + getHeight() + "]";
- }
+// Serialization constant
+private static final long serialVersionUID = 1681126225205050147L;
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
+ */
+
+/**
+ * This is the font for which metrics will be returned.
+ */
+protected Font font;
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * Initializes a new instance of <code>FontMetrics</code> for the
+ * specified font.
+ *
+ * @param font The font to return metric information for.
+ */
+protected
+FontMetrics(Font font)
+{
+ this.font = font;
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Returns the font that this object is creating metric information fo.
+ *
+ * @return The font for this object.
+ */
+public Font
+getFont()
+{
+ return(font);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the leading, or spacing between lines, for this font.
+ *
+ * @return The font leading.
+ */
+public int
+getLeading()
+{
+ return(0);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the ascent of the font, which is the distance from the base
+ * to the top of the majority of characters in the set. Some characters
+ * can exceed this value however.
+ *
+ * @return The font ascent.
+ */
+public int
+getAscent()
+{
+ return(1);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the descent of the font, which is the distance from the base
+ * to the bottom of the majority of characters in the set. Some characters
+ * can exceed this value however.
+ *
+ * @return The font descent.
+ */
+public int
+getDescent()
+{
+ return(1);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the height of a line in this font. This will be the sum
+ * of the leading, the ascent, and the descent.
+ *
+ * @return The height of the font.
+ */
+public int
+getHeight()
+{
+ return(getAscent() + getDescent() + getLeading());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the maximum ascent value. This is the maximum distance any
+ * character in the font rised above the baseline.
+ *
+ * @return The maximum ascent for this font.
+ */
+public int
+getMaxAscent()
+{
+ return(getAscent());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the maximum descent value. This is the maximum distance any
+ * character in the font extends below the baseline.
+ *
+ * @return The maximum descent for this font.
+ */
+public int
+getMaxDescent()
+{
+ return(getDescent());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the maximum descent value. This is the maximum distance any
+ * character in the font extends below the baseline.
+ *
+ * @return The maximum descent for this font.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>getMaxDescent()</code>.
+ */
+public int
+getMaxDecent()
+{
+ return(getMaxDescent());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the width of the widest character in the font.
+ *
+ * @return The width of the widest character in the font.
+ */
+public int
+getMaxAdvance()
+{
+ return(-1);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the width of the specified character.
+ *
+ * @param ch The character to return the width of.
+ *
+ * @return The width of the specified character.
+ */
+public int
+charWidth(int ch)
+{
+ return(charWidth((char)ch));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the width of the specified character.
+ *
+ * @param ch The character to return the width of.
+ *
+ * @return The width of the specified character.
+ */
+public int
+charWidth(char ch)
+{
+ return(1);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the total width of the specified string
+ *
+ * @param str The string to return the width of.
+ *
+ * @return The width of the string.
+ */
+public int
+stringWidth(String str)
+{
+ char[] buf = new char[str.length()];
+ str.getChars(0, str.length(), buf, 0);
+
+ return(charsWidth(buf, 0, buf.length));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the total width of the specified character array.
+ *
+ * @param buf The character array containing the data.
+ * @param offset The offset into the array to start calculating from.
+ * @param len The total number of bytes to process.
+ *
+ * @return The width of the requested characters.
+ */
+public int
+charsWidth(char buf[], int offset, int len)
+{
+ int total_width = 0;
+ for (int i = offset; i < len; i++)
+ total_width = charWidth(buf[i]);
+
+ return(total_width);
}
+
+/*************************************************************************/
+
+/**
+ * Returns the total width of the specified byte array.
+ *
+ * @param buf The byte array containing the data.
+ * @param offset The offset into the array to start calculating from.
+ * @param len The total number of bytes to process.
+ *
+ * @return The width of the requested characters.
+ */
+public int
+bytesWidth(byte buf[], int offset, int len)
+{
+ int total_width = 0;
+ for (int i = offset; i < len; i++)
+ total_width = charWidth((char)buf[i]);
+
+ return(total_width);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the widths of the first 256 characters in the font.
+ *
+ * @return The widths of the first 256 characters in the font.
+ */
+public int[]
+getWidths()
+{
+ return(new int[256]);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a string representation of this object.
+ *
+ * @return A string representation of this object.
+ */
+public String
+toString()
+{
+ return (this.getClass() + "[font=" + font + ",ascent=" + getAscent()
+ + ",descent=" + getDescent() + ",height=" + getHeight() + "]");
+}
+
+} // class FontMetrics
+
diff --git a/libjava/java/awt/Image.java b/libjava/java/awt/Image.java
index d97364861e0..4e263360169 100644
--- a/libjava/java/awt/Image.java
+++ b/libjava/java/awt/Image.java
@@ -1,51 +1,186 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Image.java -- Java class for images
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImageProducer;
+import java.awt.image.*;
/**
- * @author Warren Levy <warrenl@cygnus.com>
- * @date March 15, 2000.
+ * This is the abstract superclass of all image objects in Java.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
+public abstract class Image
+{
+
+/*
+ * Static Variables
*/
/**
- * Written using on-line Java Platform 1.2 API Specification, as well
- * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
- * Status: Mostly complete, but look for FIXMEs.
+ * Constant indicating that the default scaling algorithm should be used.
+ */
+public static final int SCALE_DEFAULT = 1;
+
+/**
+ * Constant indicating that a fast scaling algorithm should be used.
+ */
+public static final int SCALE_FAST = 2;
+
+/**
+ * Constant indicating that a smooth scaling algorithm should be used.
+ */
+public static final int SCALE_SMOOTH = 4;
+
+/**
+ * Constant indicating that the <code>ReplicateScaleFilter</code> class
+ * algorithm should be used for scaling.
+ */
+public static final int SCALE_REPLICATE = 8;
+
+/**
+ * Constant indicating that the area averaging scaling algorithm should be
+ * used.
+ */
+public static final int SCALE_AREA_AVERAGING = 16;
+
+/**
+ * This variable is returned whenever a property that is not defined
+ * is requested.
+ */
+public static final Object UndefinedProperty = Image.class;
+
+/*************************************************************************/
+
+/*
+ * Constructors
*/
-public abstract class Image extends Object
+/**
+ * A default constructor for subclasses.
+ */
+public
+Image()
{
- public static final Object UndefinedProperty = new Object();
+}
- public static final int SCALE_DEFAULT = 1<<0,
- SCALE_FAST = 1<<1,
- SCALE_SMOOTH = 1<<2,
- SCALE_REPLICATE = 1<<3,
- SCALE_AREA_AVERAGING = 1<<4;
+/*************************************************************************/
- public abstract int getWidth(ImageObserver observer);
+/*
+ * Instance Methods
+ */
+
+/**
+ * Returns the width of the image, or -1 if it is unknown. If the
+ * image width is unknown, the observer object will be notified when
+ * the value is known.
+ *
+ * @param observer The image observer for this object.
+ */
+public abstract int
+getWidth(ImageObserver observer);
+
+/*************************************************************************/
+
+/**
+ * Returns the height of the image, or -1 if it is unknown. If the
+ * image height is unknown, the observer object will be notified when
+ * the value is known.
+ *
+ * @param observer The image observer for this object.
+ */
+public abstract int
+getHeight(ImageObserver observer);
+
+/*************************************************************************/
- public abstract int getHeight(ImageObserver observer);
+/**
+ * Returns the image producer object for this object.
+ *
+ * @return The image producer for this object.
+ */
+public abstract ImageProducer
+getSource();
- public abstract ImageProducer getSource();
-
- public abstract Graphics getGraphics();
+/*************************************************************************/
+
+/**
+ * Returns a graphics context object for drawing an off-screen object.
+ * This method is only valid for off-screen objects.
+ *
+ * @return A graphics context object for an off-screen object.
+ */
+public abstract Graphics
+getGraphics();
- public abstract Object getProperty(String name, ImageObserver observer);
+/*************************************************************************/
- public Image getScaledInstance(int width, int height, int hints)
+/**
+ * This method requests a named property for an object. The value of the
+ * property is returned. The value <code>UndefinedProperty</code> is
+ * returned if there is no property with the specified name. The value
+ * <code>null</code> is returned if the properties for the object are
+ * not yet known. In this case, the specified image observer is notified
+ * when the properties are known.
+ *
+ * @param name The requested property name.
+ * @param observer The image observer for this object.
+ */
+public abstract Object
+getProperty(String name, ImageObserver observer);
+
+/*************************************************************************/
+
+/**
+ * Scales the image to the requested dimension.
+ *
+ * XXX: FIXME
+ *
+ * @param width The width of the scaled image.
+ * @param height The height of the scaled image.
+ * @param flags A value indicating the algorithm to use, which will be
+ * set from contants defined in this class.
+ *
+ * @return The scaled <code>Image</code> object.
+ */
+public Image
+getScaledInstance(int width, int height, int flags)
{
- throw new UnsupportedOperationException("FIXME: not implemented yet");
+ return null;
}
- public abstract void flush();
-}
+/*************************************************************************/
+
+/**
+ * Flushes (that is, destroys) any resources used for this image. This
+ * includes the actual image data.
+ */
+public abstract void
+flush();
+
+} // class Image
+
diff --git a/libjava/java/awt/ImageMediaEntry.java b/libjava/java/awt/ImageMediaEntry.java
new file mode 100644
index 00000000000..cd2439058ee
--- /dev/null
+++ b/libjava/java/awt/ImageMediaEntry.java
@@ -0,0 +1,75 @@
+/* ImageMediaEntry.java -- A media entry type for images.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
+
+
+package java.awt;
+
+import java.awt.image.ImageObserver;
+import java.io.Serializable;
+
+/**
+ * A concrete MediaEntry subtype for images.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
+class ImageMediaEntry extends MediaEntry implements ImageObserver,
+ Serializable
+{
+
+private Image image;
+private int width;
+private int height;
+
+ImageMediaEntry(MediaTracker tracker, Image image, int ID, int width, int height)
+{
+ super(tracker, ID);
+ this.image = image;
+ this.width = width;
+ this.height = height;
+}
+
+public Object
+getMedia()
+{
+ return(image.getSource()); // FIXME: Is this really right?
+}
+
+public void
+startLoad()
+{
+ int status = getStatus();
+// status |= MediaEntry.LOADSTARTED;
+}
+
+public boolean
+imageUpdate(Image image, int flags, int x, int y, int width, int height)
+{
+ // implement me
+ return true;
+}
+
+} // class ImageMediaEntry
+
diff --git a/libjava/java/awt/Insets.java b/libjava/java/awt/Insets.java
index c28353e435e..20857d560bd 100644
--- a/libjava/java/awt/Insets.java
+++ b/libjava/java/awt/Insets.java
@@ -1,56 +1,163 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Insets.java -- Information about a container border.
+ Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt;
+/**
+ * This class represents the "margin" or space around a container.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
public class Insets implements Cloneable, java.io.Serializable
{
- public int top;
- public int left;
- public int bottom;
- public int right;
-
- public Insets(int top, int left, int bottom, int right)
- {
- this.top = top;
- this.left = left;
- this.bottom = bottom;
- this.right = right;
- }
-
- public boolean equals(Object obj)
- {
- if (obj instanceof Insets)
- {
- Insets i = (Insets) obj;
- return (i.top == top
- && i.left == left
- && i.bottom == bottom
- && i.right == right);
- }
- return false;
- }
-
- public int hashCode()
- {
- // FIXME: what is the correct algorithm for this?
- return (top * (2 * left) * (3 * right) * (4 * bottom));
- }
-
- public String toString()
- {
- return (getClass() + "[top=" + top + ",left=" + left + ",bottom="
- + bottom + ",right=" + right + "]");
- }
-
- public Object clone()
- {
- Insets r = new Insets(top, left, bottom, right);
- return r;
- }
+
+/*
+ * Instance Variable
+ */
+
+/**
+ * @serial The top inset
+ */
+public int top;
+
+/**
+ * @serial This bottom inset
+ */
+public int bottom;
+
+/**
+ * @serial The left inset
+ */
+public int left;
+
+/**
+ * @serial The right inset
+ */
+public int right;
+
+/*************************************************************************/
+
+/**
+ * Initializes a new instance of <code>Inset</code> with the specified
+ * inset values.
+ *
+ * @param top The top inset
+ * @param left The left inset
+ * @param bottom The bottom inset
+ * @param right The right inset
+ */
+public
+Insets(int top, int left, int bottom, int right)
+{
+ this.top = top;
+ this.left = left;
+ this.bottom = bottom;
+ this.right = right;
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Tests whether this object is equal to the specified object. This will
+ * be true if and only if the specified object:
+ * <p>
+ * <ul>
+ * <li>Is not <code>null</code>.
+ * <li>Is an instance of <code>Insets</code>.
+ * <li>Has the same top, bottom, left, and right inset values as this object.
+ * </ul>
+ *
+ * @param obj The object to test against.
+ *
+ * @return <code>true</code> if the specified object is equal to this
+ * one, <code>false</code> otherwise.
+ */
+public boolean
+equals(Object obj)
+{
+ if (!(obj instanceof Insets))
+ return(false);
+
+ Insets i = (Insets)obj;
+
+ if (i.top != top)
+ return(false);
+ if (i.bottom != bottom)
+ return(false);
+ if (i.left != left)
+ return(false);
+ if (i.right != right)
+ return(false);
+
+ return(true);
+}
+
+public int
+hashCode()
+{
+ return top + bottom + left + right;
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a string representation of this object.
+ *
+ * @return A string representation of this object.
+ */
+public String
+toString()
+{
+ return(getClass().getName() + "(top=" + top + ",bottom=" + bottom +
+ ",left=" + left + ",right=" + right + ")");
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a copy of this object.
+ *
+ * @return A copy of this object.
+ */
+public Object
+clone()
+{
+ try
+ {
+ return(super.clone());
+ }
+ catch(Exception e)
+ {
+ return(null);
+ }
}
+
+} // class Insets
diff --git a/libjava/java/awt/Label.java b/libjava/java/awt/Label.java
index 637348a3324..3f972aa2999 100644
--- a/libjava/java/awt/Label.java
+++ b/libjava/java/awt/Label.java
@@ -225,8 +225,8 @@ addNotify()
protected String
paramString()
{
- return(getClass().getName() + "(text=" + getText() + ",alignment=" +
- getAlignment() + ")");
+ return ("text=" + getText() + ",alignment=" +
+ getAlignment() + "," + super.paramString());
}
} // class Label
diff --git a/libjava/java/awt/List.java b/libjava/java/awt/List.java
index f3d5e4becfa..c4fa0aa879b 100644
--- a/libjava/java/awt/List.java
+++ b/libjava/java/awt/List.java
@@ -1,443 +1,994 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* List.java -- A listbox widget
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt;
+import java.io.Serializable;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
import java.awt.peer.ListPeer;
-import java.awt.event.*;
+import java.awt.peer.ComponentPeer;
import java.util.Vector;
/**
- * @author Tom Tromey <tromey@redhat.com>
- * @date April 17, 2001
- * Status: incomplete
+ * Class that implements a listbox widget
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
+public class List extends Component implements ItemSelectable, Serializable
+{
+
+/*
+ * Static Variables
+ */
+
+// Serialization constant
+private static final long serialVersionUID = -3304312411574666869L;
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
+ */
+
+// FIXME: Need read/writeObject
+
+/**
+ * @serial The items in the list.
+ */
+private Vector items = new Vector();
+
+/**
+ * @serial Indicates whether or not multiple items can be selected
+ * simultaneously.
+ */
+private boolean multipleMode;
+
+/**
+ * @serial The number of rows in the list. This is set on creation
+ * only and cannot be modified.
+ */
+private int rows;
+
+/**
+ * @serial An array of the item indices that are selected.
+ */
+private int[] selected;
+
+/**
+ * @serial An index value used by <code>makeVisible()</code> and
+ * <code>getVisibleIndex</code>.
+ */
+private int visibleIndex;
+
+// The list of ItemListeners for this object.
+private ItemListener item_listeners;
+
+// The list of ActionListeners for this object.
+private ActionListener action_listeners;
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * Initializes a new instance of <code>List</code> with no visible lines
+ * and multi-select disabled.
+ */
+public
+List()
+{
+ this(4, false);
+}
+
+/*************************************************************************/
+
+/**
+ * Initializes a new instance of <code>List</code> with the specified
+ * number of visible lines and multi-select disabled.
+ *
+ * @param lines The number of visible lines in the list.
+ */
+public
+List(int rows)
+{
+ this(rows, false);
+}
+
+/*************************************************************************/
+
+/**
+ * Initializes a new instance of <code>List</code> with the specified
+ * number of lines and the specified multi-select setting.
+ *
+ * @param lines The number of visible lines in the list.
+ * @param multipleMode <code>true</code> if multiple lines can be selected
+ * simultaneously, <code>false</code> otherwise.
+ */
+public
+List(int rows, boolean multipleMode)
+{
+ this.rows = rows;
+ this.multipleMode = multipleMode;
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
*/
-public class List extends Component implements ItemSelectable
-{
- /** Creates a new scrolling list with four rows.
- * Initially, multiple selections are not allowed.
- */
- public List ()
- {
- this (4, false);
- }
-
- /** Create a new scrolling list with the indicated number of rows.
- * Initially, multiple selections are not allowed.
- * @param rows Number of rows
- */
- public List (int rows)
- {
- this (rows, false);
- }
-
- /** Create a new scrolling list with the indicated number of rows.
- * @param rows Number of rows
- * @param multiple True if multiple selections allowed
- */
- public List (int rows, boolean multiple)
- {
- this.rows = rows;
- this.multipleMode = multiple;
- }
-
- /** Create the peer if it does not already exist. */
- public void addNotify ()
- {
- if (peer != null)
- peer = getToolkit ().createList (this);
- super.addNotify ();
- }
-
- public int getItemCount ()
- {
- return items.size ();
- }
-
- /** @deprecated Use getItemCount() instead. */
- public int countItems ()
- {
- return getItemCount ();
- }
-
- public String getItem (int index)
- {
- return (String) items.elementAt (index);
- }
-
- public String[] getItems ()
- {
- String[] els = new String[items.size ()];
- items.copyInto (els);
- return els;
- }
-
- public void add (String item)
- {
- add (item, items.size ());
- }
-
- /** @deprecated Use add() instead. */
- public void addItem (String item)
- {
- add (item);
- }
-
- public void add (String item, int index)
- {
- items.insertElementAt (item, index);
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.add (item, index);
- }
- }
-
- /** @deprecated Use add() instead. */
- public void addItem (String item, int index)
- {
- add (item, index);
- }
-
- public void replaceItem (String item, int index)
- {
- items.setElementAt (item, index);
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.delItems (index, index);
- l.add (item, index);
- }
- }
-
- public void removeAll ()
- {
- items.clear ();
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.removeAll ();
- }
- }
-
- /** @deprecated Use removeAll() instead. */
- public void clear ()
- {
- removeAll ();
- }
-
- public void remove (String item)
- {
- remove (items.indexOf (item));
- }
-
- public void remove (int index)
- {
- items.removeElementAt (index);
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.delItems (index, index);
- }
- }
-
- /** @deprecated Use remove() instead. */
- public void delItem (int index)
- {
- remove (index);
- }
-
- public int getSelectedIndex ()
- {
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- selected = l.getSelectedIndexes ();
- }
-
- if (selected == null || selected.length > 1)
- return -1;
- return selected[0];
- }
-
- public int[] getSelectedIndexes ()
- {
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- selected = l.getSelectedIndexes ();
- }
- return selected;
- }
-
- public String getSelectedItem ()
- {
- int i = getSelectedIndex ();
- return i == -1 ? null : (String) items.elementAt (i);
- }
-
- public String[] getSelectedItems ()
- {
- int[] is = getSelectedIndexes ();
- if (is == null)
- return null;
- String[] r = new String[is.length];
- for (int i = 0; i < is.length; ++i)
- r[i] = (String) items.elementAt (is[i]);
- return r;
- }
-
- public Object[] getSelectedObjects ()
- {
- return getSelectedItems ();
- }
-
- public void select (int index)
- {
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.select (index);
- }
- else if (selected == null)
- {
- selected = new int[1];
- selected[0] = index;
- }
- else
- {
- int i;
- for (i = 0; i < selected.length; ++i)
- {
- if (selected[i] == index)
- return;
- if (selected[i] > index)
- break;
- }
-
- int[] ns = new int[selected.length + 1];
- System.arraycopy (selected, 0, ns, 0, i);
- ns[i] = index;
- System.arraycopy (selected, i, ns, i + 1, selected.length - i);
-
- selected = ns;
- }
- }
-
- public void deselect (int index)
- {
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.deselect (index);
- }
- else if (selected != null)
- {
- int i;
- for (i = 0; i < selected.length; ++i)
- {
- if (selected[i] == index)
- break;
- }
- if (i < selected.length)
- {
- int[] ns = new int[selected.length - 1];
- System.arraycopy (selected, 0, ns, 0, i);
- System.arraycopy (selected, i + 1, ns, i, selected.length - i);
- selected = ns;
- }
- }
- }
-
- public boolean isIndexSelected (int index)
- {
- int[] is = getSelectedIndexes ();
- for (int i = 0; i < is.length; ++i)
- {
- if (is[i] == index)
- return true;
- }
- return false;
- }
-
- /** @deprecated Use isIndexSelected(). */
- public boolean isSelected (int index)
- {
- return isIndexSelected (index);
- }
-
- public int getRows ()
- {
- return rows;
- }
-
- public boolean isMultipleMode ()
- {
- return multipleMode;
- }
-
- /** @deprecated Use isMultipleMode(). */
- public boolean allowsMultipleSelections ()
- {
- return isMultipleMode ();
- }
-
- public void setMultipleMode (boolean multiple)
- {
- this.multipleMode = multiple;
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.setMultipleMode (multiple);
- }
- }
-
- /** @deprecated Use setMultipleMode(). */
- public void setMultipleSelections (boolean multiple)
- {
- setMultipleMode (multiple);
- }
-
- public int getVisibleIndex ()
- {
- return visibleIndex;
- }
-
- public void makeVisible (int index)
- {
- visibleIndex = index;
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.makeVisible (index);
- }
- }
-
- public Dimension getPreferredSize (int rows)
- {
- return null; // FIXME
- }
-
- /** @deprecated Use getPreferredSize(int). */
- public Dimension preferredSize (int rows)
- {
- return getPreferredSize (rows);
- }
-
- public Dimension getPreferredSize ()
- {
- return null; // FIXME
- }
-
- /** @deprecated Use getPreferredSize(). */
- public Dimension preferredSize ()
- {
- return getPreferredSize ();
- }
-
- public Dimension getMinimumSize (int rows)
- {
- return null; // FIXME
- }
-
- /** @deprecated Use getMinimumSize(int). */
- public Dimension minimumSize (int rows)
- {
- return getMinimumSize (rows);
- }
-
- public Dimension getMinimumSize ()
- {
- return null; // FIXME
- }
-
- /** @deprecated Use getMinimumSize(). */
- public Dimension minimumSize ()
- {
- return getMinimumSize ();
- }
-
- public void addItemListener (ItemListener listen)
- {
- item_listeners = AWTEventMulticaster.add (item_listeners, listen);
- }
-
- public void removeItemListener (ItemListener listen)
- {
- item_listeners = AWTEventMulticaster.remove (item_listeners, listen);
- }
-
- public void addActionListener (ActionListener listen)
- {
- action_listeners = AWTEventMulticaster.add (action_listeners, listen);
- }
-
- public void removeActionListener (ActionListener listen)
- {
- action_listeners = AWTEventMulticaster.remove (action_listeners, listen);
- }
-
- protected void processEvent (AWTEvent e)
- {
- if (e instanceof ItemEvent)
- processItemEvent ((ItemEvent) e);
- else if (e instanceof ActionEvent)
- processActionEvent ((ActionEvent) e);
- else
- super.processEvent (e);
- }
-
- protected void processItemEvent (ItemEvent e)
- {
- if (item_listeners != null)
- item_listeners.itemStateChanged (e);
- }
-
- protected void processActionEvent (ActionEvent e)
- {
- if (action_listeners != null)
- action_listeners.actionPerformed (e);
- }
-
- protected String paramString ()
- {
- return ("List[multiple=" + multipleMode
- + ",rows=" + rows
- + "]");
- }
-
- /** @deprecated */
- public void delItems (int start, int end)
- {
- for (int i = end; i >= start; --i)
- items.removeElementAt (i);
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.delItems (start, end);
- }
- }
-
- // Vector of items in the list.
- private Vector items;
- // True if multiple selection mode enabled.
- private boolean multipleMode;
- // Number of rows.
- private int rows;
- // Array of indices of selected items. When there is no peer, we
- // maintain this in place. When there is a peer, the peer maintains
- // the list and we ask for it whenever needed.
- private int[] selected;
- // Value used by makeVisible().
- private int visibleIndex;
-
- // Listeners.
- private ActionListener action_listeners;
- private ItemListener item_listeners;
+/**
+ * Returns the number of items in this list.
+ *
+ * @return The number of items in this list.
+ */
+public int
+getItemCount()
+{
+ return(items.size());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the number of items in this list.
+ *
+ * @return The number of items in this list.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>getItemCount()</code>
+ */
+public int
+countItems()
+{
+ return(getItemCount());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the complete list of items.
+ *
+ * @return The complete list of items in the list.
+ */
+public synchronized String[]
+getItems()
+{
+ String[] l_items = new String[getItemCount()];
+
+ items.copyInto(l_items);
+ return(l_items);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the item at the specified index.
+ *
+ * @param index The index of the item to retrieve.
+ *
+ * @exception IndexOutOfBoundsException If the index value is not valid.
+ */
+public String
+getItem(int index)
+{
+ return((String)items.elementAt(index));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the number of visible rows in the list.
+ *
+ * @return The number of visible rows in the list.
+ */
+public int
+getRows()
+{
+ return(rows);
+}
+
+/*************************************************************************/
+
+/**
+ * Tests whether or not multi-select mode is enabled.
+ *
+ * @return <code>true</code> if multi-select mode is enabled,
+ * <code>false</code> otherwise.
+ */
+public boolean
+isMultipleMode()
+{
+ return(multipleMode);
+}
+
+/*************************************************************************/
+
+/**
+ * Tests whether or not multi-select mode is enabled.
+ *
+ * @return <code>true</code> if multi-select mode is enabled,
+ * <code>false</code> otherwise.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>isMultipleMode()</code>.
+ */
+public boolean
+allowsMultipleSelections()
+{
+ return(multipleMode);
+}
+
+/*************************************************************************/
+
+/**
+ * This method enables or disables multiple selection mode for this
+ * list.
+ *
+ * @param multipleMode <code>true</code> to enable multiple mode,
+ * <code>false</code> otherwise.
+ */
+public void
+setMultipleMode(boolean multipleMode)
+{
+ this.multipleMode = multipleMode;
+ if (peer != null)
+ {
+ ListPeer l = (ListPeer) peer;
+ l.setMultipleMode (multipleMode);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * This method enables or disables multiple selection mode for this
+ * list.
+ *
+ * @param multipleMode <code>true</code> to enable multiple mode,
+ * <code>false</code> otherwise.
+ */
+public void
+setMultipleSelections(boolean multipleMode)
+{
+ setMultipleMode(multipleMode);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the minimum size of this component.
+ *
+ * @return The minimum size of this component.
+ */
+public Dimension
+getMinimumSize()
+{
+ return(getMinimumSize(rows));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the minimum size of this component.
+ *
+ * @return The minimum size of this component.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>getMinimumSize</code>.
+ */
+public Dimension
+minimumSize()
+{
+ return(getMinimumSize(rows));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the minimum size of this component assuming it had the specified
+ * number of rows.
+ *
+ * @param rows The number of rows to size for.
+ *
+ * @return The minimum size of this component.
+ */
+public Dimension
+getMinimumSize(int rows)
+{
+ ListPeer lp = (ListPeer)getPeer();
+ if (lp != null)
+ return(lp.minimumSize(rows));
+ else
+ return(new Dimension(0,0));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the minimum size of this component assuming it had the specified
+ * number of rows.
+ *
+ * @param rows The number of rows to size for.
+ *
+ * @return The minimum size of this component.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>getMinimumSize(int)</code>>
+ */
+public Dimension
+minimumSize(int rows)
+{
+ return(getMinimumSize(rows));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the preferred size of this component.
+ *
+ * @return The preferred size of this component.
+ */
+public Dimension
+getPreferredSize()
+{
+ return(getPreferredSize(rows));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the preferred size of this component.
+ *
+ * @return The preferred size of this component.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>getPreferredSize</code>.
+ */
+public Dimension
+preferredSize()
+{
+ return(getPreferredSize(rows));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the preferred size of this component assuming it had the specified
+ * number of rows.
+ *
+ * @param rows The number of rows to size for.
+ *
+ * @return The preferred size of this component.
+ */
+public Dimension
+getPreferredSize(int rows)
+{
+ ListPeer lp = (ListPeer)getPeer();
+ if (lp != null)
+ return(lp.preferredSize(rows));
+ else
+ return(new Dimension(0,0));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the preferred size of this component assuming it had the specified
+ * number of rows.
+ *
+ * @param rows The number of rows to size for.
+ *
+ * @return The preferred size of this component.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>getPreferredSize(int)</code>>
+ */
+public Dimension
+preferredSize(int rows)
+{
+ return(getPreferredSize(rows));
+}
+
+/*************************************************************************/
+
+/**
+ * This method adds the specified item to the end of the list.
+ *
+ * @param item The item to add to the list.
+ */
+public void
+add(String item)
+{
+ add(item, -1);
}
+
+/*************************************************************************/
+
+/**
+ * This method adds the specified item to the end of the list.
+ *
+ * @param item The item to add to the list.
+ *
+ * @deprecated Use add() instead.
+ */
+public void
+addItem(String item)
+{
+ addItem(item, -1);
+}
+
+/*************************************************************************/
+
+/**
+ * Adds the specified item to the specified location in the list.
+ * If the desired index is -1 or greater than the number of rows
+ * in the list, then the item is added to the end.
+ *
+ * @param item The item to add to the list.
+ * @param index The location in the list to add the item, or -1 to add
+ * to the end.
+ */
+public void
+add(String item, int index)
+{
+ if ((index == -1) || (index >= items.size()))
+ items.addElement(item);
+ else
+ items.insertElementAt(item, index);
+
+ if (peer != null)
+ {
+ ListPeer l = (ListPeer) peer;
+ l.add (item, index);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Adds the specified item to the specified location in the list.
+ * If the desired index is -1 or greater than the number of rows
+ * in the list, then the item is added to the end.
+ *
+ * @param item The item to add to the list.
+ * @param index The location in the list to add the item, or -1 to add
+ * to the end.
+ *
+ * @deprecated Use add() instead.
+ */
+public void
+addItem(String item, int index)
+{
+ add(item, index);
+}
+
+/*************************************************************************/
+
+/**
+ * Deletes the item at the specified index.
+ *
+ * @param index The index of the item to delete.
+ *
+ * @exception IllegalArgumentException If the index is not valid
+ */
+public void
+delItem(int index) throws IllegalArgumentException
+{
+ remove(index);
+}
+
+/*************************************************************************/
+
+/**
+ * Deletes the item at the specified index.
+ *
+ * @param index The index of the item to delete.
+ *
+ * @exception IllegalArgumentException If the index is not valid
+ */
+public void
+remove(int index) throws IllegalArgumentException
+{
+ items.removeElementAt (index);
+ if (peer != null)
+ {
+ ListPeer l = (ListPeer) peer;
+ l.delItems (index, index);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Deletes all items in the specified index range.
+ *
+ * @param start The beginning index of the range to delete.
+ * @param end The ending index of the range to delete.
+ *
+ * @exception IllegalArgumentException If the indexes are not valid
+ *
+ * @deprecated This method is deprecated for some unknown reason.
+ */
+public synchronized void
+delItems(int start, int end) throws IllegalArgumentException
+{
+ if ((start < 0) || (start >= items.size()))
+ throw new IllegalArgumentException("Bad list start index value: " + start);
+
+ if ((start < 0) || (start >= items.size()))
+ throw new IllegalArgumentException("Bad list start index value: " + start);
+
+ if (start > end)
+ throw new IllegalArgumentException("Start is greater than end!");
+
+ // We must run the loop in reverse direction.
+ for (int i = end; i >= start; --i)
+ items.removeElementAt (i);
+ if (peer != null)
+ {
+ ListPeer l = (ListPeer) peer;
+ l.delItems (start, end);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Deletes the first occurrence of the specified item from the list.
+ *
+ * @param item The item to delete.
+ *
+ * @exception IllegalArgumentException If the specified item does not exist.
+ */
+public synchronized void
+remove(String item) throws IllegalArgumentException
+{
+ int index = items.indexOf(item);
+ if (index == -1)
+ throw new IllegalArgumentException("List element to delete not found");
+
+ remove(index);
+}
+
+/*************************************************************************/
+
+/**
+ * Deletes all of the items from the list.
+ */
+public synchronized void
+removeAll()
+{
+ items.clear();
+ if (peer != null)
+ {
+ ListPeer l = (ListPeer) peer;
+ l.removeAll ();
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Deletes all of the items from the list.
+ *
+ * @deprecated This method is deprecated in favor of <code>removeAll()</code>.
+ */
+public void
+clear()
+{
+ removeAll();
+}
+
+/*************************************************************************/
+
+/**
+ * Replaces the item at the specified index with the specified item.
+ *
+ * @param item The new item value.
+ * @param index The index of the item to replace.
+ *
+ * @exception IllegalArgumentException If the index is not valid.
+ */
+public synchronized void
+replaceItem(String item, int index) throws IllegalArgumentException
+{
+ remove(index);
+ addItem(item, index);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the index of the currently selected item. -1 will be returned
+ * if there are no selected rows or if there are multiple selected rows.
+ *
+ * @return The index of the selected row.
+ */
+public synchronized int
+getSelectedIndex()
+{
+ if (peer != null)
+ {
+ ListPeer l = (ListPeer) peer;
+ selected = l.getSelectedIndexes ();
+ }
+
+ if (selected == null || selected.length > 1)
+ return -1;
+ return selected[0];
+}
+
+/*************************************************************************/
+
+/**
+ * Returns an array containing the indexes of the rows that are
+ * currently selected.
+ *
+ * @return A list of indexes of selected rows.
+ */
+public synchronized int[]
+getSelectedIndexes()
+{
+ if (peer != null)
+ {
+ ListPeer l = (ListPeer) peer;
+ selected = l.getSelectedIndexes ();
+ }
+ return selected;
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the item that is currently selected, or <code>null</code> if there
+ * is no item selected. FIXME: What happens if multiple items selected?
+ *
+ * @return The selected item, or <code>null</code> if there is no
+ * selected item.
+ */
+public synchronized String
+getSelectedItem()
+{
+ int index = getSelectedIndex();
+ if (index == -1)
+ return(null);
+
+ return((String)items.elementAt(index));
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the list of items that are currently selected in this list.
+ *
+ * @return The list of currently selected items.
+ */
+public synchronized String[]
+getSelectedItems()
+{
+ int[] indexes = getSelectedIndexes();
+ if (indexes == null)
+ return(new String[0]);
+
+ String[] retvals = new String[indexes.length];
+ if (retvals.length > 0)
+ for (int i = 0 ; i < retvals.length; i++)
+ retvals[i] = (String)items.elementAt(indexes[i]);
+
+ return(retvals);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the list of items that are currently selected in this list as
+ * an array of type <code>Object[]</code> instead of <code>String[]</code>.
+ *
+ * @return The list of currently selected items.
+ */
+public synchronized Object[]
+getSelectedObjects()
+{
+ int[] indexes = getSelectedIndexes();
+ if (indexes == null)
+ return(new Object[0]);
+
+ Object[] retvals = new Object[indexes.length];
+ if (retvals.length > 0)
+ for (int i = 0 ; i < retvals.length; i++)
+ retvals[i] = items.elementAt(indexes[i]);
+
+ return(retvals);
+}
+
+/*************************************************************************/
+
+/**
+ * Tests whether or not the specified index is selected.
+ *
+ * @param index The index to test.
+ *
+ * @return <code>true</code> if the index is selected, <code>false</code>
+ * otherwise.
+ */
+public boolean
+isIndexSelected(int index)
+{
+ int[] indexes = getSelectedIndexes();
+
+ for (int i = 0; i < indexes.length; i++)
+ if (indexes[i] == index)
+ return(true);
+
+ return(false);
+}
+
+/*************************************************************************/
+
+/**
+ * Tests whether or not the specified index is selected.
+ *
+ * @param index The index to test.
+ *
+ * @return <code>true</code> if the index is selected, <code>false</code>
+ * otherwise.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>isIndexSelected(int)</code>.
+ */
+public boolean
+isSelected(int index)
+{
+ return(isIndexSelected(index));
+}
+
+/*************************************************************************/
+
+/**
+ * This method ensures that the item at the specified index is visible.
+ *
+ * @exception IllegalArgumentException If the specified index is out of
+ * range.
+ */
+public synchronized void
+makeVisible(int index) throws IllegalArgumentException
+{
+ if ((index < 0) || (index >= items.size()))
+ throw new IllegalArgumentException("Bad list index: " + index);
+
+ visibleIndex = index;
+ if (peer != null)
+ {
+ ListPeer l = (ListPeer) peer;
+ l.makeVisible (index);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the index of the last item that was made visible via the
+ * <code>makeVisible()</code> method.
+ *
+ * @return The index of the last item made visible via the
+ * <code>makeVisible()</code> method.
+ */
+public int
+getVisibleIndex()
+{
+ return(visibleIndex);
+}
+
+/*************************************************************************/
+
+/**
+ * Makes the item at the specified index selected.
+ *
+ * @param index The index of the item to select.
+ */
+public synchronized void
+select(int index)
+{
+ ListPeer lp = (ListPeer)getPeer();
+ if (lp != null)
+ lp.select(index);
+}
+
+/*************************************************************************/
+
+/**
+ * Makes the item at the specified index not selected.
+ *
+ * @param index The index of the item to unselect.
+ */
+public synchronized void
+deselect(int index)
+{
+ ListPeer lp = (ListPeer)getPeer();
+ if (lp != null)
+ lp.deselect(index);
+}
+
+/*************************************************************************/
+
+/**
+ * Notifies this object to create its native peer.
+ */
+public void
+addNotify()
+{
+ if (peer != null)
+ peer = getToolkit ().createList (this);
+ super.addNotify ();
+}
+
+/*************************************************************************/
+
+/**
+ * Notifies this object to destroy its native peer.
+ */
+public void
+removeNotify()
+{
+ super.removeNotify();
+}
+
+/*************************************************************************/
+
+/**
+ * Adds the specified <code>ActionListener</code> to the list of
+ * registered listeners for this object.
+ *
+ * @param listener The listener to add.
+ */
+public synchronized void
+addActionListener(ActionListener listener)
+{
+ action_listeners = AWTEventMulticaster.add(action_listeners, listener);
+}
+
+/*************************************************************************/
+
+/**
+ * Removes the specified <code>ActionListener</code> from the list of
+ * registers listeners for this object.
+ *
+ * @param listener The listener to remove.
+ */
+public synchronized void
+removeActionListener(ActionListener listener)
+{
+ action_listeners = AWTEventMulticaster.remove(action_listeners, listener);
+}
+
+/*************************************************************************/
+
+/**
+ * Adds the specified <code>ItemListener</code> to the list of
+ * registered listeners for this object.
+ *
+ * @param listener The listener to add.
+ */
+public synchronized void
+addItemListener(ItemListener listener)
+{
+ item_listeners = AWTEventMulticaster.add(item_listeners, listener);
+}
+
+/*************************************************************************/
+
+/**
+ * Removes the specified <code>ItemListener</code> from the list of
+ * registers listeners for this object.
+ *
+ * @param listener The listener to remove.
+ */
+public synchronized void
+removeItemListener(ItemListener listener)
+{
+ item_listeners = AWTEventMulticaster.remove(item_listeners, listener);
+}
+
+/*************************************************************************/
+
+/**
+ * Processes the specified event for this object. If the event is an
+ * instance of <code>ActionEvent</code> then the
+ * <code>processActionEvent()</code> method is called. Similarly, if the
+ * even is an instance of <code>ItemEvent</code> then the
+ * <code>processItemEvent()</code> method is called. Otherwise the
+ * superclass method is called to process this event.
+ *
+ * @param event The event to process.
+ */
+protected void
+processEvent(AWTEvent event)
+{
+ if (event instanceof ActionEvent)
+ processActionEvent((ActionEvent)event);
+ if (event instanceof ItemEvent)
+ processItemEvent((ItemEvent)event);
+
+ super.processEvent(event);
+}
+
+/*************************************************************************/
+
+/**
+ * This method processes the specified event by dispatching it to any
+ * registered listeners. Note that this method will only get called if
+ * action events are enabled. This will happen automatically if any
+ * listeners are added, or it can be done "manually" by calling
+ * the <code>enableEvents()</code> method.
+ *
+ * @param event The event to process.
+ */
+protected void
+processActionEvent(ActionEvent event)
+{
+ if (action_listeners != null)
+ action_listeners.actionPerformed(event);
+}
+
+/*************************************************************************/
+
+/**
+ * This method processes the specified event by dispatching it to any
+ * registered listeners. Note that this method will only get called if
+ * item events are enabled. This will happen automatically if any
+ * listeners are added, or it can be done "manually" by calling
+ * the <code>enableEvents()</code> method.
+ *
+ * @param event The event to process.
+ */
+protected void
+processItemEvent(ItemEvent event)
+{
+ if (item_listeners != null)
+ item_listeners.itemStateChanged(event);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a debugging string for this object.
+ *
+ * @return A debugging string for this object.
+ */
+protected String
+paramString()
+{
+ return "multiple=" + multipleMode + ",rows=" + rows + super.paramString();
+}
+
+} // class List
diff --git a/libjava/java/awt/MediaEntry.java b/libjava/java/awt/MediaEntry.java
new file mode 100644
index 00000000000..7b5b8a0855c
--- /dev/null
+++ b/libjava/java/awt/MediaEntry.java
@@ -0,0 +1,106 @@
+/* MediaEntry.java -- An entry in a MediaTracker
+ Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
+
+
+package java.awt;
+
+/**
+ * This is an entry in the media tracker
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
+abstract class MediaEntry implements java.io.Serializable
+{
+
+protected static final int LOADING = 1;
+protected static final int ABORTED = 2;
+protected static final int ERRORED = 4;
+protected static final int COMPLETE = 8;
+protected static final int LOADSTARTED = 16;
+protected static final int DONE = 32;
+
+private MediaTracker tracker;
+private int ID;
+private int status;
+private boolean cancelled;
+private MediaEntry next;
+
+static MediaEntry
+insert(MediaEntry a, MediaEntry b)
+{
+ while (a.next != null)
+ a = a.next;
+
+ a.next = b;
+ return(b);
+}
+
+MediaEntry(MediaTracker tracker, int ID)
+{
+ this.tracker = tracker;
+ this.ID = ID;
+}
+
+public int
+getID()
+{
+ return(ID);
+}
+
+public int
+getStatus()
+{
+ return(status);
+}
+
+public void
+setStatus(int status)
+{
+ this.status = status;
+}
+
+public MediaEntry
+getNext()
+{
+ return(next);
+}
+
+public void
+cancel()
+{
+ cancelled = true;
+ if ((status == LOADING) || (status == LOADSTARTED))
+ setStatus(ABORTED);
+}
+
+abstract void
+startLoad();
+
+abstract Object
+getMedia();
+
+} // class MediaEntry
+
diff --git a/libjava/java/awt/MediaTracker.java b/libjava/java/awt/MediaTracker.java
new file mode 100644
index 00000000000..53b9c8f4057
--- /dev/null
+++ b/libjava/java/awt/MediaTracker.java
@@ -0,0 +1,40 @@
+/* MediaTracker.java -- Class used for keeping track of images
+ Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
+
+
+package java.awt;
+
+/**
+ * This class is used for keeping track of the status of various media
+ * objects.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
+public class MediaTracker implements java.io.Serializable
+{
+
+} // class MediaTracker
+
diff --git a/libjava/java/awt/Menu.java b/libjava/java/awt/Menu.java
index 6d52d050b46..ab73a233afa 100644
--- a/libjava/java/awt/Menu.java
+++ b/libjava/java/awt/Menu.java
@@ -1,141 +1,398 @@
-/* Copyright (C) 1999, 2000, 2001 Free Software Foundation
+/* Menu.java -- A Java AWT Menu
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
- This file is part of libjava.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libjava License. Please consult the file "LIBJAVA_LICENSE" for
-details. */
package java.awt;
+import java.awt.peer.MenuPeer;
+import java.awt.peer.MenuItemPeer;
+import java.awt.peer.MenuComponentPeer;
+import java.io.Serializable;
import java.util.Vector;
+import java.util.Enumeration;
+
+/**
+ * This class represents a pull down or tear off menu in Java's AWT.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
+public class Menu extends MenuItem implements MenuContainer, Serializable
+{
+
+/*
+ * Static Variables
+ */
+
+// Serialization Constant
+private static final long serialVersionUID = -8809584163345499784L;
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
+ */
+
+/**
+ * @serial The actual items in the menu
+ */
+private Vector items = new Vector();
+
+/**
+ * @serial Flag indicating whether or not this menu is a tear off
+ */
+private boolean isTearOff;
+
+/**
+ * @serial Indicates whether or not this is a help menu.
+ */
+private boolean isHelpMenu;
+
+// From the serialization spec. FIXME: what should it be?
+private int menuSerializedDataVersion;
+
+static final MenuItem separator = new MenuItem("-");
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * Initializes a new instance of <code>Menu</code> with no label and that
+ * is not a tearoff;
+ */
+public
+Menu()
+{
+}
+
+/*************************************************************************/
+
+/**
+ * Initializes a new instance of <code>Menu</code> that is not a tearoff and
+ * that has the specified label.
+ *
+ * @param label The menu label.
+ */
+public
+Menu(String label)
+{
+ this(label, false);
+}
+
+/*************************************************************************/
-/* Status: Incomplete. */
-
-public class Menu extends MenuItem implements MenuContainer
-{
- // Fields from the serialization spec. Decalare others "transient".
- Vector items = new Vector();
- boolean tearOff;
- boolean isHelpMenu;
- int menuSerializedDataVersion;
-
- static final MenuItem separator = new MenuItem("-");
-
- public Menu()
- {
- this(null, false);
- }
-
- public Menu(String label)
- {
- this(label, false);
- }
-
- public Menu(String label, boolean tearOff)
- {
- super(label);
- this.tearOff = tearOff;
- }
-
- public void addNotify()
- {
- if (peer != null)
- {
- // This choice of toolkit seems unsatisfying, but I'm not sure
- // what else to do.
- peer = Toolkit.getDefaultToolkit ().createMenu (this);
- }
- super.addNotify ();
- }
-
- public void removeNotify()
- {
- // FIXME
- }
-
- public boolean isTearOff()
- {
- return tearOff;
- }
-
- public int getItemCount()
- {
- return items.size();
- }
-
- /** @deprecated Use getItemCount() instead. */
- public int countItems()
- {
- return getItemCount();
- }
-
- public MenuItem getItem(int index)
- {
- return (MenuItem) items.elementAt(index);
- }
-
- public synchronized MenuItem add(MenuItem mi)
- {
- items.addElement(mi);
- if (mi.parent != null)
- {
- mi.parent.remove(mi);
- }
- mi.parent = this;
- return mi;
- }
-
- public void add(String label)
- {
- MenuItem mi = new MenuItem(label);
- this.add(mi);
- }
-
- public synchronized void insert(MenuItem menuitem, int index)
- {
- if (index < 0)
- throw new IllegalArgumentException();
- items.insertElementAt(menuitem, index);
- }
-
- public void insert(String label, int index)
- {
- MenuItem mi = new MenuItem(label);
- this.insert(mi, index);
- }
-
- public void addSeparator()
- {
- this.add(separator);
- }
-
- public void insertSeparator(int index)
- {
- this.insert(separator, index);
- }
-
- public synchronized void remove(int index)
- {
- items.removeElementAt(index);
- }
-
- public synchronized void remove(MenuComponent item)
- {
- items.removeElement(item);
- }
-
- public synchronized void removeAll()
- {
- items.removeAllElements();
- }
-
- public String paramString()
- {
- return getName() + ",label" + label + ",tearOff=" + tearOff +
- ",isHelpMenu=" + isHelpMenu;
- }
-
- // Accessibility API not yet implemented.
- // public AccessibleContext getAccessibleContext()
+/**
+ * Initializes a new instance of <code>Menu</code> with the specified
+ * label and tearoff status.
+ *
+ * @param label The label for this menu
+ * @param isTearOff <code>true</code> if this menu is a tear off menu,
+ * <code>false</code> otherwise.
+ */
+public
+Menu(String label, boolean isTearOff)
+{
+ super(label);
+
+ this.isTearOff = isTearOff;
+
+ if (label.equals("Help"))
+ isHelpMenu = true;
}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Tests whether or not this menu is a tearoff.
+ *
+ * @return <code>true</code> if this menu is a tearoff, <code>false</code>
+ * otherwise.
+ */
+public boolean
+isTearOff()
+{
+ return(isTearOff);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the number of items in this menu.
+ *
+ * @return The number of items in this menu.
+ */
+public int
+getItemCount()
+{
+ return(items.size());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the number of items in this menu.
+ *
+ * @return The number of items in this menu.
+ *
+ * @deprecated This method is deprecated in favor of <code>getItemCount()</code>.
+ */
+public int
+count()
+{
+ return(items.size());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the item at the specified index.
+ *
+ * @return The item at the specified index.
+ *
+ * @exception ArrayIndexOutOfBoundsException If the index value is not valid.
+ */
+public MenuItem
+getItem(int index)
+{
+ return((MenuItem)items.elementAt(index));
+}
+
+/*************************************************************************/
+
+/**
+ * Adds the specified item to this menu. If it was previously part of
+ * another menu, it is first removed from that menu.
+ *
+ * @param item The new item to add.
+ *
+ * @return The item that was added.
+ */
+public MenuItem
+add(MenuItem item)
+{
+ items.addElement(item);
+ if (item.parent != null)
+ {
+ item.parent.remove(item);
+ }
+ item.parent = this;
+
+ if (peer != null)
+ {
+ MenuPeer mp = (MenuPeer) peer;
+ mp.addItem(item);
+ }
+
+ return item;
+}
+
+/*************************************************************************/
+
+/**
+ * Add an item with the specified label to this menu.
+ *
+ * @param label The label of the menu item to add.
+ */
+public void
+add(String label)
+{
+ add(new MenuItem(label));
+}
+
+/*************************************************************************/
+
+/**
+ * Inserts the specified menu item into this menu at the specified index.
+ *
+ * @param item The menu item to add.
+ * @param index The index of the menu item.
+ *
+ * XXX: FIXME
+ *
+ * @exception IllegalArgumentException If the index is less than zero.
+ * @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
+ */
+public void
+insert(MenuItem item, int index)
+{
+ if (index < 0)
+ throw new IllegalArgumentException("Index is less than zero");
+
+ items.insertElementAt(item, index);
+
+ MenuPeer mp = (MenuPeer)getPeer();
+ // FIXME: Need to add a peer method here.
+// if (mp != null)
+// mp.insertItem(item, index);
+}
+
+/*************************************************************************/
+
+/**
+ * Inserts an item with the specified label into this menu at the specified index.
+ *
+ * @param label The label of the item to add.
+ * @param index The index of the menu item.
+ *
+ * @exception IllegalArgumentException If the index is less than zero.
+ * @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
+ */
+public void
+insert(String label, int index)
+{
+ insert(new MenuItem(label), index);
+}
+
+/*************************************************************************/
+
+/**
+ * Adds a separator bar at the current menu location.
+ */
+public void
+addSeparator()
+{
+ add(separator);
+}
+
+/*************************************************************************/
+
+/**
+ * Inserts a separator bar at the specified index value.
+ *
+ * @param index The index at which to insert a separator bar.
+ *
+ * XXX: FIXME
+ *
+ * @exception IllegalArgumentException If the index is less than zero.
+ * @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
+ */
+public void
+insertSeparator(int index)
+{
+ insert(separator, index);
+}
+
+/*************************************************************************/
+
+/**
+ * Deletes the item at the specified index from this menu.
+ *
+ * @param index The index of the item to remove.
+ *
+ * @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
+ */
+public synchronized void
+remove(int index)
+{
+ items.removeElementAt(index);
+
+ MenuPeer mp = (MenuPeer)getPeer();
+ if (mp != null)
+ mp.delItem(index);
+}
+
+/*************************************************************************/
+
+/**
+ * Removes the specifed item from the menu. If the specified component
+ * does not exist, this method does nothing. // FIXME: Right?
+ *
+ * @param item The component to remove.
+ */
+public void
+remove(MenuComponent item)
+{
+ int index = items.indexOf(item);
+ if (index == -1)
+ return;
+
+ remove(index);
+}
+
+/*************************************************************************/
+
+/**
+ * Removes all the elements from this menu.
+ */
+public synchronized void
+removeAll()
+{
+ int count = getItemCount();
+ for(int i = 0; i < count; i++)
+ {
+ // We must always remove item 0.
+ remove(0);
+ }
+}
+
+/*************************************************************************/
+
+/**
+ * Creates the native peer for this object.
+ */
+public void
+addNotify()
+{
+ if (peer != null)
+ peer = getToolkit().createMenu(this);
+ super.addNotify ();
+}
+
+/*************************************************************************/
+
+/**
+ * Destroys the native peer for this object.
+ */
+public void
+removeNotify()
+{
+ super.removeNotify();
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a debugging string for this menu.
+ *
+ * @return A debugging string for this menu.
+ */
+public String
+paramString()
+{
+ return (",isTearOff=" + isTearOff + ",isHelpMenu=" + isHelpMenu
+ + super.paramString());
+}
+
+// Accessibility API not yet implemented.
+// public AccessibleContext getAccessibleContext()
+
+} // class Menu
diff --git a/libjava/java/awt/MenuBar.java b/libjava/java/awt/MenuBar.java
index 40de61abbb5..7ad688b65c4 100644
--- a/libjava/java/awt/MenuBar.java
+++ b/libjava/java/awt/MenuBar.java
@@ -1,288 +1,329 @@
-/* Copyright (C) 1999, 2000, 2001 Free Software Foundation
+/* MenuBar.java -- An AWT menu bar class
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
- This file is part of libjava.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libjava License. Please consult the file "LIBJAVA_LICENSE" for
-details. */
package java.awt;
import java.awt.peer.MenuBarPeer;
-import java.util.Vector;
+import java.awt.peer.MenuComponentPeer;
+
+import java.io.Serializable;
import java.util.Enumeration;
-import java.util.NoSuchElementException;
+import java.util.Vector;
+
+/**
+ * This class implements a menu bar in the AWT system.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@redhat.com>
+ */
+public class MenuBar extends MenuComponent
+ implements MenuContainer, Serializable
+{
+
+/*
+ * Static Variables
+ */
+
+// Serialization Constant
+private static final long serialVersionUID = -4930327919388951260L;
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
+ */
-/** This class implements a MenuBar, such as might appear across the
- * top of a window.
- * @author Tom Tromey <tromey@redhat.com>
- * @date December 25, 2000
+/**
+ * @serial The menu used for providing help information
+ */
+private Menu helpMenu;
+
+/**
+ * @serial The menus contained in this menu bar.
+ */
+private Vector menus = new Vector();
+
+/*************************************************************************/
+
+/*
+ * Constructors
*/
-public class MenuBar extends MenuComponent implements MenuContainer
+
+/**
+ * Initializes a new instance of <code>MenuBar</code>.
+ */
+public
+MenuBar()
{
- /** Create a new MenuBar. */
- public MenuBar ()
- {
- menus = new Vector ();
- }
-
- /** Add a menu to this MenuBar. If the menu has already has a
- * parent, it is first removed from its old parent before being
- * added.
- * @param menu The menu to add.
- * @returns menu
- */
- public synchronized Menu add (Menu menu)
- {
- if (menu.parent != null)
- menu.parent.remove (menu);
-
- menu.parent = this;
- menus.add (menu);
-
- if (peer != null)
- {
- MenuBarPeer mp = (MenuBarPeer) peer;
- mp.add (menu);
- }
-
- return menu;
- }
-
- /** This creates the component's peer. */
- public void addNotify ()
- {
- if (peer != null)
- {
- // This choice of toolkit seems unsatisfying, but I'm not sure
- // what else to do.
- peer = Toolkit.getDefaultToolkit ().createMenuBar (this);
- }
- }
-
- /** @deprecated Use getMenuCount() instead. */
- public int countMenus ()
- {
- return getMenuCount ();
- }
-
- /** Delete a keyboard shortcut.
- * @param shortcut The short cut which should be deleted from all
- * menus on this MenuBar.
- */
- public void deleteShortcut (MenuShortcut shortcut)
- {
- MenuItem it;
- // This is a slow implementation, but it probably doesn't matter.
- while ((it = getShortcutMenuItem (shortcut)) != null)
- it.deleteShortcut ();
- }
-
- /** Returns the current Help menu. */
- public Menu getHelpMenu ()
- {
- return help_menu;
- }
-
- /** Returns a menu from this object.
- * @param index Index of menu to return.
- */
- public Menu getMenu (int index)
- {
- return (Menu) menus.get (index);
- }
-
- /** Returns the number of menus on this MenuBar. */
- public int getMenuCount ()
- {
- return menus.size ();
- }
-
- /** Returns the menu item on this MenuBar with the specified
- * shortcut.
- * @param shortcut Shortcut to look for
- */
- public MenuItem getShortcutMenuItem (MenuShortcut shortcut)
- {
- Enumeration m = new MenuEnumeration (this);
- while (m.hasMoreElements ())
- {
- MenuItem item = (MenuItem) m.nextElement ();
- if (item.getShortcut () == shortcut)
- return item;
- }
- return null;
- }
-
- /** Remove a menu from the menu bar. If the menu is specified by
- * component (and not index), and does not exist on the menu, then
- * the method does nothing. If the removed menu has a peer, it is
- * destroyed.
- * @param menu The menu to remove
- * @param index The index of the menu to remove
- */
- public synchronized void remove (MenuComponent menu)
- {
- int s = menus.size ();
- for (int i = 0; i < s; ++i)
- {
- if (menus.get (i) == menu)
- {
- remove (i);
- break;
- }
- }
- }
-
- public synchronized void remove (int index)
- {
- Menu m = (Menu) menus.get (index);
- menus.remove (index);
- m.removeNotify ();
- m.parent = null;
-
- if (peer != null)
- {
- MenuBarPeer mp = (MenuBarPeer) peer;
- mp.remove (index);
- }
- }
-
- /** Set the Help menu for this MenuBar. If a Help menu already
- * exists, it is first removed.
- * @param menu The new Help menu.
- */
- public synchronized void setHelpMenu (Menu menu)
- {
- if (help_menu != null)
- {
- help_menu.removeNotify ();
- help_menu.parent = null;
- }
-
- if (menu.parent != null)
- menu.parent.remove (menu);
- if (menu.parent != null)
- menu.parent.remove (menu);
- menu.parent = this;
-
- if (peer != null)
- {
- MenuBarPeer mp = (MenuBarPeer) peer;
- mp.addHelpMenu (menu);
- }
- }
-
- /** Returns an Enumeration which lists the keyboard shortcuts
- * associated with menu items on this MenuBar.
- */
- public synchronized Enumeration shortcuts ()
- {
- return new ShortcutEnumeration (new MenuEnumeration (this));
- }
-
- // Iterate over the items of a menu.
- private static class MenuEnumeration implements Enumeration
- {
- // Enumerate over the menu's items.
- Enumeration main;
- // Enumerate over a submenu.
- Enumeration sub;
- // Menubar so we can keep track of help menu too.
- MenuBar menubar;
-
- MenuEnumeration (Menu m)
- {
- sub = null;
- menubar = null;
- main = m.items.elements ();
- }
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
- MenuEnumeration (MenuBar mb)
+/**
+ * Returns the help menu for this menu bar. This may be <code>null</code>.
+ *
+ * @return The help menu for this menu bar.
+ */
+public Menu
+getHelpMenu()
+{
+ return(helpMenu);
+}
+
+/*************************************************************************/
+
+/**
+ * Sets the help menu for this menu bar.
+ *
+ * @param helpMenu The new help menu for this menu bar.
+ */
+public synchronized void
+setHelpMenu(Menu menu)
+{
+ if (helpMenu != null)
{
- sub = null;
- menubar = mb;
- main = mb.menus.elements ();
+ helpMenu.removeNotify ();
+ helpMenu.parent = null;
}
- public boolean hasMoreElements ()
+ if (menu.parent != null)
+ menu.parent.remove (menu);
+ if (menu.parent != null)
+ menu.parent.remove (menu);
+ menu.parent = this;
+
+ if (peer != null)
{
- boolean r = false;
- if (sub != null)
- r = sub.hasMoreElements ();
- if (! r)
- r = main.hasMoreElements ();
- if (! r && menubar != null)
- {
- if (menubar.help_menu != null)
- {
- main = new MenuEnumeration (menubar.help_menu);
- r = main.hasMoreElements ();
- }
- menubar = null;
- }
- return r;
+ MenuBarPeer mp = (MenuBarPeer) peer;
+ mp.addHelpMenu (menu);
}
+}
+
+/*************************************************************************/
- public Object nextElement () throws NoSuchElementException
+/** Add a menu to this MenuBar. If the menu has already has a
+ * parent, it is first removed from its old parent before being
+ * added.
+ *
+ * @param menu The menu to add.
+ *
+ * @return The menu that was added.
+ */
+public synchronized Menu
+add(Menu menu)
+{
+ if (menu.parent != null)
+ menu.parent.remove (menu);
+
+ menu.parent = this;
+ menus.addElement(menu);
+
+ if (peer != null)
{
- while (true)
- {
- if (! sub.hasMoreElements ())
- sub = null;
- else
- return sub.nextElement ();
-
- if (! main.hasMoreElements () && menubar != null
- && menubar.help_menu != null)
- {
- main = new MenuEnumeration (menubar.help_menu);
- menubar = null;
- }
-
- Object r = main.nextElement ();
- if (r instanceof Menu)
- {
- sub = new MenuEnumeration ((Menu) r);
- continue;
- }
-
- return r;
- }
+ MenuBarPeer mp = (MenuBarPeer) peer;
+ mp.addMenu (menu);
}
- }
- // This is an enumeration that shadows another enumeration and
- // returns the shortcut for each item returned. I wonder if we're
- // only supposed to return unique shortcuts? If so then we could
- // keep a hash table here and remove duplicates.
- private static class ShortcutEnumeration implements Enumeration
- {
- Enumeration back;
+ return(menu);
+}
+
+/*************************************************************************/
- ShortcutEnumeration (Enumeration back)
+/**
+ * Removes the menu at the specified index.
+ *
+ * @param index The index of the menu to remove from the menu bar.
+ */
+public synchronized void
+remove(int index)
+{
+ Menu m = (Menu) menus.get (index);
+ menus.remove (index);
+ m.removeNotify ();
+ m.parent = null;
+
+ if (peer != null)
{
- this.back = back;
+ MenuBarPeer mp = (MenuBarPeer) peer;
+ mp.delMenu (index);
}
+}
+
+/*************************************************************************/
+
+/**
+ * Removes the specified menu from the menu bar.
+ *
+ * @param menu The menu to remove from the menu bar.
+ */
+public void
+remove(MenuComponent menu)
+{
+ int index = menus.indexOf(menu);
+ if (index == -1)
+ return;
+
+ remove(index);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the number of elements in this menu bar.
+ *
+ * @return The number of elements in the menu bar.
+ */
+public int
+getMenuCount()
+{
+ // FIXME: How does the help menu fit in here?
+ return(menus.size());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the number of elements in this menu bar.
+ *
+ * @return The number of elements in the menu bar.
+ *
+ * @deprecated This method is deprecated in favor of <code>getMenuCount()</code>.
+ */
+public int
+countMenus()
+{
+ return(getMenuCount());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the menu at the specified index.
+ *
+ * @return The requested menu.
+ *
+ * @exception ArrayIndexOutOfBoundsException If the index is not valid.
+ */
+public Menu
+getMenu(int index)
+{
+ return((Menu)menus.elementAt(index));
+}
+
+/*************************************************************************/
- public boolean hasMoreElements ()
+/**
+ * Creates this object's native peer.
+ */
+public void
+addNotify()
+{
+ if (getPeer() == null)
+ setPeer((MenuComponentPeer)getToolkit().createMenuBar(this));
+}
+
+/*************************************************************************/
+
+/**
+ * Destroys this object's native peer.
+ */
+public void
+removeNotify()
+{
+ super.removeNotify();
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a list of all shortcuts for the menus in this menu bar.
+ *
+ * @return A list of all shortcuts for the menus in this menu bar.
+ */
+public synchronized Enumeration
+shortcuts()
+{
+ Vector shortcuts = new Vector();
+ Enumeration e = menus.elements();
+
+ while (e.hasMoreElements())
{
- return back.hasMoreElements ();
+ Menu menu = (Menu)e.nextElement();
+ if (menu.getShortcut() != null)
+ shortcuts.addElement(menu.getShortcut());
}
- public Object nextElement () throws NoSuchElementException
+ return(shortcuts.elements());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the menu item for the specified shortcut, or <code>null</code>
+ * if no such item exists.
+ *
+ * @param shortcut The shortcut to return the menu item for.
+ *
+ * @return The menu item for the specified shortcut.
+ */
+public MenuItem
+getShortcutMenuItem(MenuShortcut shortcut)
+{
+ Enumeration e = menus.elements();
+
+ while (e.hasMoreElements())
{
- while (true)
- {
- MenuItem item = (MenuItem) back.nextElement ();
- if (item.getShortcut () != null)
- return item.getShortcut ();
- }
+ Menu menu = (Menu)e.nextElement();
+ MenuShortcut s = menu.getShortcut();
+ if ((s != null) && (s.equals(shortcut)))
+ return(menu);
}
- }
- // We use Vector because it makes enumerating easier than ArrayList
- // in this case.
- Vector menus;
- Menu help_menu;
+ return(null);
}
+
+/*************************************************************************/
+
+/**
+ * Deletes the specified menu shortcut.
+ *
+ * @param shortcut The shortcut to delete.
+ */
+public void
+deleteShortcut(MenuShortcut shortcut)
+{
+ MenuItem it;
+ // This is a slow implementation, but it probably doesn't matter.
+ while ((it = getShortcutMenuItem (shortcut)) != null)
+ it.deleteShortcut ();
+}
+
+} // class MenuBar
diff --git a/libjava/java/awt/MenuComponent.java b/libjava/java/awt/MenuComponent.java
index 41a085ffb07..d856b7592e2 100644
--- a/libjava/java/awt/MenuComponent.java
+++ b/libjava/java/awt/MenuComponent.java
@@ -221,7 +221,7 @@ getToolkit()
*
* @return The synchronization lock for this component.
*/
-public final Object
+protected final Object
getTreeLock()
{
return(tree_lock);
@@ -292,7 +292,7 @@ processEvent(AWTEvent event)
public String
toString()
{
- return(getClass().getName() + "(" + getName() + ")");
+ return this.getClass().getName() + "[" + paramString() + "]";
}
/*************************************************************************/
@@ -303,7 +303,7 @@ toString()
protected String
paramString()
{
- return(toString());
+ return "name=" + getName();
}
// Accessibility API not yet implemented.
diff --git a/libjava/java/awt/MenuContainer.java b/libjava/java/awt/MenuContainer.java
index 074a00db5c7..09fe0f0466f 100644
--- a/libjava/java/awt/MenuContainer.java
+++ b/libjava/java/awt/MenuContainer.java
@@ -1,27 +1,69 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation
+/* MenuContainer.java -- Container for menu items.
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
- This file is part of libjava.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libjava License. Please consult the file "LIBJAVA_LICENSE" for
-details. */
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-package java.awt;
-/* Written using "Java Class Libraries", 2nd edition, plus online
- * API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- */
+package java.awt;
+/**
+ * This interface is a container for menu components.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
public interface MenuContainer
{
- public Font getFont();
- /**
- * @deprecated
- */
- public boolean postEvent(Event evt);
+/**
+ * Returns the font in use by this container.
+ *
+ * @return The font in use by this container.
+ */
+public abstract Font
+getFont();
+
+/*************************************************************************/
+
+/**
+ * Removes the specified menu component from the menu.
+ *
+ * @param component The menu component to remove.
+ */
+public abstract void
+remove(MenuComponent component);
+
+/*************************************************************************/
- public void remove(MenuComponent comp);
-}
+/**
+ * Posts and event to the listeners. This is replaced by
+ * <code>dispatchEvent</code>.
+ *
+ * @param event The event to dispatch.
+ *
+ * @deprecated
+ */
+public abstract boolean
+postEvent(Event event);
+} // interface MenuContainer
diff --git a/libjava/java/awt/MenuItem.java b/libjava/java/awt/MenuItem.java
index 538dbcfe189..742b23d436a 100644
--- a/libjava/java/awt/MenuItem.java
+++ b/libjava/java/awt/MenuItem.java
@@ -437,8 +437,8 @@ processActionEvent(ActionEvent event)
public String
paramString()
{
- return(getClass().getName() + "(label+" + label + ",enabled=" + enabled +
- ",actionCommand=" + actionCommand + ")");
+ return ("label=" + label + ",enabled=" + enabled +
+ ",actionCommand=" + actionCommand + "," + super.paramString());
}
// Accessibility API not yet implemented.
diff --git a/libjava/java/awt/MenuShortcut.java b/libjava/java/awt/MenuShortcut.java
index 289e10c00b7..c79635d3080 100644
--- a/libjava/java/awt/MenuShortcut.java
+++ b/libjava/java/awt/MenuShortcut.java
@@ -1,75 +1,196 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* MenuShortcut.java -- A class for menu accelerators
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
-package java.awt;
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-import java.awt.event.KeyEvent;
-/* Status: Complete, except for hashCode(). Untested. */
+package java.awt;
+/**
+ * This class implements a keyboard accelerator for a menu item.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
public class MenuShortcut implements java.io.Serializable
{
- // Fields from the serialization spec. Decalare others "transient".
- int key;
- boolean usesShift;
-
- public MenuShortcut(int key)
- {
- this.key = key;
- }
-
- public MenuShortcut(int key, boolean useShiftModifier)
- {
- this.key = key;
- this.usesShift = useShiftModifier;
- }
-
- public int getKey()
- {
- return key;
- }
-
- public boolean usesShiftModifier()
- {
- return usesShift;
- }
-
- public boolean equals(MenuShortcut ms)
- {
- return (ms.key == key && ms.usesShift == usesShift);
- }
-
- public boolean equals(Object obj)
- {
- if (obj instanceof MenuShortcut)
- {
- MenuShortcut ms = (MenuShortcut) obj;
- return (ms.key == key && ms.usesShift == usesShift);
- }
- return false;
- }
-
- public int hashCode()
- {
- // FIXME: find/implement the correct algorithm for this
- if (usesShift)
- return (2 * key);
- else
- return key;
- }
-
- public String toString()
- {
- return paramString(); // ?
- }
-
- protected String paramString()
- {
- return KeyEvent.getKeyText(key);
- }
+
+/*
+ * Static Variables
+ */
+
+// Serialization Constant
+private static final long serialVersionUID = 143448358473180225L;
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
+ */
+
+/**
+ * @serial The virtual keycode for the shortcut.
+ */
+private int key;
+
+/**
+ * @serial <code>true</code> if the shift key was used with this shortcut,
+ * or <code>false</code> otherwise.
+ */
+private boolean usesShift;
+
+/*************************************************************************/
+
+/**
+ * Initializes a new instance of <code>MenuShortcut</code> with the
+ * specified virtual key value.
+ *
+ * @param key The virtual keycode for the shortcut.
+ */
+public
+MenuShortcut(int key)
+{
+ this(key, false);
+}
+
+/*************************************************************************/
+
+/**
+ * Initializes a new instance of <code>MenuShortcut</code> with the
+ * specified virtual key value and shift setting.
+ *
+ * @param key The virtual keycode for the shortcut.
+ * @param usesShift <code>true</code> if the shift key was pressed,
+ * <code>false</code> otherwise.
+ */
+public
+MenuShortcut(int key, boolean usesShift)
+{
+ this.key = key;
+ this.usesShift = usesShift;
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Returns the virtual keycode for this shortcut.
+ *
+ * @return The virtual keycode for this shortcut.
+ */
+public int
+getKey()
+{
+ return(key);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns the shift setting for this shortcut.
+ *
+ * @return <code>true</code> if the shift key was pressed, <code>false</code>
+ * otherwise.
+ */
+public boolean
+usesShiftModifier()
+{
+ return(usesShift);
+}
+
+/*************************************************************************/
+
+/**
+ * Tests this object for equality against the specified object. The two
+ * objects will be considered equal if and only if the specified object
+ * is an instance of <code>MenuShortcut</code> and has the same key value
+ * and shift setting as this object.
+ *
+ * @param obj The object to test for equality against.
+ *
+ * @return <code>true</code> if the two objects are equal, <code>false</code>
+ * otherwise.
+ */
+public boolean
+equals(MenuShortcut obj)
+{
+ if (obj == null)
+ return(false);
+
+ if (obj.key != this.key)
+ return(false);
+
+ if (obj.usesShift != this.usesShift)
+ return(false);
+
+ return(true);
+}
+
+public boolean
+equals(Object obj)
+{
+ if (obj instanceof MenuShortcut)
+ {
+ MenuShortcut ms = (MenuShortcut) obj;
+ return (ms.key == key && ms.usesShift == usesShift);
+ }
+ return false;
}
+
+/*************************************************************************/
+
+/**
+ * Returns a string representation of this shortcut.
+ *
+ * @return A string representation of this shortcut.
+ */
+public String
+toString()
+{
+ return(getClass().getName() + "[" + paramString () + "]");
+}
+
+public int
+hashCode()
+{
+ // Arbitrary.
+ return key + (usesShift ? 23 : 57);
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a debugging string for this object.
+ *
+ * @return A debugging string for this object.
+ */
+protected String
+paramString()
+{
+ return "key=" + key + ",usesShift=" + usesShift;
+}
+
+} // class MenuShortcut
diff --git a/libjava/java/awt/PaintContext.java b/libjava/java/awt/PaintContext.java
index 0b4e6a7b0d7..203772002a2 100644
--- a/libjava/java/awt/PaintContext.java
+++ b/libjava/java/awt/PaintContext.java
@@ -1,10 +1,28 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2002 Free Software Foundation
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt;
diff --git a/libjava/java/awt/Panel.java b/libjava/java/awt/Panel.java
index 672caf95296..47b0b95d9e0 100644
--- a/libjava/java/awt/Panel.java
+++ b/libjava/java/awt/Panel.java
@@ -1,36 +1,88 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Panel.java -- Simple container object.
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt;
+import java.awt.peer.PanelPeer;
+import java.awt.peer.ContainerPeer;
import java.awt.peer.ComponentPeer;
-/* This class is complete to 1.2. */
+/**
+ * A panel is a simple container class.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
+public class Panel extends Container implements java.io.Serializable
+{
-public class Panel extends Container
+/*
+ * Constructors
+ */
+
+/**
+ * Initializes a new instance of <code>Panel</code> that has a default
+ * layout manager of <code>FlowLayout</code>.
+ */
+public
+Panel()
{
- public Panel()
- {
- this (new FlowLayout ());
- }
-
- public Panel(LayoutManager layout)
- {
- super();
- setLayout (layout);
- }
-
- //public AccessibleContext getAccessibleContext()
-
- public void addNotify()
- {
- if (peer == null)
- peer = getToolkit().createPanel(this);
- super.addNotify();
- }
+ this(new FlowLayout());
}
+
+/*************************************************************************/
+
+/**
+ * Initializes a new instance of <code>Panel</code> with the specified
+ * layout manager.
+ *
+ * @param layoutManager The layout manager for this object.
+ */
+public
+Panel(LayoutManager layoutManager)
+{
+ setLayout(layoutManager);
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Notifies this object to create its native peer.
+ */
+public void
+addNotify()
+{
+ if (peer == null)
+ peer = getToolkit().createPanel(this);
+ super.addNotify();
+}
+
+} // class Panel
+
diff --git a/libjava/java/awt/PopupMenu.java b/libjava/java/awt/PopupMenu.java
index ed4f343239d..7ec2ad5154a 100644
--- a/libjava/java/awt/PopupMenu.java
+++ b/libjava/java/awt/PopupMenu.java
@@ -1,56 +1,119 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* PopupMenu.java -- An AWT popup menu
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
- This file is part of libjava.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libjava License. Please consult the file "LIBJAVA_LICENSE" for
-details. */
package java.awt;
import java.awt.peer.PopupMenuPeer;
+import java.awt.peer.MenuPeer;
+import java.awt.peer.MenuItemPeer;
+import java.awt.peer.MenuComponentPeer;
+/**
+ * This class implement an AWT popup menu widget
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
+public class PopupMenu extends Menu implements java.io.Serializable
+{
+
+/*
+ * Static Variables
+ */
+
+// Serialization Constant
+private static final long serialVersionUID = -4620452533522760060L;
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * Initializes a new instance of <code>PopupMenu</code>.
+ */
+public
+PopupMenu()
+{
+}
-/* Status: Incomplete. */
+/*************************************************************************/
-public class PopupMenu extends Menu
+/**
+ * Initializes a new instance of <code>PopupMenu</code> with the specified
+ * label.
+ *
+ * @param label The label for this popup menu.
+ */
+public
+PopupMenu(String label)
{
- public PopupMenu()
- {
- super();
- }
-
- public PopupMenu(String label)
- {
- super(label);
- }
-
- public void addNotify()
- {
- if (peer != null)
- {
- // This choice of toolkit seems unsatisfying, but I'm not sure
- // what else to do.
- peer = Toolkit.getDefaultToolkit ().createPopupMenu (this);
- }
- super.addNotify ();
- }
-
- public void show(Component origin, int x, int y)
- {
- if (! origin.isShowing ()
- // FIXME: or ! parent is showing -- but how?
- )
- {
- // This is an invalid call which we choose to ignore.
- return;
- }
-
- addNotify (); // FIXME?
- Event e = new Event (origin, 0, 0, x, y, 0, 0);
- PopupMenuPeer p = (PopupMenuPeer) peer;
- p.show (e);
- }
-
- // Accessibility API not yet implemented.
- // public AccessibleContext getAccessibleContext()
+ super(label);
}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Creates this object's native peer.
+ */
+public void
+addNotify()
+{
+ if (peer != null)
+ peer = getToolkit ().createPopupMenu (this);
+ super.addNotify ();
+}
+
+/*************************************************************************/
+
+/**
+ * Displays this popup menu at the specified coordinates relative to
+ * the specified component.
+ *
+ * @param component The component to which the display coordinates are relative.
+ * @param x The X coordinate of the menu.
+ * @param y The Y coordinate of the menu.
+ */
+public void
+show(Component component, int x, int y)
+{
+ PopupMenuPeer pmp = (PopupMenuPeer)getPeer();
+ if (pmp != null)
+ {
+ /* XXX
+ Event e = new Event (component, Event.ACTION_EVENT, component);
+ e.x = x;
+ e.y = y;*/
+ pmp.show (component, x, y);
+ }
+}
+
+} // class PopupMenu
+
diff --git a/libjava/java/awt/SystemColor.java b/libjava/java/awt/SystemColor.java
index 0a77d0575ad..ebe2ee2e48c 100644
--- a/libjava/java/awt/SystemColor.java
+++ b/libjava/java/awt/SystemColor.java
@@ -1,158 +1,419 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* SystemColor.java -- Class to access system color values.
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt;
-/** This class contains most of the colors used by the native
- * windowing sytem to draw native components.
- * @author Tom Tromey <tromey@redhat.com>
- * @date December 25, 2000
- */
+/**
+ * This class contains the various "system colors" in use by the
+ * native windowing system.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ */
public final class SystemColor extends Color implements java.io.Serializable
{
- /** The background color for the title bar of an active window. */
- public static final SystemColor activeCaption
- = new SystemColor (ACTIVE_CAPTION);
- /** The border color of an active window. */
- public static final SystemColor activeCaptionBorder
- = new SystemColor (ACTIVE_CAPTION_BORDER);
- /** The color of text in the title bar of an active window. */
- public static final SystemColor activeCaptionText
- = new SystemColor (ACTIVE_CAPTION_TEXT);
- /** The background color. */
- public static final SystemColor control = new SystemColor (CONTROL);
- /** The darkest color of an outline. */
- public static final SystemColor controlDkShadow
- = new SystemColor (CONTROL_DK_SHADOW);
- /** The second brightest color of an outline. */
- public static final SystemColor controlHighlight
- = new SystemColor (CONTROL_HIGHLIGHT);
- /** The brightest color of an outline. */
- public static final SystemColor controlLtHighlight
- = new SystemColor (CONTROL_LT_HIGHLIGHT);
- /** The second darkest color of an outline. */
- public static final SystemColor controlShadow
- = new SystemColor (CONTROL_SHADOW);
- /** The color of text in a label. */
- public static final SystemColor controlText = new SystemColor (CONTROL_TEXT);
- /** The background color of the desktop. */
- public static final SystemColor desktop = new SystemColor (DESKTOP);
- /** The background color for the title bar of an inactive window. */
- public static final SystemColor inactiveCaption
- = new SystemColor (INACTIVE_CAPTION);
- /** The border color of an inactive window. */
- public static final SystemColor inactiveCaptionBorder
- = new SystemColor (INACTIVE_CAPTION_BORDER);
- /** The color of text in the title ar of an inactive window. */
- public static final SystemColor inactiveCaptionText
- = new SystemColor (INACTIVE_CAPTION_TEXT);
- /** The background color of tooltips. */
- public static final SystemColor info = new SystemColor (INFO);
- /** The color of text in tooltips. */
- public static final SystemColor infoText = new SystemColor (INFO_TEXT);
- /** The background color of a menu. */
- public static final SystemColor menu = new SystemColor (MENU);
- /** The color of text in a menu. */
- public static final SystemColor menuText = new SystemColor (MENU_TEXT);
- /** The background color of a scrollbar. */
- public static final SystemColor scrollbar = new SystemColor (SCROLLBAR);
- /** The background color of text components. */
- public static final SystemColor text = new SystemColor (TEXT);
- /** The background color of highlighted text. */
- public static final SystemColor textHighlight
- = new SystemColor (TEXT_HIGHLIGHT);
- /** The color of highlighted text. */
- public static final SystemColor textHighlightText
- = new SystemColor (TEXT_HIGHLIGHT_TEXT);
- /** The color of inactive text. */
- public static final SystemColor textInactiveText
- = new SystemColor (TEXT_INACTIVE_TEXT);
- /** The color of text in text components. */
- public static final SystemColor textText = new SystemColor (TEXT_TEXT);
- /** The background color of a window. */
- public static final SystemColor window = new SystemColor (WINDOW);
- /** The border color of a window. */
- public static final SystemColor windowBorder
- = new SystemColor (WINDOW_BORDER);
- /** The color of text in a window. */
- public static final SystemColor windowText = new SystemColor (WINDOW_TEXT);
-
- public static final int DESKTOP = 0;
- public static final int ACTIVE_CAPTION = 1;
- public static final int ACTIVE_CAPTION_TEXT = 2;
- public static final int ACTIVE_CAPTION_BORDER = 3;
- public static final int INACTIVE_CAPTION = 4;
- public static final int INACTIVE_CAPTION_TEXT = 5;
- public static final int INACTIVE_CAPTION_BORDER = 6;
- public static final int WINDOW = 7;
- public static final int WINDOW_BORDER = 8;
- public static final int WINDOW_TEXT = 9;
- public static final int MENU = 10;
- public static final int MENU_TEXT = 11;
- public static final int TEXT = 12;
- public static final int TEXT_TEXT = 13;
- public static final int TEXT_HIGHLIGHT = 14;
- public static final int TEXT_HIGHLIGHT_TEXT = 15;
- public static final int TEXT_INACTIVE_TEXT = 16;
- public static final int CONTROL = 17;
- public static final int CONTROL_TEXT = 18;
- public static final int CONTROL_HIGHLIGHT = 19;
- public static final int CONTROL_LT_HIGHLIGHT = 20;
- public static final int CONTROL_SHADOW = 21;
- public static final int CONTROL_DK_SHADOW = 22;
- public static final int SCROLLBAR = 23;
- public static final int INFO = 24;
- public static final int INFO_TEXT = 25;
-
- public static final int NUM_COLORS = 26;
-
- private static final int rgbs[] =
- {
- 0x005c5c,
- 0x000080,
- 0xffffff,
- 0xc0c0c0,
- 0x808080,
- 0xc0c0c0,
- 0xc0c0c0,
- 0xffffff,
- 0x000000,
- 0x000000,
- 0xc0c0c0,
- 0x000000,
- 0xc0c0c0,
- 0x000000,
- 0x000080,
- 0xffffff,
- 0x808080,
- 0xc0c0c0,
- 0x000000,
- 0xffffff,
- 0xe0e0e0,
- 0x808080,
- 0x000000,
- 0xe0e0e0,
- 0xe0e000,
- 0x000000
- };
-
- public int getRGB ()
- {
- return rgbs[rgba];
- }
-
- public String toString ()
- {
- return "[" + getClass ().getName () + " " + rgba + "]";
- }
-
- private SystemColor (int index)
- {
- super (index, true);
- }
+
+/*
+ * Static Variables
+ */
+
+/**
+ * Array index of the desktop color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int DESKTOP = 0;
+
+/**
+ * Array index of the active caption color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int ACTIVE_CAPTION = 1;
+
+/**
+ * Array index of the active caption text color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int ACTIVE_CAPTION_TEXT = 2;
+
+/**
+ * Array index of the active caption border color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int ACTIVE_CAPTION_BORDER = 3;
+
+/**
+ * Array index of the inactive caption color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int INACTIVE_CAPTION = 4;
+
+/**
+ * Array index of the inactive caption text color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int INACTIVE_CAPTION_TEXT = 5;
+
+/**
+ * Array index of the inactive caption border color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int INACTIVE_CAPTION_BORDER = 6;
+
+/**
+ * Array index of the window background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int WINDOW = 7;
+
+/**
+ * Array index of the window border color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int WINDOW_BORDER = 8;
+
+/**
+ * Array index of the window text color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int WINDOW_TEXT = 9;
+
+/**
+ * Array index of the menu background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int MENU = 10;
+
+/**
+ * Array index of the menu text color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int MENU_TEXT = 11;
+
+/**
+ * Array index of the text background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int TEXT = 12;
+
+/**
+ * Array index of the text foreground color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int TEXT_TEXT = 13;
+
+/**
+ * Array index of the highlighted text background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int TEXT_HIGHLIGHT = 14;
+
+/**
+ * Array index of the highlighted text foreground color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int TEXT_HIGHLIGHT_TEXT = 15;
+
+/**
+ * Array index of the inactive text foreground color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int TEXT_INACTIVE_TEXT = 16;
+
+/**
+ * Array index of the control background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int CONTROL = 17;
+
+/**
+ * Array index of the control text color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int CONTROL_TEXT = 18;
+
+/**
+ * Array index of the highlighted control background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int CONTROL_HIGHLIGHT = 19;
+
+/**
+ * Array index of the lightly highlighted control background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int CONTROL_LT_HIGHLIGHT = 20;
+
+/**
+ * Array index of the shadowed control background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int CONTROL_SHADOW = 21;
+
+/**
+ * Array index of the darkly shadowed control background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int CONTROL_DK_SHADOW = 22;
+
+/**
+ * Array index of the scrollbar background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int SCROLLBAR = 23;
+
+/**
+ * Array index of the info background color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int INFO = 24;
+
+/**
+ * Array index of the info text color. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int INFO_TEXT = 25;
+
+/**
+ * The number of system colors. Used by
+ * <code>Toolkit.loadSystemColors()</code>.
+ */
+public static final int NUM_COLORS = 26;
+
+/**
+ * The desktop color.
+ */
+public static final SystemColor desktop;
+
+/**
+ * The active caption background color.
+ */
+public static final SystemColor activeCaption;
+
+/**
+ * The active caption text color.
+ */
+public static final SystemColor activeCaptionText;
+
+/**
+ * The active caption border color.
+ */
+public static final SystemColor activeCaptionBorder;
+
+/**
+ * The inactive caption background color.
+ */
+public static final SystemColor inactiveCaption;
+
+/**
+ * The inactive caption text color.
+ */
+public static final SystemColor inactiveCaptionText;
+
+/**
+ * The inactive caption border color.
+ */
+public static final SystemColor inactiveCaptionBorder;
+
+/**
+ * The window background color.
+ */
+public static final SystemColor window;
+
+/**
+ * The window border color.
+ */
+public static final SystemColor windowBorder;
+
+/**
+ * The window text color.
+ */
+public static final SystemColor windowText;
+
+/**
+ * The menu background color.
+ */
+public static final SystemColor menu;
+
+/**
+ * The menu text color.
+ */
+public static final SystemColor menuText;
+
+/**
+ * The text background color.
+ */
+public static final SystemColor text;
+
+/**
+ * The text foreground color.
+ */
+public static final SystemColor textText;
+
+/**
+ * The highlighted text background color.
+ */
+public static final SystemColor textHighlight;
+
+/**
+ * The highlighted text foreground color.
+ */
+public static final SystemColor textHighlightText;
+
+/**
+ * The inactive text color.
+ */
+public static final SystemColor textInactiveText;
+
+/**
+ * The control background color.
+ */
+public static final SystemColor control;
+
+/**
+ * The control text color.
+ */
+public static final SystemColor controlText;
+
+/**
+ * The control highlight color.
+ */
+public static final SystemColor controlHighlight;
+
+/**
+ * The control light highlight color.
+ */
+public static final SystemColor controlLtHighlight;
+
+/**
+ * The control shadow color.
+ */
+public static final SystemColor controlShadow;
+
+/**
+ * The control dark shadow color.
+ */
+public static final SystemColor controlDkShadow;
+
+/**
+ * The scrollbar color.
+ */
+public static final SystemColor scrollbar;
+
+/**
+ * The info text background color.
+ */
+public static final SystemColor info;
+
+/**
+ * The info text foreground color.
+ */
+public static final SystemColor infoText;
+
+// Serialization version constant
+private static final long serialVersionUID = 4503142729533789064L;
+
+static
+{
+ int[] sys_color_rgbs = new int[NUM_COLORS];
+ Toolkit.getDefaultToolkit().loadSystemColors(sys_color_rgbs);
+
+ desktop = new SystemColor(sys_color_rgbs[DESKTOP]);
+ activeCaption= new SystemColor(sys_color_rgbs[ACTIVE_CAPTION]);
+ activeCaptionText= new SystemColor(sys_color_rgbs[ACTIVE_CAPTION_TEXT]);
+ activeCaptionBorder = new SystemColor(sys_color_rgbs[ACTIVE_CAPTION_BORDER]);
+ inactiveCaption = new SystemColor(sys_color_rgbs[INACTIVE_CAPTION]);
+ inactiveCaptionText = new SystemColor(sys_color_rgbs[INACTIVE_CAPTION_TEXT]);
+ inactiveCaptionBorder =
+ new SystemColor(sys_color_rgbs[INACTIVE_CAPTION_BORDER]);
+ window = new SystemColor(sys_color_rgbs[WINDOW]);
+ windowBorder = new SystemColor(sys_color_rgbs[WINDOW_BORDER]);
+ windowText = new SystemColor(sys_color_rgbs[WINDOW_TEXT]);
+ menu = new SystemColor(sys_color_rgbs[MENU]);
+ menuText = new SystemColor(sys_color_rgbs[MENU_TEXT]);
+ text = new SystemColor(sys_color_rgbs[TEXT]);
+ textText = new SystemColor(sys_color_rgbs[TEXT_TEXT]);
+ textHighlight = new SystemColor(sys_color_rgbs[TEXT_HIGHLIGHT]);
+ textHighlightText = new SystemColor(sys_color_rgbs[TEXT_HIGHLIGHT_TEXT]);
+ textInactiveText = new SystemColor(sys_color_rgbs[TEXT_INACTIVE_TEXT]);
+ control = new SystemColor(sys_color_rgbs[CONTROL]);
+ controlText = new SystemColor(sys_color_rgbs[CONTROL_TEXT]);
+ controlHighlight = new SystemColor(sys_color_rgbs[CONTROL_HIGHLIGHT]);
+ controlLtHighlight = new SystemColor(sys_color_rgbs[CONTROL_LT_HIGHLIGHT]);
+ controlShadow = new SystemColor(sys_color_rgbs[CONTROL_SHADOW]);
+ controlDkShadow = new SystemColor(sys_color_rgbs[CONTROL_DK_SHADOW]);
+ scrollbar = new SystemColor(sys_color_rgbs[SCROLLBAR]);
+ info = new SystemColor(sys_color_rgbs[INFO]);
+ infoText = new SystemColor(sys_color_rgbs[INFO_TEXT]);
+}
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+private
+SystemColor(int rgb)
+{
+ super(rgb);
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Returns the RGB value for this color as an <code>int</code>. The first
+ * byte is the blue value, the second the green value, the third the
+ * red value and the fourth is set to 0xFF.
+ *
+ * @return The RGB value.
+ */
+public int
+getRGB()
+{
+ // Override only to be spec consistent.
+ return(super.getRGB());
+}
+
+/*************************************************************************/
+
+/**
+ * Returns a string describing this color.
+ *
+ * @return A string describing this color.
+ */
+public String
+toString()
+{
+ return("SystemColor(R=" + getRed() + ",G=" + getGreen() + ",B=" +
+ getBlue() + ")");
}
+
+} // class SystemColor
+
diff --git a/libjava/java/awt/peer/ButtonPeer.java b/libjava/java/awt/peer/ButtonPeer.java
index d4d8034bd13..f4cfc4584c2 100644
--- a/libjava/java/awt/peer/ButtonPeer.java
+++ b/libjava/java/awt/peer/ButtonPeer.java
@@ -1,15 +1,36 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* ButtonPeer.java -- Peer interface for buttons
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface ButtonPeer extends ComponentPeer
{
- void setLabel(String label);
-}
+
+public abstract void setLabel(String label);
+
+} // interface ButtonPeer
diff --git a/libjava/java/awt/peer/CanvasPeer.java b/libjava/java/awt/peer/CanvasPeer.java
index 67c405504bb..5d09ef0315e 100644
--- a/libjava/java/awt/peer/CanvasPeer.java
+++ b/libjava/java/awt/peer/CanvasPeer.java
@@ -1,13 +1,34 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* CanvasPeer.java -- Peer interface for a canvas
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface CanvasPeer extends ComponentPeer
{
-}
+
+} // interface CanvasPeer
+
diff --git a/libjava/java/awt/peer/CheckboxMenuItemPeer.java b/libjava/java/awt/peer/CheckboxMenuItemPeer.java
index 42c6c8f31cd..f12b7abd589 100644
--- a/libjava/java/awt/peer/CheckboxMenuItemPeer.java
+++ b/libjava/java/awt/peer/CheckboxMenuItemPeer.java
@@ -1,15 +1,36 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* CheckboxMenuItemPeer.java -- Peer interface for checkbox menu items
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface CheckboxMenuItemPeer extends MenuItemPeer
{
- void setState(boolean state);
-}
+
+public abstract void setState(boolean state);
+
+} // interface CheckboxMenuItemPeer
diff --git a/libjava/java/awt/peer/CheckboxPeer.java b/libjava/java/awt/peer/CheckboxPeer.java
index b27b2cf1fc6..9efc543673d 100644
--- a/libjava/java/awt/peer/CheckboxPeer.java
+++ b/libjava/java/awt/peer/CheckboxPeer.java
@@ -1,16 +1,38 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* CheckboxPeer.java -- Interface for checkbox peer
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface CheckboxPeer extends ComponentPeer
{
- void setCheckboxGroup(java.awt.CheckboxGroup group);
- void setLabel(String label);
- void setState(boolean state);
-}
+
+public abstract void setCheckboxGroup(java.awt.CheckboxGroup group);
+public abstract void setLabel(String label);
+public abstract void setState(boolean state);
+
+} // interface CheckboxPeer
+
diff --git a/libjava/java/awt/peer/ChoicePeer.java b/libjava/java/awt/peer/ChoicePeer.java
index d55d3edf0ab..5a2234bda1e 100644
--- a/libjava/java/awt/peer/ChoicePeer.java
+++ b/libjava/java/awt/peer/ChoicePeer.java
@@ -1,17 +1,39 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* ChoicePeer.java -- Peer for choice box
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface ChoicePeer extends ComponentPeer
{
- void add(String item, int index);
- void remove(int index);
- void select(int index);
-}
+
+public abstract void add(String item, int index);
+public abstract void addItem(String item, int index);
+public abstract void remove(int index);
+public abstract void select(int index);
+
+} // interface ChoicePeer
diff --git a/libjava/java/awt/peer/ComponentPeer.java b/libjava/java/awt/peer/ComponentPeer.java
index 6a587a23e1f..2b2ae215ca7 100644
--- a/libjava/java/awt/peer/ComponentPeer.java
+++ b/libjava/java/awt/peer/ComponentPeer.java
@@ -1,10 +1,29 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* ComponentPeer.java -- Toplevel component peer
+ Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
@@ -13,10 +32,42 @@ import java.awt.image.*;
public interface ComponentPeer
{
- int checkImage(Image img, int width, int height, ImageObserver o);
- Image createImage(ImageProducer prod);
- Image createImage(int width, int height);
- void dispose();
+ public int checkImage(Image img, int width, int height,
+ ImageObserver ob);
+ public Image createImage(ImageProducer prod);
+ public Image createImage(int width, int height);
+ public void disable();
+ public void dispose();
+ public void enable();
+ public ColorModel getColorModel();
+ public FontMetrics getFontMetrics(Font f);
+ public Graphics getGraphics();
+ public Point getLocationOnScreen();
+ public Dimension getMinimumSize();
+ public Dimension getPreferredSize();
+ public Toolkit getToolkit();
+ // The JCL says that handleEvent returns boolean. However, we've
+ // experimentally determined that it in fact actually returns void.
+ public void handleEvent(AWTEvent e);
+ public void hide();
+ public boolean isFocusTraversable();
+ public Dimension minimumSize();
+ public Dimension preferredSize();
+ public void paint(Graphics graphics);
+ public boolean prepareImage(Image img, int width, int height,
+ ImageObserver ob);
+ public void print(Graphics graphics);
+ public void repaint(long tm, int x, int y, int width, int height);
+ public void requestFocus();
+ public void reshape(int x, int y, int width, int height);
+ public void setBackground(Color color);
+ public void setBounds(int x, int y, int width, int height);
+ public void setCursor(Cursor cursor);
+ public void setEnabled(boolean enabled);
+ public void setFont(Font font);
+ public void setForeground(Color color);
+ public void setVisible(boolean visible);
+ public void show();
/**
* Get the graphics configuration of the component. The color model
@@ -24,27 +75,5 @@ public interface ComponentPeer
*/
GraphicsConfiguration getGraphicsConfiguration();
- FontMetrics getFontMetrics(Font f);
- Graphics getGraphics();
- Point getLocationOnScreen();
- Dimension getMinimumSize();
- Dimension getPreferredSize();
- Toolkit getToolkit();
- // The JCL says that handleEvent returns boolean. However, we've
- // experimentally determined that it in fact actually returns void.
- void handleEvent(AWTEvent e);
- boolean isFocusTraversable();
- void paint(Graphics graphics);
- boolean prepareImage(Image img, int width, int height, ImageObserver o);
- void print(Graphics graphics);
- void repaint(long tm, int x, int y, int width, int height);
- void requestFocus();
- void setBackground(Color color);
- void setBounds(int x, int y, int width, int height);
- void setCursor(Cursor cursor);
- void setEnabled(boolean enabled);
- void setEventMask(long eventMask);
- void setFont(Font font);
- void setForeground(Color color);
- void setVisible(boolean visible);
+ public void setEventMask (long mask);
}
diff --git a/libjava/java/awt/peer/ContainerPeer.java b/libjava/java/awt/peer/ContainerPeer.java
index ea44e1329c9..ea08c006080 100644
--- a/libjava/java/awt/peer/ContainerPeer.java
+++ b/libjava/java/awt/peer/ContainerPeer.java
@@ -1,10 +1,29 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* ContainerPeer.java -- Interface for container peers
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
@@ -12,7 +31,11 @@ import java.awt.Insets;
public interface ContainerPeer extends ComponentPeer
{
- Insets getInsets();
- void beginValidate();
- void endValidate();
-}
+
+public abstract Insets insets();
+public abstract Insets getInsets();
+public abstract void beginValidate();
+public abstract void endValidate();
+
+} // interface ContainerPeer
+
diff --git a/libjava/java/awt/peer/DialogPeer.java b/libjava/java/awt/peer/DialogPeer.java
index 009410f0e6a..faa95f1b351 100644
--- a/libjava/java/awt/peer/DialogPeer.java
+++ b/libjava/java/awt/peer/DialogPeer.java
@@ -1,15 +1,37 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* DialogPeer.java -- Interface for dialog box peer
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface DialogPeer extends WindowPeer
{
- void setResizable(boolean resizeable);
- void setTitle(String title);
-}
+
+public abstract void setResizable(boolean resizeable);
+public abstract void setTitle(String title);
+
+} // interface DialogPeer
+
diff --git a/libjava/java/awt/peer/FileDialogPeer.java b/libjava/java/awt/peer/FileDialogPeer.java
index c378f1059f3..549450eb033 100644
--- a/libjava/java/awt/peer/FileDialogPeer.java
+++ b/libjava/java/awt/peer/FileDialogPeer.java
@@ -1,10 +1,29 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* FileDialogPeer.java -- Interface for file selection dialog box peer
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
@@ -12,7 +31,10 @@ import java.io.FilenameFilter;
public interface FileDialogPeer extends DialogPeer
{
- void setDirectory(String dir);
- void setFile(String file);
- void setFilenameFilter(FilenameFilter filter);
-}
+
+public abstract void setFile(String file);
+public abstract void setDirectory(String dir);
+public abstract void setFilenameFilter(FilenameFilter ff);
+
+} // interface FileDialogPeer
+
diff --git a/libjava/java/awt/peer/FontPeer.java b/libjava/java/awt/peer/FontPeer.java
index 2a65a38f574..9ca400e77ca 100644
--- a/libjava/java/awt/peer/FontPeer.java
+++ b/libjava/java/awt/peer/FontPeer.java
@@ -1,13 +1,34 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* FontPeer.java -- Interface for font peers
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface FontPeer
{
-}
+
+} // interface FontPeer
+
diff --git a/libjava/java/awt/peer/FramePeer.java b/libjava/java/awt/peer/FramePeer.java
index c47b0f5e7c4..c90e84f98f9 100644
--- a/libjava/java/awt/peer/FramePeer.java
+++ b/libjava/java/awt/peer/FramePeer.java
@@ -1,10 +1,29 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* FramePeer.java -- Interface for frame peers
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
@@ -13,8 +32,11 @@ import java.awt.MenuBar;
public interface FramePeer extends WindowPeer
{
- void setIconImage(Image image);
- void setMenuBar(MenuBar mb);
- void setResizable(boolean resizable);
- void setTitle(String title);
-}
+
+public abstract void setIconImage(Image image);
+public abstract void setMenuBar(MenuBar mb);
+public abstract void setResizable(boolean resizable);
+public abstract void setTitle(String title);
+
+} // interface FramePeer
+
diff --git a/libjava/java/awt/peer/LabelPeer.java b/libjava/java/awt/peer/LabelPeer.java
index 4d32b799090..be7c4de1cd8 100644
--- a/libjava/java/awt/peer/LabelPeer.java
+++ b/libjava/java/awt/peer/LabelPeer.java
@@ -1,15 +1,37 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* LabelPeer.java -- Interface for simple text lable peer
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface LabelPeer extends ComponentPeer
{
- void setAlignment(int alignment);
- void setText(String text);
-}
+
+public abstract void setAlignment(int alignment);
+public abstract void setText(String text);
+
+} // interface LabelPeer
+
diff --git a/libjava/java/awt/peer/LightweightPeer.java b/libjava/java/awt/peer/LightweightPeer.java
index af3c1321eef..ecca769b194 100644
--- a/libjava/java/awt/peer/LightweightPeer.java
+++ b/libjava/java/awt/peer/LightweightPeer.java
@@ -1,13 +1,34 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* LightweightPeer.java -- Interface for lightweight peers
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface LightweightPeer extends ComponentPeer
{
-}
+
+} // interface LightweightPeer
+
diff --git a/libjava/java/awt/peer/ListPeer.java b/libjava/java/awt/peer/ListPeer.java
index 062a2c1fc83..55762948828 100644
--- a/libjava/java/awt/peer/ListPeer.java
+++ b/libjava/java/awt/peer/ListPeer.java
@@ -1,10 +1,29 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* ListPeer.java -- Interface for list box peer
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
@@ -12,12 +31,20 @@ import java.awt.Dimension;
public interface ListPeer extends ComponentPeer
{
- void add(String item, int index);
- void delItems(int start_index, int end_index);
- void deselect(int index);
- int[] getSelectedIndexes();
- void makeVisible(int index);
- void removeAll();
- void select(int index);
- void setMultipleMode(boolean multipleMode);
-}
+
+public abstract void add(String item, int index);
+public abstract void addItem(String item, int index);
+public abstract void clear();
+public abstract void delItems(int start_index, int end_index);
+public abstract void deselect(int index);
+public abstract int[] getSelectedIndexes();
+public abstract void makeVisible(int index);
+public abstract Dimension minimumSize(int s);
+public abstract Dimension preferredSize(int s);
+public abstract void removeAll();
+public abstract void select(int index);
+public abstract void setMultipleMode(boolean multi);
+public abstract void setMultipleSelections(boolean multi);
+
+} // interface ListPeer
+
diff --git a/libjava/java/awt/peer/MenuBarPeer.java b/libjava/java/awt/peer/MenuBarPeer.java
index d69c5920b2e..a9abce84b7b 100644
--- a/libjava/java/awt/peer/MenuBarPeer.java
+++ b/libjava/java/awt/peer/MenuBarPeer.java
@@ -1,10 +1,29 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* MenuBarPeer.java -- Interface for menu bar peer
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
@@ -12,7 +31,10 @@ import java.awt.Menu;
public interface MenuBarPeer extends MenuComponentPeer
{
- void addHelpMenu(Menu menu);
- void add(Menu menu);
- void remove(int index);
-}
+
+public abstract void addHelpMenu(Menu menu);
+public abstract void addMenu(Menu menu);
+public abstract void delMenu(int index);
+
+} // interface MenuBarPeer
+
diff --git a/libjava/java/awt/peer/MenuComponentPeer.java b/libjava/java/awt/peer/MenuComponentPeer.java
index 080f9ea771c..702579e27c2 100644
--- a/libjava/java/awt/peer/MenuComponentPeer.java
+++ b/libjava/java/awt/peer/MenuComponentPeer.java
@@ -1,14 +1,36 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* MenuComponentPeer.java --
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface MenuComponentPeer
{
- void dispose();
-}
+
+public abstract void dispose();
+
+} // interface MenuComponentPeer
+
diff --git a/libjava/java/awt/peer/MenuItemPeer.java b/libjava/java/awt/peer/MenuItemPeer.java
index 7c525293954..a158485a841 100644
--- a/libjava/java/awt/peer/MenuItemPeer.java
+++ b/libjava/java/awt/peer/MenuItemPeer.java
@@ -1,15 +1,39 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* MenuItemPeer.java -- Interface for menu item peers
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface MenuItemPeer extends MenuComponentPeer
{
- void setEnabled(boolean enabled);
- void setLabel(String text);
-}
+
+public abstract void disable();
+public abstract void enable();
+public abstract void setEnabled(boolean enabled);
+public abstract void setLabel(String text);
+
+} // interface MenuItemPeer
+
diff --git a/libjava/java/awt/peer/MenuPeer.java b/libjava/java/awt/peer/MenuPeer.java
index ed8a7e647e7..d347d422eaf 100644
--- a/libjava/java/awt/peer/MenuPeer.java
+++ b/libjava/java/awt/peer/MenuPeer.java
@@ -1,10 +1,29 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* MenuPeer.java -- Interface for menu peers
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
@@ -12,7 +31,8 @@ import java.awt.MenuItem;
public interface MenuPeer extends MenuItemPeer
{
- void add(MenuItem item);
- void addSeparator();
- void remove(int index);
+ public abstract void addItem (MenuItem item);
+ public abstract void addSeparator ();
+ public abstract void delItem (int index);
}
+
diff --git a/libjava/java/awt/peer/PanelPeer.java b/libjava/java/awt/peer/PanelPeer.java
index 13b0e903c57..b41bee70306 100644
--- a/libjava/java/awt/peer/PanelPeer.java
+++ b/libjava/java/awt/peer/PanelPeer.java
@@ -1,13 +1,34 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* PanelPeer.java -- Interface for panel peers
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface PanelPeer extends ContainerPeer
{
-}
+
+} // interface PanelPeer
+
diff --git a/libjava/java/awt/peer/PopupMenuPeer.java b/libjava/java/awt/peer/PopupMenuPeer.java
index e0b398077c1..5d0af8becba 100644
--- a/libjava/java/awt/peer/PopupMenuPeer.java
+++ b/libjava/java/awt/peer/PopupMenuPeer.java
@@ -1,16 +1,37 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* PopupMenuPeer.java -- Interface for popup menu peers
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-package java.awt.peer;
-import java.awt.Event;
+package java.awt.peer;
+import java.awt.Component;
public interface PopupMenuPeer extends MenuPeer
{
- void show(Event e);
-}
+
+public abstract void show (Component origin, int x, int y);
+
+} // interface PopupMenuPeer
+
diff --git a/libjava/java/awt/peer/ScrollPanePeer.java b/libjava/java/awt/peer/ScrollPanePeer.java
index fe300e423c8..e71c172ebea 100644
--- a/libjava/java/awt/peer/ScrollPanePeer.java
+++ b/libjava/java/awt/peer/ScrollPanePeer.java
@@ -1,10 +1,29 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* ScrollPanePeer.java -- Interface for scrollable panes
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
@@ -12,10 +31,13 @@ import java.awt.Adjustable;
public interface ScrollPanePeer extends ContainerPeer
{
- void childResized(int width, int height);
- int getHScrollbarHeight();
- int getVScrollbarWidth();
- void setScrollPosition(int x, int y);
- void setUnitIncrement(Adjustable adj, int increment);
- void setValue(Adjustable adj, int value);
-}
+
+public abstract int getHScrollbarHeight();
+public abstract int getVScrollbarWidth();
+public abstract void setScrollPosition(int h, int v);
+public abstract void childResized(int width, int height);
+public abstract void setUnitIncrement(Adjustable item, int inc);
+public abstract void setValue(Adjustable item, int value);
+
+} // interface ScollPanePeer
+
diff --git a/libjava/java/awt/peer/ScrollbarPeer.java b/libjava/java/awt/peer/ScrollbarPeer.java
index 3981c22b09d..51504054ce8 100644
--- a/libjava/java/awt/peer/ScrollbarPeer.java
+++ b/libjava/java/awt/peer/ScrollbarPeer.java
@@ -1,16 +1,38 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* ScrollbarPeer.java -- Interface for scrollbar peers
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface ScrollbarPeer extends ComponentPeer
{
- void setLineIncrement(int increment);
- void setPageIncrement(int increment);
- void setValues(int value, int visible, int minimum, int maximum);
-}
+
+public abstract void setLineIncrement(int inc);
+public abstract void setPageIncrement(int inc);
+public abstract void setValues(int value, int visible, int min, int max);
+
+} // interface ScrollbarPeer
+
diff --git a/libjava/java/awt/peer/TextAreaPeer.java b/libjava/java/awt/peer/TextAreaPeer.java
index ecc9b2c5e38..3830d017f74 100644
--- a/libjava/java/awt/peer/TextAreaPeer.java
+++ b/libjava/java/awt/peer/TextAreaPeer.java
@@ -1,10 +1,29 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* TextAreaPeer.java -- Interface for text area peers
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
@@ -12,6 +31,14 @@ import java.awt.Dimension;
public interface TextAreaPeer extends TextComponentPeer
{
- void insert(String text, int pos);
- void replaceRange(String text, int start, int end);
-}
+
+public abstract void insert(String text, int pos);
+public abstract void insertText(String text, int pos);
+public abstract Dimension minimumSize(int rows, int cols);
+public abstract Dimension getMinimumSize(int rows, int cols);
+public abstract Dimension preferredSize(int rows, int cols);
+public abstract Dimension getPreferredSize(int rows, int cols);
+public abstract void replaceRange(String text, int start_pos, int end_pos);
+public abstract void replaceText(String text, int start_pos, int end_pos);
+
+} // interface TextAreaPeer
diff --git a/libjava/java/awt/peer/TextComponentPeer.java b/libjava/java/awt/peer/TextComponentPeer.java
index ba4ce1d4df0..0617993950e 100644
--- a/libjava/java/awt/peer/TextComponentPeer.java
+++ b/libjava/java/awt/peer/TextComponentPeer.java
@@ -1,21 +1,43 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* TextComponentPeer.java -- Superclass interface for text components
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface TextComponentPeer extends ComponentPeer
{
- int getCaretPosition();
- int getSelectionEnd();
- int getSelectionStart();
- String getText();
- void select(int start, int end);
- void setCaretPosition(int pos);
- void setEditable(boolean editable);
- void setText(String text);
-}
+
+public abstract int getSelectionEnd();
+public abstract int getSelectionStart();
+public abstract String getText();
+public abstract void setText(String text);
+public abstract void select(int start_pos, int end_pos);
+public abstract void setEditable(boolean editable);
+public abstract int getCaretPosition();
+public abstract void setCaretPosition(int pos);
+
+} // interface TextComponentPeer
+
diff --git a/libjava/java/awt/peer/TextFieldPeer.java b/libjava/java/awt/peer/TextFieldPeer.java
index 42949a126ad..71f18544531 100644
--- a/libjava/java/awt/peer/TextFieldPeer.java
+++ b/libjava/java/awt/peer/TextFieldPeer.java
@@ -1,10 +1,29 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* TextFieldPeer.java -- Interface for text field peers
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
@@ -12,5 +31,13 @@ import java.awt.Dimension;
public interface TextFieldPeer extends TextComponentPeer
{
- void setEchoChar(char echo);
-}
+
+public abstract Dimension minimumSize(int len);
+public abstract Dimension preferredSize(int len);
+public abstract Dimension getMinimumSize(int len);
+public abstract Dimension getPreferredSize(int len);
+public abstract void setEchoChar(char echo_char);
+public abstract void setEchoCharacter(char echo_char);
+
+} // interface TextFieldPeer
+
diff --git a/libjava/java/awt/peer/WindowPeer.java b/libjava/java/awt/peer/WindowPeer.java
index d8058056973..28fe81d1618 100644
--- a/libjava/java/awt/peer/WindowPeer.java
+++ b/libjava/java/awt/peer/WindowPeer.java
@@ -1,15 +1,37 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* WindowPeer.java -- Interface for window peers
+ Copyright (C) 1999 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.awt.peer;
public interface WindowPeer extends ContainerPeer
{
- void toBack();
- void toFront();
-}
+
+public abstract void toBack();
+public abstract void toFront();
+
+} // interface WindowPeer
+