aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>1999-05-05 11:05:57 +0000
committerbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>1999-05-05 11:05:57 +0000
commit1f36fb03bd70078f33bd7b17cea8963b9fb30d78 (patch)
tree3edb990316aba3328ac1c48470efa027d207dceb
parentfe5b206288efe97f4958b9dc78ecc6d10c5c23a8 (diff)
Add AWT stubs and incomplete classes.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26778 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libjava/java/awt/AWTEvent.java25
-rw-r--r--libjava/java/awt/BorderLayout.java46
-rw-r--r--libjava/java/awt/Component.java98
-rw-r--r--libjava/java/awt/Container.java59
-rw-r--r--libjava/java/awt/Dimension.java78
-rw-r--r--libjava/java/awt/Event.java26
-rw-r--r--libjava/java/awt/Font.java15
-rw-r--r--libjava/java/awt/Frame.java55
-rw-r--r--libjava/java/awt/LayoutManager.java20
-rw-r--r--libjava/java/awt/LayoutManager2.java20
-rw-r--r--libjava/java/awt/Menu.java33
-rw-r--r--libjava/java/awt/MenuBar.java44
-rw-r--r--libjava/java/awt/MenuComponent.java15
-rw-r--r--libjava/java/awt/MenuContainer.java27
-rw-r--r--libjava/java/awt/MenuItem.java25
-rw-r--r--libjava/java/awt/Point.java65
-rw-r--r--libjava/java/awt/Rectangle.java35
-rw-r--r--libjava/java/awt/Shape.java23
-rw-r--r--libjava/java/awt/TextArea.java49
-rw-r--r--libjava/java/awt/TextComponent.java38
-rw-r--r--libjava/java/awt/Toolkit.java29
-rw-r--r--libjava/java/awt/Window.java29
-rw-r--r--libjava/java/awt/event/ActionEvent.java35
-rw-r--r--libjava/java/awt/event/ActionListener.java21
-rw-r--r--libjava/java/awt/event/ComponentEvent.java20
-rw-r--r--libjava/java/awt/event/InputEvent.java22
-rw-r--r--libjava/java/awt/event/KeyEvent.java38
-rw-r--r--libjava/java/awt/event/KeyListener.java23
-rw-r--r--libjava/java/awt/event/TextEvent.java20
-rw-r--r--libjava/java/awt/event/TextListener.java22
-rw-r--r--libjava/java/awt/event/WindowAdapter.java27
-rw-r--r--libjava/java/awt/event/WindowEvent.java19
-rw-r--r--libjava/java/awt/event/WindowListener.java27
-rw-r--r--libjava/java/awt/geom/Dimension2D.java36
-rw-r--r--libjava/java/awt/geom/Point2D.java69
-rw-r--r--libjava/java/awt/natToolkit.cc19
-rw-r--r--libjava/java/awt/peer/ComponentPeer.java23
-rw-r--r--libjava/java/awt/peer/ContainerPeer.java15
-rw-r--r--libjava/java/awt/peer/FramePeer.java16
-rw-r--r--libjava/java/awt/peer/WindowPeer.java15
40 files changed, 1321 insertions, 0 deletions
diff --git a/libjava/java/awt/AWTEvent.java b/libjava/java/awt/AWTEvent.java
new file mode 100644
index 00000000000..45859cf8674
--- /dev/null
+++ b/libjava/java/awt/AWTEvent.java
@@ -0,0 +1,25 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/* A very incomplete placeholder. */
+
+public abstract class AWTEvent extends java.util.EventObject
+{
+ protected boolean consumed;
+ protected int id;
+
+ public int getID() { return id; }
+
+ public AWTEvent (Object source, int id)
+ {
+ super(source);
+ this.id = id;
+ }
+}
diff --git a/libjava/java/awt/BorderLayout.java b/libjava/java/awt/BorderLayout.java
new file mode 100644
index 00000000000..8549a5b61f1
--- /dev/null
+++ b/libjava/java/awt/BorderLayout.java
@@ -0,0 +1,46 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/* A very incomplete placeholder. */
+
+public class BorderLayout implements LayoutManager2
+{
+ int hgap;
+ int vgap;
+
+ public BorderLayout (int hgap, int vgap)
+ {
+ this.hgap = hgap;
+ this.vgap = vgap;
+ }
+
+ public void addLayoutComponent (String name, Component comp)
+ { /* FIXME */ }
+ public void layoutContainer (Container parent)
+ { /* FIXME */ }
+ public Dimension minimumLayoutSize (Container parent)
+ { /* FIXME */ return null; }
+ public Dimension preferredLayoutSize (Container parent)
+ { /* FIXME */ return null; }
+ public void removeLayoutComponent (Component comp)
+ { /* FIXME */ }
+
+ public void addLayoutComponent (Component comp, Object constraints)
+ { /* FIXME */ }
+ public float getLayoutAlignmentX (Container target)
+ { /* FIXME */ return (float) 0.0; }
+ public float getLayoutAlignmentY (Container target)
+ { /* FIXME */ return (float) 0.0; }
+ public void invalidateLayout (Container target)
+ { /* FIXME */ }
+ public Dimension maximumLayoutSize (Container target)
+ { /* FIXME */ return null; }
+
+}
diff --git a/libjava/java/awt/Component.java b/libjava/java/awt/Component.java
new file mode 100644
index 00000000000..c79d3b70604
--- /dev/null
+++ b/libjava/java/awt/Component.java
@@ -0,0 +1,98 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+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.peer.ComponentPeer;
+
+/* A very incomplete placeholder. */
+
+public abstract class Component implements MenuContainer
+{
+ Container parent;
+ java.awt.peer.ComponentPeer peer;
+ int x, y, width, height;
+
+ public Container getParent () { return parent; }
+
+ /** @deprecated */
+ public java.awt.peer.ComponentPeer getPeer () { return peer; }
+
+ public void setVisible (boolean b)
+ { /* FIXME */ }
+
+ public void setSize (Dimension d)
+ { setSize(d.width, d.height); }
+
+ public void setSize (int width, int height)
+ {
+ this.width = width; this.height = height;
+ if (peer != null)
+ peer.setBounds(x, y, width, height);
+ }
+
+ public void setLocation (int x, int y)
+ {
+ this.x = x; this.y = y;
+ if (peer != null)
+ peer.setBounds(x, y, width, height);
+ }
+
+ public void setLocation (Point pt)
+ { setLocation(pt.x, pt.y); }
+
+ public void setBounds (int x, int y, int w, int h)
+ {
+ this.x = x; this.y = y;
+ this.width = w; this.height = h;
+ if (peer != null)
+ peer.setBounds(x, y, w, h);
+ }
+
+ public void setBounds (Rectangle rect)
+ { setBounds(rect.x, rect.y, rect.width, rect.height); }
+
+ public Rectangle getBounds ()
+ {
+ return new Rectangle(x, y, width, height);
+ }
+
+ public Point getLocation ()
+ {
+ return new Point(x, y);
+ }
+
+ public Dimension getSize ()
+ {
+ return new Dimension(width, height);
+ }
+
+ public Dimension getMinimumSize ()
+ {
+ if (peer == null)
+ return new Dimension(width, height);
+ else
+ return peer.getMinimumSize();
+ }
+
+ public Dimension getPreferredSize ()
+ {
+ if (peer == null)
+ return new Dimension(width, height);
+ else
+ return peer.getPreferredSize();
+ }
+
+ public synchronized void addKeyListener (KeyListener listener)
+ { /* FIXME */ }
+
+ public boolean isFocusTraversable ()
+ { /* FIXME */ return false; }
+
+ public void addNotify () { }
+}
diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java
new file mode 100644
index 00000000000..dc3d1938570
--- /dev/null
+++ b/libjava/java/awt/Container.java
@@ -0,0 +1,59 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/* A very incomplete placeholder. */
+
+public abstract class Container extends Component
+{
+ int componentCount;
+ Component[] components;
+
+ public Component[] getComponents()
+ {
+ Component[] result = new Component[componentCount];
+ if (componentCount > 0)
+ System.arraycopy(components, 0, result, 0, componentCount);
+ return result;
+ }
+
+ public Component getComponent (int n)
+ {
+ if (n < 0 || n >= componentCount)
+ throw new ArrayIndexOutOfBoundsException("no such component");
+ return components[n];
+ }
+
+ public boolean isAncestorOf (Component comp)
+ {
+ for (;;)
+ {
+ if (comp == null)
+ return false;
+ if (comp == this)
+ return true;
+ comp = comp.getParent();
+ }
+ }
+
+ public Component add (String name, Component comp)
+ {
+ /* FIXME */
+ return comp;
+ }
+
+ public void addNotify ()
+ {
+ for (int i = componentCount; --i >= 0; )
+ components[i].addNotify();
+ }
+
+ public void setLayout (LayoutManager layout)
+ { /* FIXME */ }
+}
diff --git a/libjava/java/awt/Dimension.java b/libjava/java/awt/Dimension.java
new file mode 100644
index 00000000000..8593f0e1355
--- /dev/null
+++ b/libjava/java/awt/Dimension.java
@@ -0,0 +1,78 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/**
+ * @author Per Bothner <bothner@cygnus.com>
+ * @date Fenruary 8, 1999.
+ */
+
+/* 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, except that neither toString
+ * has not been compared with JDK output.
+ */
+
+public class Dimension extends java.awt.geom.Dimension2D
+{
+ public int height;
+ public int width;
+
+ public Dimension () { }
+
+ public Dimension (Dimension dim)
+ {
+ this.width = dim.width;
+ this.height = dim.height;
+ }
+
+ public Dimension (int width, int height)
+ {
+ this.width = width;
+ this.height = height;
+ }
+
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof Dimension))
+ return false;
+ Dimension dim = (Dimension) obj;
+ return height == dim.height && width == dim.width;
+ }
+
+ public Dimension getSize () { return new Dimension(this); }
+
+ public void setSize (Dimension dim)
+ {
+ this.width = dim.width;
+ this.height = dim.height;
+ }
+
+ public void setSize (int width, int height)
+ {
+ this.width = width;
+ this.height = height;
+ }
+
+ public String toString ()
+ {
+ return "Dimension[w:"+width+",h:"+height+']';
+ }
+
+ /* Note: There is no Dimension.hashCode. */
+
+ public double getWidth() { return width; }
+ public double getHeight() { return height; }
+
+ public void setSize (double width, double height)
+ {
+ this.width = (int) width;
+ this.height = (int) height;
+ }
+}
diff --git a/libjava/java/awt/Event.java b/libjava/java/awt/Event.java
new file mode 100644
index 00000000000..a5991f25e3a
--- /dev/null
+++ b/libjava/java/awt/Event.java
@@ -0,0 +1,26 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/* A very incomplete placeholder. */
+
+public class Event
+{
+ public Event evt;
+ public Object arg;
+ public int id;
+ public Object target;
+
+ public Event (Object target, int id, Object arg)
+ {
+ this.id = id;
+ this.target = target;
+ this.arg = arg;
+ }
+}
diff --git a/libjava/java/awt/Font.java b/libjava/java/awt/Font.java
new file mode 100644
index 00000000000..43b3c160e62
--- /dev/null
+++ b/libjava/java/awt/Font.java
@@ -0,0 +1,15 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/* A *very* incomplete placeholder. */
+
+public class Font
+{
+}
diff --git a/libjava/java/awt/Frame.java b/libjava/java/awt/Frame.java
new file mode 100644
index 00000000000..8d258f73261
--- /dev/null
+++ b/libjava/java/awt/Frame.java
@@ -0,0 +1,55 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+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.FramePeer;
+
+/* A very incomplete placeholder. */
+
+public class Frame extends Window implements MenuContainer
+{
+ MenuBar menuBar = null;
+ String title;
+
+ public Frame ()
+ { /* FIXME */ }
+
+ public Frame (String title)
+ {
+ this();
+ setTitle(title);
+ }
+
+ public String getTitle () { return title; }
+
+ public void setTitle (String title)
+ {
+ this.title = title;
+ if (peer != null)
+ ((FramePeer)peer).setTitle(title);
+ }
+
+ public synchronized void dispose ()
+ { /* FIXME */ }
+
+ public synchronized void setMenuBar (MenuBar menuBar)
+ { this.menuBar = menuBar; }
+
+ public synchronized void addNotify ()
+ {
+ if (peer == null)
+ {
+ FramePeer fpeer = Toolkit.getDefaultToolkit().createFrame(this);
+ // Compiler bug requires cast ??; FIXME?
+ peer = (java.awt.peer.ComponentPeer) fpeer;
+ if (width + height > 0)
+ peer.setBounds(x, y, width, height);
+ }
+ super.addNotify();
+ }
+}
diff --git a/libjava/java/awt/LayoutManager.java b/libjava/java/awt/LayoutManager.java
new file mode 100644
index 00000000000..1cd47b131ba
--- /dev/null
+++ b/libjava/java/awt/LayoutManager.java
@@ -0,0 +1,20 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/* Status: Believed complete and correct. */
+
+public interface LayoutManager
+{
+ public void addLayoutComponent (String name, Component comp);
+ public void layoutContainer (Container parent);
+ public Dimension minimumLayoutSize (Container parent);
+ public Dimension preferredLayoutSize (Container parent);
+ public void removeLayoutComponent (Component comp);
+}
diff --git a/libjava/java/awt/LayoutManager2.java b/libjava/java/awt/LayoutManager2.java
new file mode 100644
index 00000000000..6c0286c007e
--- /dev/null
+++ b/libjava/java/awt/LayoutManager2.java
@@ -0,0 +1,20 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/* Status: Believed complete and correct. */
+
+public interface LayoutManager2 extends LayoutManager
+{
+ public void addLayoutComponent (Component comp, Object constraints);
+ public float getLayoutAlignmentX (Container target);
+ public float getLayoutAlignmentY (Container target);
+ public void invalidateLayout (Container target);
+ public Dimension maximumLayoutSize (Container target);
+}
diff --git a/libjava/java/awt/Menu.java b/libjava/java/awt/Menu.java
new file mode 100644
index 00000000000..ad602e77e9f
--- /dev/null
+++ b/libjava/java/awt/Menu.java
@@ -0,0 +1,33 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/* A very incomplete placeholder. */
+
+public class Menu extends MenuItem implements MenuContainer
+{
+ public Menu (String label)
+ {
+ super(label); // ???
+ throw new Error ("java.awt.Menu: not implemented");
+ }
+
+ public void add (String label)
+ { /* FIXME */ }
+
+ public synchronized MenuItem add (MenuItem item)
+ {
+ /* FIXME */
+ return item;
+ }
+
+ public Font getFont() { return null; } // FIXME
+ //public boolean postEvent(Event evt);
+ public void remove(MenuComponent comp) { } // FIXME
+}
diff --git a/libjava/java/awt/MenuBar.java b/libjava/java/awt/MenuBar.java
new file mode 100644
index 00000000000..4b93e8ab504
--- /dev/null
+++ b/libjava/java/awt/MenuBar.java
@@ -0,0 +1,44 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/* A very incomplete placeholder. */
+
+public class MenuBar extends MenuComponent implements MenuContainer
+{
+ Menu[] menus;
+ int count;
+
+ public synchronized Menu add (Menu m)
+ {
+ if (menus == null)
+ menus = new Menu[1];
+ else if (count == menus.length)
+ {
+ Menu[] newMenus = new Menu[2 * count];
+ System.arraycopy(menus, 0, newMenus, 0, count);
+ }
+ menus[count++] = m;
+ return m;
+ }
+
+ public void remove (MenuComponent comp)
+ {
+ for (int i = count; --i >= 0; )
+ {
+ if (menus[i] == comp)
+ {
+ System.arraycopy(menus, i, menus, i+1, count-i-1);
+ count--;
+ // FIXME: destroy peer
+ return;
+ }
+ }
+ }
+}
diff --git a/libjava/java/awt/MenuComponent.java b/libjava/java/awt/MenuComponent.java
new file mode 100644
index 00000000000..3bd92a4b222
--- /dev/null
+++ b/libjava/java/awt/MenuComponent.java
@@ -0,0 +1,15 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/* A very incomplete placeholder. */
+
+public abstract class MenuComponent
+{
+}
diff --git a/libjava/java/awt/MenuContainer.java b/libjava/java/awt/MenuContainer.java
new file mode 100644
index 00000000000..2d8ff9275fb
--- /dev/null
+++ b/libjava/java/awt/MenuContainer.java
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+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.
+ */
+
+public interface MenuContainer
+{
+ public Font getFont();
+
+ /**
+ * @deprected
+ */
+ public boolean postEvent(Event evt);
+
+ public void remove(MenuComponent comp);
+}
+
diff --git a/libjava/java/awt/MenuItem.java b/libjava/java/awt/MenuItem.java
new file mode 100644
index 00000000000..1becbccb8ff
--- /dev/null
+++ b/libjava/java/awt/MenuItem.java
@@ -0,0 +1,25 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+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.*;
+
+/* A very incomplete placeholder. */
+
+public class MenuItem extends MenuComponent
+{
+ public MenuItem (String label)
+ {
+ throw new Error("java.awt.MenuItem: not implemented");
+ }
+
+ public synchronized void addActionListener (ActionListener listener)
+ {
+ /* FIXME */
+ }
+}
diff --git a/libjava/java/awt/Point.java b/libjava/java/awt/Point.java
new file mode 100644
index 00000000000..bdeb39d513b
--- /dev/null
+++ b/libjava/java/awt/Point.java
@@ -0,0 +1,65 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+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.geom.Point2D;
+
+/**
+ * @author Per Bothner <bothner@cygnus.com>
+ * @date February 8, 1999.
+ */
+
+/* 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, except that neither toString
+ * nor hashCode have been compared with JDK output.
+ */
+
+public class Point extends Point2D implements java.io.Serializable
+{
+ public int x;
+ public int y;
+
+ public Point () { }
+
+ public Point (Point p) { this.x = p.x; this.y = p.y; }
+
+ public Point (int x, int y) { this.x = x; this.y = y; }
+
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof Point))
+ return false;
+ Point p = (Point) obj;
+ return this.x == p.x && this.y == p.y;
+ }
+
+ public int hashCode () { return x ^ y; }
+
+ public Point getLocation () { return new Point(this); }
+
+ public void move (int x, int y) { this.x = x; this.y = y; }
+
+ public void setLocation (int x, int y) { this.x = x; this.y = y; }
+
+ public void setLocation (Point pt) { this.x = pt.x; this.y = pt.y; }
+
+ public void translate (int x, int y) { this.x += x; this.y += y; }
+
+ public String toString ()
+ {
+ return "Point[x:"+x+",y:"+y+']';
+ }
+
+ public double getX() { return x; }
+ public double getY() { return y; }
+
+ public void setLocation (double x, double y)
+ { this.x = (int) x; this.y = (int) y; }
+
+}
diff --git a/libjava/java/awt/Rectangle.java b/libjava/java/awt/Rectangle.java
new file mode 100644
index 00000000000..975a41572e1
--- /dev/null
+++ b/libjava/java/awt/Rectangle.java
@@ -0,0 +1,35 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/* Status: Quite imcomplete. */
+
+public class Rectangle implements Shape
+{
+ public int x;
+ public int y;
+ public int width;
+ public int height;
+
+ public Rectangle () { }
+
+ public Rectangle (int width, int height)
+ { this.width = width; this.height = height; }
+
+ public Rectangle (int x, int y, int width, int height)
+ {
+ this.x = x; this.y = y;
+ this.width = width; this.height = height;
+ }
+
+ public Rectangle getBounds ()
+ {
+ return new Rectangle (x, y, width, height);
+ }
+}
diff --git a/libjava/java/awt/Shape.java b/libjava/java/awt/Shape.java
new file mode 100644
index 00000000000..c54ad15ee73
--- /dev/null
+++ b/libjava/java/awt/Shape.java
@@ -0,0 +1,23 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/**
+ * @author Per Bothner <bothner@cygnus.com>
+ * @date Fenruary 8, 1999.
+ */
+
+/* Written using "Java Class Libraries", 2nd edition.
+ * Status: Believed complete and correct.
+ */
+
+public interface Shape
+{
+ public Rectangle getBounds ();
+}
diff --git a/libjava/java/awt/TextArea.java b/libjava/java/awt/TextArea.java
new file mode 100644
index 00000000000..7ee3f9110c5
--- /dev/null
+++ b/libjava/java/awt/TextArea.java
@@ -0,0 +1,49 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt;
+
+/* A very incomplete placeholder. */
+
+public class TextArea extends TextComponent
+{
+ public synchronized void append (String str)
+ {
+ replaceRange(str, length, length);
+ }
+
+ public synchronized void insert (String str, int pos)
+ {
+ replaceRange(str, pos, pos);
+ }
+
+ public synchronized void replaceRange (String str, int start, int end)
+ {
+ if (length == 0)
+ setText (str);
+ else
+ {
+ int len = str.length();
+ int delta = len - (end - start);
+ int new_length = length + delta;
+ if (buffer.length < new_length)
+ {
+ int new_size = 2 * buffer.length;
+ if (new_size < new_length)
+ new_size = new_length;
+ char[] new_buffer = new char[new_size];
+ System.arraycopy(buffer, 0, new_buffer, 0, length);
+ buffer = new_buffer;
+ }
+ if (len != end)
+ System.arraycopy(buffer, start, buffer, start + len, len - end);
+ str.getChars(0, len, buffer, start);
+ length += delta;
+ }
+ }
+}
diff --git a/libjava/java/awt/TextComponent.java b/libjava/java/awt/TextComponent.java
new file mode 100644
index 00000000000..bbdd51830e6
--- /dev/null
+++ b/libjava/java/awt/TextComponent.java
@@ -0,0 +1,38 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+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.*;
+
+/* A very incomplete placeholder. */
+
+public class TextComponent extends Component
+{
+ char[] buffer;
+ int length;
+ int caretPosition;
+
+ public synchronized String getText ()
+ { return new String(buffer, 0, length); }
+
+ public synchronized void setText (String text)
+ {
+ length = text.length();
+ if (buffer == null || buffer.length < length)
+ buffer = new char[length];
+ text.getChars(0, length, buffer, 0);
+ }
+
+ public synchronized void addTextListener (TextListener listener)
+ { /* FIXME */ }
+
+ public int getCaretPosition () { return caretPosition; }
+
+ public void setCaretPosition (int pos) { caretPosition = pos; }
+
+}
diff --git a/libjava/java/awt/Toolkit.java b/libjava/java/awt/Toolkit.java
new file mode 100644
index 00000000000..b6a27dd42f3
--- /dev/null
+++ b/libjava/java/awt/Toolkit.java
@@ -0,0 +1,29 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+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.*;
+
+/* A very incomplete placeholder. */
+
+public abstract class Toolkit
+{
+ static Toolkit defaultToolkit;
+
+ public static synchronized Toolkit getDefaultToolkit()
+ {
+ if (defaultToolkit == null)
+ init();
+ return defaultToolkit;
+ }
+
+ protected abstract FramePeer createFrame(Frame target);
+
+ private static native void init();
+ // static { init(); }
+}
diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java
new file mode 100644
index 00000000000..a7a4b4b713f
--- /dev/null
+++ b/libjava/java/awt/Window.java
@@ -0,0 +1,29 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+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.WindowListener;
+
+/* A very incomplete placeholder. */
+
+public class Window extends Container
+{
+ public void dispose ()
+ { /* FIXME */ }
+
+ public synchronized void addWindowListener (WindowListener listener)
+ { /* FIXME */ }
+
+
+ public void show ()
+ {
+ addNotify();
+ // validate FIXME
+ // validate setVisible FIXME
+ }
+}
diff --git a/libjava/java/awt/event/ActionEvent.java b/libjava/java/awt/event/ActionEvent.java
new file mode 100644
index 00000000000..3ea105b93b4
--- /dev/null
+++ b/libjava/java/awt/event/ActionEvent.java
@@ -0,0 +1,35 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.event;
+import java.awt.*;
+
+/* A very incomplete placeholder. */
+
+public class ActionEvent extends AWTEvent
+{
+ String actionCommand;
+ int modifiers;
+
+ public ActionEvent (Object source, int id, String command)
+ {
+ super(source, id);
+ actionCommand = command;
+ }
+
+ public ActionEvent (Object source, int id, String command, int modifiers)
+ {
+ super(source, id);
+ actionCommand = command;
+ this.modifiers = modifiers;
+ }
+
+ public String getActionCommand () { return actionCommand; }
+
+ public int getModifiers () { return modifiers; }
+}
diff --git a/libjava/java/awt/event/ActionListener.java b/libjava/java/awt/event/ActionListener.java
new file mode 100644
index 00000000000..5a3700a0ace
--- /dev/null
+++ b/libjava/java/awt/event/ActionListener.java
@@ -0,0 +1,21 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.event;
+
+/**
+ * @author Per Bothner <bothner@cygnus.com>
+ * @date Fenruary, 1999.
+ */
+
+/* Status: Believed complete and correct. */
+
+public interface ActionListener extends java.util.EventListener
+{
+ public void actionPerformed (ActionEvent e);
+}
diff --git a/libjava/java/awt/event/ComponentEvent.java b/libjava/java/awt/event/ComponentEvent.java
new file mode 100644
index 00000000000..c44ddf6ad9c
--- /dev/null
+++ b/libjava/java/awt/event/ComponentEvent.java
@@ -0,0 +1,20 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.event;
+import java.awt.*;
+
+/* A very incomplete placeholder. */
+
+public class ComponentEvent extends AWTEvent
+{
+ public ComponentEvent (Object source, int id)
+ {
+ super(source, id);
+ }
+}
diff --git a/libjava/java/awt/event/InputEvent.java b/libjava/java/awt/event/InputEvent.java
new file mode 100644
index 00000000000..bc98e7edd0d
--- /dev/null
+++ b/libjava/java/awt/event/InputEvent.java
@@ -0,0 +1,22 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.event;
+
+/* A very incomplete placeholder. */
+
+public class InputEvent extends ComponentEvent
+{
+ InputEvent (Object source, int id) // Not public
+ {
+ super(source, id);
+ }
+
+ public void consume ()
+ { /* FIXME */ }
+}
diff --git a/libjava/java/awt/event/KeyEvent.java b/libjava/java/awt/event/KeyEvent.java
new file mode 100644
index 00000000000..1fcb9747e41
--- /dev/null
+++ b/libjava/java/awt/event/KeyEvent.java
@@ -0,0 +1,38 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.event;
+import java.awt.*;
+
+/* A very incomplete placeholder. */
+
+public class KeyEvent extends InputEvent
+{
+ int keyCode;
+ char keyChar;
+ int modifiers;
+
+ public KeyEvent (Component source, int id, long when,
+ int modifiers, int keyCode, char keyChar)
+ {
+ super(source, id);
+ this.keyCode = keyCode;
+ this.keyChar = keyChar;
+ this.modifiers = modifiers;
+ }
+
+ public int getKeyCode () { return keyCode; }
+
+ public char getKeyChar () { return keyChar; }
+
+ public void setKeyCode (int keyCode) { this.keyCode = keyCode; }
+
+ public void setKeyChar (char keyChar) { this.keyChar = keyChar; }
+
+ public void setModifiers (int modifiers) { this.modifiers = modifiers; }
+}
diff --git a/libjava/java/awt/event/KeyListener.java b/libjava/java/awt/event/KeyListener.java
new file mode 100644
index 00000000000..126cc459136
--- /dev/null
+++ b/libjava/java/awt/event/KeyListener.java
@@ -0,0 +1,23 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.event;
+
+/**
+ * @author Per Bothner <bothner@cygnus.com>
+ * @date Fenruary, 1999.
+ */
+
+/* Status: Believed complete and correct. */
+
+public interface KeyListener extends java.util.EventListener
+{
+ public void keyPressed (KeyEvent w);
+ public void keyReleased (KeyEvent w);
+ public void keyTyped (KeyEvent w);
+}
diff --git a/libjava/java/awt/event/TextEvent.java b/libjava/java/awt/event/TextEvent.java
new file mode 100644
index 00000000000..b3725f920eb
--- /dev/null
+++ b/libjava/java/awt/event/TextEvent.java
@@ -0,0 +1,20 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.event;
+import java.awt.*;
+
+/* A very incomplete placeholder. */
+
+public class TextEvent extends AWTEvent
+{
+ public TextEvent (Object source, int id)
+ {
+ super(source, id);
+ }
+}
diff --git a/libjava/java/awt/event/TextListener.java b/libjava/java/awt/event/TextListener.java
new file mode 100644
index 00000000000..b4863fff8d9
--- /dev/null
+++ b/libjava/java/awt/event/TextListener.java
@@ -0,0 +1,22 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.event;
+
+/**
+ * @author Per Bothner <bothner@cygnus.com>
+ * @date Fenruary, 1999.
+ */
+
+/* Status: Believed complete and correct. */
+
+public interface TextListener extends java.util.EventListener
+{
+ public void textValueChanged (TextEvent w);
+}
+
diff --git a/libjava/java/awt/event/WindowAdapter.java b/libjava/java/awt/event/WindowAdapter.java
new file mode 100644
index 00000000000..f2675a3cca1
--- /dev/null
+++ b/libjava/java/awt/event/WindowAdapter.java
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.event;
+
+/**
+ * @author Per Bothner <bothner@cygnus.com>
+ * @date Fenruary, 1999.
+ */
+
+/* Status: Believed complete and correct. */
+
+public class WindowAdapter implements WindowListener
+{
+ public void windowActivated (WindowEvent w) { }
+ public void windowClosed (WindowEvent w) { }
+ public void windowClosing (WindowEvent w) { }
+ public void windowDeactivated (WindowEvent w) { }
+ public void windowDeiconified (WindowEvent w) { }
+ public void windowIconified (WindowEvent w) { }
+ public void windowOpened (WindowEvent w) { }
+}
diff --git a/libjava/java/awt/event/WindowEvent.java b/libjava/java/awt/event/WindowEvent.java
new file mode 100644
index 00000000000..4b347dd6bc2
--- /dev/null
+++ b/libjava/java/awt/event/WindowEvent.java
@@ -0,0 +1,19 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.event;
+
+/* A very incomplete placeholder. */
+
+public class WindowEvent extends ComponentEvent
+{
+ public WindowEvent (Object source, int id)
+ {
+ super(source, id);
+ }
+}
diff --git a/libjava/java/awt/event/WindowListener.java b/libjava/java/awt/event/WindowListener.java
new file mode 100644
index 00000000000..ff8ae943363
--- /dev/null
+++ b/libjava/java/awt/event/WindowListener.java
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.event;
+
+/**
+ * @author Per Bothner <bothner@cygnus.com>
+ * @date Fenruary, 1999.
+ */
+
+/* Status: Believed complete and correct. */
+
+public interface WindowListener extends java.util.EventListener
+{
+ public void windowActivated (WindowEvent w);
+ public void windowClosed (WindowEvent w);
+ public void windowClosing (WindowEvent w);
+ public void windowDeactivated (WindowEvent w);
+ public void windowDeiconified (WindowEvent w);
+ public void windowIconified (WindowEvent w);
+ public void windowOpened (WindowEvent w);
+}
diff --git a/libjava/java/awt/geom/Dimension2D.java b/libjava/java/awt/geom/Dimension2D.java
new file mode 100644
index 00000000000..7bdcf37c376
--- /dev/null
+++ b/libjava/java/awt/geom/Dimension2D.java
@@ -0,0 +1,36 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.geom;
+
+/**
+ * @author Per Bothner <bothner@cygnus.com>
+ * @date Fenruary, 1999.
+ */
+
+/* Written using online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status: Believed complete and correct.
+ */
+
+public abstract class Dimension2D implements Cloneable
+{
+ public abstract double getWidth();
+ public abstract double getHeight();
+
+ public abstract void setSize (double width, double height);
+
+ public void setSize (Dimension2D dim)
+ {
+ setSize(dim.getWidth(), dim.getHeight());
+ }
+
+ public Object clone ()
+ {
+ return super.clone();
+ }
+}
diff --git a/libjava/java/awt/geom/Point2D.java b/libjava/java/awt/geom/Point2D.java
new file mode 100644
index 00000000000..3d9e0a4a9da
--- /dev/null
+++ b/libjava/java/awt/geom/Point2D.java
@@ -0,0 +1,69 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.geom;
+
+/**
+ * @author Per Bothner <bothner@cygnus.com>
+ * @date Fenruary 8, 1999.
+ */
+
+/* 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, except that neither toString
+ * nor hashCode have been compared with JDK output.
+ */
+
+public abstract class Point2D implements Cloneable
+{
+ public abstract double getX();
+ public abstract double getY();
+
+ public abstract void setLocation (double x, double y);
+
+ public void setLocation (Point2D pt) { setLocation(pt.getX(), pt.getY()); }
+
+ static public double distanceSq (double X1, double Y1, double X2, double Y2)
+ {
+ X2 -= X1;
+ Y2 -= Y1;
+ return X2*X2 + Y2*Y2;
+ }
+
+ static public double distance (double X1, double Y1, double X2, double Y2)
+ {
+ return Math.sqrt(distance(X1, Y1, X2, Y2));
+ }
+
+ public double distanceSq (double PX, double PY)
+ {
+ return distanceSq (getX(), PX, getY(), PY);
+ }
+
+ public double distance (double PX, double PY)
+ {
+ return distance (getX(), PX, getY(), PY);
+ }
+
+ public double distanceSq (Point2D pt)
+ {
+ return distanceSq (getX(), pt.getX(), getY(), pt.getY());
+ }
+
+ public double distance (Point2D pt)
+ {
+ return distance (getX(), pt.getX(), getY(), pt.getY());
+ }
+
+ public int hashCode() { return (int) getX() ^ (int) getY(); }
+
+ public Object clone()
+ {
+ return super.clone();
+ }
+}
diff --git a/libjava/java/awt/natToolkit.cc b/libjava/java/awt/natToolkit.cc
new file mode 100644
index 00000000000..8a9c0acca24
--- /dev/null
+++ b/libjava/java/awt/natToolkit.cc
@@ -0,0 +1,19 @@
+#include <config.h>
+
+/*#define ENABLE_GTK*/
+
+#include <cni.h>
+#include <java/awt/Toolkit.h>
+#ifdef ENABLE_GTK
+#include <java/awt/peer/GtkToolkit.h>
+#endif
+
+void
+java::awt::Toolkit::init()
+{
+#ifdef ENABLE_GTK
+ defaultToolkit = new java::awt::peer::GtkToolkit();
+#else
+ JvFail("no awt (graphics) toolkit available");
+#endif
+}
diff --git a/libjava/java/awt/peer/ComponentPeer.java b/libjava/java/awt/peer/ComponentPeer.java
new file mode 100644
index 00000000000..edf47a622a0
--- /dev/null
+++ b/libjava/java/awt/peer/ComponentPeer.java
@@ -0,0 +1,23 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.peer;
+import java.awt.*;
+
+/* A very incomplete placeholder. */
+
+public interface ComponentPeer
+{
+ public abstract Toolkit getToolkit ();
+
+ public Dimension getMinimumSize ();
+
+ public Dimension getPreferredSize ();
+
+ public void setBounds (int x, int y, int w, int h);
+}
diff --git a/libjava/java/awt/peer/ContainerPeer.java b/libjava/java/awt/peer/ContainerPeer.java
new file mode 100644
index 00000000000..6c5ad1cdd62
--- /dev/null
+++ b/libjava/java/awt/peer/ContainerPeer.java
@@ -0,0 +1,15 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.peer;
+
+/* A very incomplete placeholder. */
+
+public interface ContainerPeer extends ComponentPeer
+{
+}
diff --git a/libjava/java/awt/peer/FramePeer.java b/libjava/java/awt/peer/FramePeer.java
new file mode 100644
index 00000000000..6db70193ab6
--- /dev/null
+++ b/libjava/java/awt/peer/FramePeer.java
@@ -0,0 +1,16 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.peer;
+
+/* A very incomplete placeholder. */
+
+public interface FramePeer extends WindowPeer
+{
+ void setTitle(String title);
+}
diff --git a/libjava/java/awt/peer/WindowPeer.java b/libjava/java/awt/peer/WindowPeer.java
new file mode 100644
index 00000000000..9d76f56016c
--- /dev/null
+++ b/libjava/java/awt/peer/WindowPeer.java
@@ -0,0 +1,15 @@
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libjava.
+
+This software is copyrighted work licensed under the terms of the
+Libjava License. Please consult the file "LIBJAVA_LICENSE" for
+details. */
+
+package java.awt.peer;
+
+/* A very incomplete placeholder. */
+
+public interface WindowPeer extends ContainerPeer
+{
+}