Add AWT stubs and incomplete classes.

From-SVN: r26778
This commit is contained in:
Per Bothner 1999-05-05 04:05:57 -07:00
parent dfac8a1333
commit fd164b17ac
40 changed files with 1321 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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; }
}

View File

@ -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 () { }
}

View File

@ -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 */ }
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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
{
}

View File

@ -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();
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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
}

View File

@ -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;
}
}
}
}

View File

@ -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
{
}

View File

@ -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);
}

View File

@ -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 */
}
}

View File

@ -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; }
}

View File

@ -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);
}
}

View File

@ -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 ();
}

View File

@ -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;
}
}
}

View File

@ -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; }
}

View File

@ -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(); }
}

View File

@ -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
}
}

View File

@ -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; }
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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 */ }
}

View File

@ -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; }
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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) { }
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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
}

View File

@ -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);
}

View File

@ -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
{
}

View File

@ -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);
}

View File

@ -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
{
}