Commit c7a136d3 by Bryce McKinlay Committed by Bryce McKinlay

Big AWT patch.

From-SVN: r34976
parent 406a65d0
2000-07-12 Bryce McKinlay <bryce@albatross.co.nz>
AWT Stuff:
* java/util/ResourceBundle.java (getLocale): stub.
* Makefile.am: Added new AWT classes.
* Makefile.in: Rebuilt.
* java/awt/AWTEvent.java: Add EVENT_MASK constants, isConsumed,
constructors. Fix toString() and paramString().
* java/awt/AWTEventMulticaster.java: New class. Implemented.
* java/awt/CheckboxGroup.java: New class.
* java/awt/ColorModel.java: New class.
* java/awt/Component.java: Added stubs for most methods. Implemented
event dispatch.
* java/awt/Container.java: ditto.
* java/awt/ComponentOrientation.java: New class. Partly implemented.
* java/awt/Cursor.java: ditto.
* java/awt/Event.java: Fix paramString().
* java/awt/EventQueue.java: New class. Implemented.
* java/awt/Font.java: Added additional stub methods. Implemented
toString().
* java/awt/FontMetrics.java: New class. Stubbed.
* java/awt/GraphicsConfiguration.java: New class. Complete, except for
Java2D parts.
* java/awt/Insets.java: New class. Implemented.
* java/awt/Menu.java: Add new methods. Partially implemented.
* java/awt/MenuItem.java: Add new methods and fields. Partially
implemented.
* java/awt/MenuShortcut.java: New class. Implemented.
* java/awt/Panel.java: New class. Placeholder.
* java/awt/PopupMenu.java: New class. Stubbed.
* java/awt/Rectangle.java: New class. Implemented.
* java/awt/Toolkit.java: Added getSystemEventQueue() stub.
* java/awt/event/ActionEvent.java: Implement paramString().
* java/awt/event/AdjustmentEvent.java: Implement paramString().
* java/awt/event/ComponentEvent.java: Implement paramString().
* java/awt/event/ContainerEvent.java: Implement paramString().
* java/awt/event/FocusEvent.java: Implement paramString().
* java/awt/event/HierarchyBoundsAdapter.java: New class.
* java/awt/event/HierarchyBoundsListener.java: New class.
* java/awt/event/HierarchyEvent.java: New class.
* java/awt/event/HierarchyListener.java: New class.
* java/awt/event/InputMethodEvent.java: Implement paramString().
* java/awt/event/InvocationEvent.java: Implement paramString(). Throw
exception if !catchExceptions.
* java/awt/event/ItemEvent.java: Implement paramString().
* java/awt/event/KeyEvent.java: Implement paramString().
* java/awt/event/MouseEvent.java: Implement paramString().
* java/awt/event/PaintEvent.java: Implement paramString().
* java/awt/event/TextEvent.java: Implement paramString().
* java/awt/event/WindowEvent.java: Implement paramString().
AWT Peer interfaces:
* java/awt/peer/ButtonPeer.java: New file.
* java/awt/peer/ListPeer.java: New file.
* java/awt/peer/CanvasPeer.java: New file.
* java/awt/peer/MenuBarPeer.java: New file.
* java/awt/peer/CheckboxMenuItemPeer.java: New file.
* java/awt/peer/MenuComponentPeer.java: New file.
* java/awt/peer/CheckboxPeer.java: New file.
* java/awt/peer/MenuItemPeer.java: New file.
* java/awt/peer/ChoicePeer.java: New file.
* java/awt/peer/MenuPeer.java: New file.
* java/awt/peer/ComponentPeer.java: Implemented.
* java/awt/peer/PanelPeer.java: New file.
* java/awt/peer/ContainerPeer.java: Implemented.
* java/awt/peer/PopupMenuPeer.java: New file.
* java/awt/peer/DialogPeer.java: New file.
* java/awt/peer/ScrollPanePeer.java: New file.
* java/awt/peer/FileDialogPeer.java: New file.
* java/awt/peer/ScrollbarPeer.java: New file.
* java/awt/peer/FontPeer.java: New file.
* java/awt/peer/TextAreaPeer.java: New file.
* java/awt/peer/FramePeer.java: Implemented.
* java/awt/peer/TextComponentPeer.java: New file.
* java/awt/peer/LabelPeer.java: New file.
* java/awt/peer/TextFieldPeer.java: New file.
* java/awt/peer/LightweightPeer.java: New file.
* java/awt/peer/WindowPeer.java: Implemented.
2000-07-06 Tom Tromey <tromey@cygnus.com> 2000-07-06 Tom Tromey <tromey@cygnus.com>
* java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): * java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass):
...@@ -32,7 +111,7 @@ ...@@ -32,7 +111,7 @@
2000-06-28 Bryce McKinlay <bryce@albatross.co.nz> 2000-06-28 Bryce McKinlay <bryce@albatross.co.nz>
* ThreadGroup.java: Added synchronized flag to many methods. * java/lang/ThreadGroup.java: Added synchronized flag to many methods.
(destroyed_flag): Removed. (destroyed_flag): Removed.
(isDestroyed, removeGroup, removeThread): Test for parent == null. (isDestroyed, removeGroup, removeThread): Test for parent == null.
(activeCount): Added spec note. (activeCount): Added spec note.
......
...@@ -489,8 +489,12 @@ awt_java_source_files = \ ...@@ -489,8 +489,12 @@ awt_java_source_files = \
java/awt/event/ActionEvent.java \ java/awt/event/ActionEvent.java \
java/awt/event/ActionListener.java \ java/awt/event/ActionListener.java \
java/awt/event/ComponentEvent.java \ java/awt/event/ComponentEvent.java \
java/awt/event/KeyAdapter.java \ java/awt/event/HierarchyBoundsAdapter.java \
java/awt/event/HierarchyBoundsListener.java \
java/awt/event/HierarchyEvent.java \
java/awt/event/HierarchyListener.java \
java/awt/event/InputEvent.java \ java/awt/event/InputEvent.java \
java/awt/event/KeyAdapter.java \
java/awt/event/KeyEvent.java \ java/awt/event/KeyEvent.java \
java/awt/event/KeyListener.java \ java/awt/event/KeyListener.java \
java/awt/event/TextEvent.java \ java/awt/event/TextEvent.java \
...@@ -520,14 +524,25 @@ java/awt/event/ItemEvent.java \ ...@@ -520,14 +524,25 @@ java/awt/event/ItemEvent.java \
java/awt/event/InvocationEvent.java \ java/awt/event/InvocationEvent.java \
java/awt/event/PaintEvent.java \ java/awt/event/PaintEvent.java \
java/awt/event/ContainerEvent.java \ java/awt/event/ContainerEvent.java \
java/awt/AWTError.java \
java/awt/AWTEvent.java \ java/awt/AWTEvent.java \
java/awt/AWTEventMulticaster.java \
java/awt/BorderLayout.java \ java/awt/BorderLayout.java \
java/awt/CheckboxGroup.java \
java/awt/ColorModel.java \
java/awt/Component.java \ java/awt/Component.java \
java/awt/ComponentOrientation.java \
java/awt/Container.java \ java/awt/Container.java \
java/awt/Cursor.java \
java/awt/Dimension.java \ java/awt/Dimension.java \
java/awt/Event.java \ java/awt/Event.java \
java/awt/EventDispatchThread.java \
java/awt/EventQueue.java \
java/awt/Font.java \ java/awt/Font.java \
java/awt/FontMetrics.java \
java/awt/Frame.java \ java/awt/Frame.java \
java/awt/GraphicsConfiguration.java \
java/awt/Insets.java \
java/awt/LayoutManager.java \ java/awt/LayoutManager.java \
java/awt/LayoutManager2.java \ java/awt/LayoutManager2.java \
java/awt/Menu.java \ java/awt/Menu.java \
...@@ -535,18 +550,45 @@ java/awt/MenuBar.java \ ...@@ -535,18 +550,45 @@ java/awt/MenuBar.java \
java/awt/MenuComponent.java \ java/awt/MenuComponent.java \
java/awt/MenuContainer.java \ java/awt/MenuContainer.java \
java/awt/MenuItem.java \ java/awt/MenuItem.java \
java/awt/MenuShortcut.java \
java/awt/Panel.java \
java/awt/Point.java \ java/awt/Point.java \
java/awt/AWTError.java \ java/awt/PopupMenu.java \
java/awt/Shape.java \ java/awt/Shape.java \
java/awt/TextArea.java \ java/awt/TextArea.java \
java/awt/TextComponent.java \ java/awt/TextComponent.java \
java/awt/Toolkit.java \ java/awt/Toolkit.java \
java/awt/Window.java \ java/awt/Window.java \
java/awt/image/ImageConsumer.java \
java/awt/image/ImageObserver.java \
java/awt/image/ImageProducer.java \
java/awt/geom/Dimension2D.java \ java/awt/geom/Dimension2D.java \
java/awt/geom/Point2D.java \ java/awt/geom/Point2D.java \
java/awt/peer/ButtonPeer.java \
java/awt/peer/CanvasPeer.java \
java/awt/peer/CheckboxMenuItemPeer.java \
java/awt/peer/CheckboxPeer.java \
java/awt/peer/ChoicePeer.java \
java/awt/peer/ComponentPeer.java \ java/awt/peer/ComponentPeer.java \
java/awt/peer/ContainerPeer.java \ java/awt/peer/ContainerPeer.java \
java/awt/peer/DialogPeer.java \
java/awt/peer/FileDialogPeer.java \
java/awt/peer/FontPeer.java \
java/awt/peer/FramePeer.java \ java/awt/peer/FramePeer.java \
java/awt/peer/LabelPeer.java \
java/awt/peer/LightweightPeer.java \
java/awt/peer/ListPeer.java \
java/awt/peer/MenuBarPeer.java \
java/awt/peer/MenuComponentPeer.java \
java/awt/peer/MenuItemPeer.java \
java/awt/peer/MenuPeer.java \
java/awt/peer/PanelPeer.java \
java/awt/peer/PopupMenuPeer.java \
java/awt/peer/ScrollPanePeer.java \
java/awt/peer/ScrollbarPeer.java \
java/awt/peer/TextAreaPeer.java \
java/awt/peer/TextComponentPeer.java \
java/awt/peer/TextFieldPeer.java \
java/awt/peer/WindowPeer.java \ java/awt/peer/WindowPeer.java \
java/awt/Adjustable.java \ java/awt/Adjustable.java \
java/awt/Color.java \ java/awt/Color.java \
......
/* Copyright (C) 1999, 2000 Free Software Foundation /* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libjava. This file is part of libgcj.
This software is copyrighted work licensed under the terms of the This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */ details. */
package java.awt; package java.awt;
/* A very incomplete placeholder. */ /* Written using on-line Java 2 Platform Standard Edition v1.3 API
* Specification, as well as "The Java Class Libraries", 2nd edition
* (Addison-Wesley, 1998).
* Status: Believed complete and correct, except for the java.awt.Event
* compatibility constructor.
*/
/**
* AWTEvent is the root event class for all AWT events in the JDK 1.1 event
* model. It supercedes the Event class from JDK 1.0.
*/
public abstract class AWTEvent extends java.util.EventObject public abstract class AWTEvent extends java.util.EventObject
{ {
protected boolean consumed; protected boolean consumed;
protected int id; protected int id;
/* Event selection masks */
public static final long COMPONENT_EVENT_MASK = 1 << 0,
CONTAINER_EVENT_MASK = 1 << 1,
FOCUS_EVENT_MASK = 1 << 2,
KEY_EVENT_MASK = 1 << 3,
MOUSE_EVENT_MASK = 1 << 4,
MOUSE_MOTION_EVENT_MASK = 1 << 5,
WINDOW_EVENT_MASK = 1 << 6,
ACTION_EVENT_MASK = 1 << 7,
ADJUSTMENT_EVENT_MASK = 1 << 8,
ITEM_EVENT_MASK = 1 << 9,
TEXT_EVENT_MASK = 1 << 10,
INPUT_METHOD_EVENT_MASK = 1 << 11;
/* Additional event selection masks from JDK 1.3 javadocs */
public static final long PAINT_EVENT_MASK = 1 << 13,
INVOCATION_EVENT_MASK = 1 << 14,
HIERARCHY_EVENT_MASK = 1 << 15,
HIERARCHY_BOUNDS_EVENT_MASK = 1 << 16;
public static final int RESERVED_ID_MAX = 0x7cf;
public AWTEvent(Event event)
{
// FIXME??
super(event.target);
this.id = event.id;
}
public AWTEvent(Object source, int id)
{
super(source);
this.id = id;
}
public int getID() public int getID()
{ {
return id; return id;
...@@ -22,17 +67,21 @@ public abstract class AWTEvent extends java.util.EventObject ...@@ -22,17 +67,21 @@ public abstract class AWTEvent extends java.util.EventObject
public String paramString () public String paramString ()
{ {
return toString (); return "";
} }
public String toString () public String toString ()
{ {
return getClass().getName() + "[" + id + "]"; return getClass().getName() + "[" + paramString() + "] on " + source;
} }
public AWTEvent (Object source, int id) protected void consume()
{ {
super(source); consumed = true;
this.id = id; }
protected boolean isConsumed()
{
return consumed;
} }
} }
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt;
/* Status: Empty placeholder. */
public class CheckboxGroup
{
// Fields from the serialization spec. Decalare others "transient".
boolean state;
int checkboxMenuItemSerializedDataVersion;
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt;
/* Status: Just a placeholder. */
public class ColorModel implements Transparency
{
public int getTransparency()
{
// FIXME
return 0;
}
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Status: Incomplete. Needs a Locale lookup table. */
package java.awt;
import java.util.Locale;
import java.util.ResourceBundle;
public class ComponentOrientation implements java.io.Serializable
{
public static final ComponentOrientation LEFT_TO_RIGHT
= new ComponentOrientation(HORIZONTAL_ID & LEFT_TO_RIGHT_ID);
public static final ComponentOrientation RIGHT_TO_LEFT
= new ComponentOrientation(HORIZONTAL_ID);
public static final ComponentOrientation UNKNOWN
= new ComponentOrientation(0);
// FIXME: This field is from the serialization spec, but what are the
// correct values?
int orientation;
// Here is a wild guess.
private static int HORIZONTAL_ID = 1 << 0,
LEFT_TO_RIGHT_ID = 1 << 1;
ComponentOrientation(int orientation)
{
this.orientation = orientation;
}
public boolean isHorizontal()
{
return ((orientation & HORIZONTAL_ID) != 0);
}
public boolean isLeftToRight()
{
return ((orientation & LEFT_TO_RIGHT_ID) != 0);
}
public static ComponentOrientation getOrientation(Locale locale)
{
// FIXME: Use a table to look this up.
return LEFT_TO_RIGHT;
}
public static ComponentOrientation getOrientation(ResourceBundle bdl)
{
ComponentOrientation r;
try
{
Object obj = bdl.getObject("Orientation");
r = (ComponentOrientation) obj;
if (r != null)
return r;
}
catch (Exception x)
{
// Fall through
}
try
{
Locale l = bdl.getLocale();
r = getOrientation(l);
if (r != null)
return r;
}
catch (Exception x)
{
// Fall through
}
return (getOrientation (Locale.getDefault ()));
}
}
/* Copyright (C) 1999 Free Software Foundation /* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libjava. This file is part of libjava.
...@@ -8,26 +8,320 @@ details. */ ...@@ -8,26 +8,320 @@ details. */
package java.awt; package java.awt;
import java.awt.event.*;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.EventListener;
/* A very incomplete placeholder. */ /* A very incomplete placeholder. */
public abstract class Container extends Component public abstract class Container extends Component
{ {
int componentCount; /* Serialized fields from the serialization spec. */
Component[] components; int ncomponents;
Component[] component;
LayoutManager layoutMgr;
/* LightweightDispatcher dispatcher; */ // wtf?
Dimension maxSize;
int containerSerializedDataVersion;
public Component[] getComponents() /* Anything else is non-serializable, and should be declared "transient". */
transient ContainerListener containerListener;
public Container()
{ {
Component[] result = new Component[componentCount]; }
if (componentCount > 0)
System.arraycopy(components, 0, result, 0, componentCount); public int getComponentCount()
return result; {
return ncomponents;
}
/** @deprecated Use getComponentCount() instead. */
public int countComponents()
{
return ncomponents;
} }
public Component getComponent (int n) public Component getComponent (int n)
{ {
if (n < 0 || n >= componentCount) if (n < 0 || n >= ncomponents)
throw new ArrayIndexOutOfBoundsException("no such component"); throw new ArrayIndexOutOfBoundsException("no such component");
return components[n]; return component[n];
}
public Component[] getComponents()
{
Component[] result = new Component[ncomponents];
if (ncomponents > 0)
System.arraycopy(component, 0, result, 0, ncomponents);
return result;
}
public Insets getInsets()
{
// FIXME
return null;
}
/** @deprecated Use getInsets() instead. */
public Insets insets()
{
return getInsets();
}
public Component add(Component comp)
{
// FIXME
return null;
}
public Component add(String name, Component comp)
{
// FIXME
return null;
}
public Component add(Component comp, int index)
{
// FIXME
return null;
}
public void add(Component comp, Object constraints)
{
// FIXME
}
public void add(Component comp, Object constraints, int index)
{
// FIXME
}
protected void addImpl(Component comp, Object constraints, int index)
{
// FIXME
}
public void remove(int index)
{
// FIXME
}
public void remove(Component comp)
{
// FIXME
}
public void removeAll()
{
// FIXME
}
public LayoutManager getLayout()
{
return layoutMgr;
}
public void setLayout(LayoutManager mgr)
{
layoutMgr = mgr;
// FIXME
}
public void doLayout()
{
// FIXME
}
/** @deprecated Use doLayout() instead. */
public void layout()
{
doLayout();
}
public void invalidate()
{
// FIXME
}
public void validate()
{
// FIXME
}
protected void validateTree()
{
// FIXME
}
public void setFont(Font f)
{
// FIXME
}
public Dimension getPreferredSize()
{
// FIXME
return null;
}
/** @deprecated Use getPreferredSize() instead */
public Dimension preferredSize()
{
return getPreferredSize();
}
public Dimension getMinimumSize()
{
// FIXME
return null;
}
/** @deprecated Use getMinimumSize() instead */
public Dimension minimumSize()
{
return getMinimumSize();
}
public Dimension getMaximumSize()
{
// FIXME
return null;
}
public float getAlignmentX()
{
// FIXME
return 0;
}
public float getAlignmentY()
{
// FIXME
return 0;
}
public void paint(Graphics g)
{
// FIXME
}
public void update(Graphics g)
{
// FIXME
}
public void print(Graphics g)
{
// FIXME
}
public void paintComponents(Graphics g)
{
// FIXME
}
public void printComponents(Graphics g)
{
// FIXME
}
void dispatchEventImpl(AWTEvent e)
{
if ((e.id <= ContainerEvent.CONTAINER_LAST
&& e.id >= ContainerEvent.CONTAINER_FIRST)
&& (containerListener != null
|| (eventMask & AWTEvent.CONTAINER_EVENT_MASK) != 0))
processEvent(e);
else super.dispatchEventImpl(e);
}
public void addContainerListener(ContainerListener l)
{
containerListener = (ContainerListener)
AWTEventMulticaster.add(containerListener, l);
}
public void removeContainerListener(ContainerListener l)
{
containerListener = (ContainerListener)
AWTEventMulticaster.remove(containerListener, l);
}
/** @since 1.3 */
public EventListener[] getListeners(Class listenerType)
{
if (listenerType == ContainerListener.class)
return getListenersImpl(listenerType, containerListener);
else return super.getListeners(listenerType);
}
protected void processEvent(AWTEvent e)
{
if (e instanceof ContainerEvent)
processContainerEvent((ContainerEvent) e);
else super.processEvent(e);
}
protected void processContainerEvent(ContainerEvent e)
{
if (componentListener == null)
return;
switch (e.id)
{
case ContainerEvent.COMPONENT_ADDED:
containerListener.componentAdded(e);
break;
case ContainerEvent.COMPONENT_REMOVED:
containerListener.componentRemoved(e);
break;
}
}
/** @deprecated */
public void deliverEvent(Event e)
{
}
public Component getComponentAt(int x, int y)
{
// FIXME
return null;
}
/** @deprecated Use getComponentAt() instead */
public Component locate(int x, int y)
{
return getComponentAt(x, y);
}
public Component getComponentAt(Point p)
{
return getComponentAt(p.x, p.y);
}
public Component findComponentAt(int x, int y)
{
// FIXME
return null;
}
public Component findComponentAt(Point p)
{
return findComponentAt(p.x, p.y);
}
public void addNotify ()
{
for (int i = ncomponents; --i >= 0; )
component[i].addNotify();
}
public void removeNotify()
{
// FIXME
} }
public boolean isAncestorOf (Component comp) public boolean isAncestorOf (Component comp)
...@@ -42,18 +336,18 @@ public abstract class Container extends Component ...@@ -42,18 +336,18 @@ public abstract class Container extends Component
} }
} }
public Component add (String name, Component comp) protected String paramString()
{ {
/* FIXME */ return "FIXME";
return comp;
} }
public void addNotify () public void list(PrintStream out, int indent)
{ {
for (int i = componentCount; --i >= 0; ) // FIXME
components[i].addNotify(); }
public void list(PrintWriter out, int indent)
{
// FIXME
} }
public void setLayout (LayoutManager layout)
{ /* FIXME */ }
} }
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt;
/* A somewhat incomplete placeholder. */
public class Cursor
{
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;
private static final int PREDEFINED_COUNT = 14;
protected static Cursor[] predefined = new Cursor[PREDEFINED_COUNT];
protected String name;
int type;
public Cursor(int type)
{
this.type = type;
// FIXME: lookup and set name?
}
/** This constructor is used internally only.
* Application code should call Toolkit.createCustomCursor().
*/
protected Cursor(String name)
{
this.name = name;
// FIXME
}
public static Cursor getPredefinedCursor(int type)
{
if (type >= PREDEFINED_COUNT)
return null;
if (predefined[type] == null)
predefined[type] = new Cursor(type);
return predefined[type];
}
public static Cursor getSystemCustomCursor(String name)
throws AWTException
{
// FIXME
return null;
}
public static Cursor getDefaultCursor()
{
return getPredefinedCursor(0);
}
public int getType()
{
return type;
}
public String getName()
{
return name;
}
public String toString()
{
return (this.getClass() + "[" + getName() + "]");
}
}
...@@ -11,8 +11,7 @@ package java.awt; ...@@ -11,8 +11,7 @@ package java.awt;
/** /**
* Written using on-line Java Platform 1.2 API Specification, as well * Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Believed complete and correct, except for the paramString() * Status: Believed complete and correct.
* method, which is stubbed.
*/ */
public class Event public class Event
...@@ -132,7 +131,7 @@ public class Event ...@@ -132,7 +131,7 @@ public class Event
protected String paramString () protected String paramString ()
{ {
return "Event.paramString() not implemented"; return "id=" + id + ",x=" + x + ",y=" + y + "target=" + target;
} }
public boolean shiftDown() public boolean shiftDown()
...@@ -142,9 +141,7 @@ public class Event ...@@ -142,9 +141,7 @@ public class Event
public String toString() public String toString()
{ {
String r = getClass() + "[id=" + id + ",x=" + x + ",y=" + y + "target=" return getClass().getName() + "[" + paramString() + "]";
+ ((target == null) ? "null" : target) + "]";
return r;
} }
public void translate (int x, int y) public void translate (int x, int y)
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/** @author Bryce McKinlay */
/* Status: believed complete, but untested. */
package java.awt;
class EventDispatchThread extends Thread
{
private static int dispatchThreadNum = 1;
private EventQueue queue;
EventDispatchThread(EventQueue queue)
{
super();
setName("AWT-EventQueue-" + dispatchThreadNum++);
this.queue = queue;
setPriority(NORM_PRIORITY + 1);
}
public void run()
{
while (true)
{
try
{
AWTEvent evt = queue.getNextEvent();
queue.dispatchEvent(evt);
}
catch (Throwable x)
{
System.err.println("Exception during event dispatch:");
x.printStackTrace(System.err);
}
}
}
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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.util.EmptyStackException;
import java.lang.reflect.InvocationTargetException;
/* Written using on-line Java 2 Platform Standard Edition v1.3 API
* Specification, as well as "The Java Class Libraries", 2nd edition
* (Addison-Wesley, 1998).
* Status: Believed complete, but untested. Check FIXME's.
*/
/** @author Bryce McKinlay */
public class EventQueue
{
private static final int INITIAL_QUEUE_DEPTH = 8;
private AWTEvent[] queue = new AWTEvent[INITIAL_QUEUE_DEPTH];
private int next_in = 0; // Index where next event will be added to queue
private int next_out = 0; // Index of next event to be removed from queue
private EventQueue next;
private EventQueue prev;
private EventDispatchThread dispatchThread = new EventDispatchThread(this);
public EventQueue()
{
}
public synchronized AWTEvent getNextEvent()
throws InterruptedException
{
if (next != null)
return next.getNextEvent();
while (next_in == next_out)
wait();
AWTEvent res = queue[next_out];
if (++next_out == queue.length)
next_out = 0;
return res;
}
/** @specnote Does not block. Returns null if there are no events on the
* queue.
*/
public synchronized AWTEvent peekEvent()
{
if (next != null)
return next.peekEvent();
if (next_in != next_out)
return queue[next_out];
else return null;
}
/** @specnote Does not block. Returns null if there are no matching events
* on the queue.
*/
public synchronized AWTEvent peekEvent(int id)
{
if (next != null)
return next.peekEvent(id);
int i = next_out;
while (i != next_in)
{
AWTEvent qevt = queue[i];
if (qevt.id == id)
return qevt;
}
return null;
}
public synchronized void postEvent(AWTEvent evt)
{
if (next != null)
{
next.postEvent(evt);
return;
}
// FIXME: Security checks?
/* Check for any events already on the queue with the same source
and ID. */
int i = next_out;
while (i != next_in)
{
AWTEvent qevt = queue[i];
Object src;
if (qevt.id == evt.id
&& (src = qevt.getSource()) == evt.getSource()
&& src instanceof Component)
{
/* If there are, call coalesceEvents on the source component
to see if they can be combined. */
Component srccmp = (Component) src;
AWTEvent coalesced_evt = srccmp.coalesceEvents(qevt, evt);
if (coalesced_evt != null)
{
/* Yes. Replace the existing event with the combined event. */
queue[i] = coalesced_evt;
return;
}
break;
}
if (++i == queue.length)
i = 0;
}
queue[next_in] = evt;
if (++next_in == queue.length)
next_in = 0;
if (next_in == next_out)
{
/* Queue is full. Extend it. */
AWTEvent[] oldQueue = queue;
queue = new AWTEvent[queue.length * 2];
int len = oldQueue.length - next_out;
System.arraycopy(oldQueue, next_out, queue, 0, len);
if (next_out != 0)
System.arraycopy(oldQueue, 0, queue, len, next_out);
next_out = 0;
next_in = oldQueue.length;
}
notify();
}
/** @since JDK1.2 */
public static void invokeAndWait(Runnable runnable)
throws InterruptedException, InvocationTargetException
{
// FIXME: Is this an appropriate way to access the event queue?
EventQueue eq = Toolkit.systemEventQueue;
Thread current = Thread.currentThread();
if (current == eq.dispatchThread)
throw new Error("Can't call invokeAndWait from event dispatch thread");
InvocationEvent ie =
new InvocationEvent(eq, runnable, current, true);
eq.postEvent(ie);
synchronized (current)
{
current.wait();
}
Exception exception;
if ((exception = ie.getException()) != null)
throw new InvocationTargetException(exception);
}
/** @since JDK1.2 */
static void invokeLater(Runnable runnable)
{
// FIXME: Is this an appropriate way to access the event queue?
EventQueue eq = Toolkit.systemEventQueue;
InvocationEvent ie =
new InvocationEvent(eq, runnable, null, false);
eq.postEvent(ie);
}
static boolean isDispatchThread()
{
// FIXME: Is this an appropriate way to access the event queue?
EventQueue eq = Toolkit.systemEventQueue;
return (Thread.currentThread() == eq.dispatchThread);
}
/** Allows a custom EventQueue implementation to replace this one.
* All pending events are transferred to the new queue. Calls to postEvent,
* getNextEvent, and peekEvent are forwarded to the pushed queue until it
* is removed with a pop().
*/
public synchronized void push(EventQueue newEventQueue)
{
int i = next_out;
while (i != next_in)
{
newEventQueue.postEvent(queue[i]);
next_out = i;
if (++i == queue.length)
i = 0;
}
next = newEventQueue;
newEventQueue.prev = this;
}
/** Transfer any pending events from this queue back to the parent queue that
* was previously push()ed. Event dispatch from this queue is suspended. */
protected void pop() throws EmptyStackException
{
if (prev == null)
throw new EmptyStackException();
// Don't synchronize both this and prev at the same time, or deadlock could
// occur.
synchronized (prev)
{
prev.next = null;
}
synchronized (this)
{
int i = next_out;
while (i != next_in)
{
prev.postEvent(queue[i]);
next_out = i;
if (++i == queue.length)
i = 0;
}
}
}
protected void dispatchEvent(AWTEvent evt)
{
if (evt instanceof ActiveEvent)
{
ActiveEvent active_evt = (ActiveEvent) evt;
active_evt.dispatch();
}
else
{
Object source = evt.getSource();
if (source instanceof Component)
{
Component srccmp = (Component) source;
srccmp.dispatchEvent(evt);
}
else if (source instanceof MenuComponent)
{
MenuComponent srccmp = (MenuComponent) source;
srccmp.dispatchEvent(evt);
}
}
}
}
...@@ -8,6 +8,8 @@ details. */ ...@@ -8,6 +8,8 @@ details. */
package java.awt; package java.awt;
import java.util.Locale;
/** /**
* @author Warren Levy <warrenl@cygnus.com> * @author Warren Levy <warrenl@cygnus.com>
* @date March 16, 2000. * @date March 16, 2000.
...@@ -71,6 +73,18 @@ public class Font ...@@ -71,6 +73,18 @@ public class Font
return name; return name;
} }
public String getFamily()
{
// FIXME
return null;
}
public String getFamily(Locale l)
{
// FIXME
return null;
}
public int getStyle() public int getStyle()
{ {
return style; return style;
...@@ -87,4 +101,20 @@ public class Font ...@@ -87,4 +101,20 @@ public class Font
} }
public static Font decode(String str) { return null; } // FIXME 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() + "]";
}
} }
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt;
/**
* Status: Stubbed; A very incomplete implementation.
*/
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()
{
// FIXME??
return getHeight() - (getDescent() + getAscent());
}
public int getAscent()
{
// FIXME??
return getHeight() - (getDescent() + getLeading());
}
public int getDescent()
{
// FIXME??
return getHeight() - getDescent();
}
public int getHeight()
{
// FIXME??
return getLeading() + getAscent() + getDescent();
}
public int getMaxAscent()
{
// FIXME
return 0;
}
public int getMaxDescent()
{
// FIXME
return 0;
}
/* @deprecated Use getMaxDescent() instead. */
public int getMaxDecent()
{
return getMaxDescent();
}
public int getMaxAdvance()
{
// FIXME
return 0;
}
public int charWidth(int ch)
{
// FIXME
return 0;
}
public int charWidth(char ch)
{
// FIXME
return 0;
}
public int stringWidth(String str)
{
return charsWidth(str.toCharArray(), 0, str.length());
}
public int charsWidth(char[] data, int off, int len)
{
// FIXME
return -1;
}
public int bytesWidth(byte[] data, int off, int len)
{
// FIXME?
return -1;
}
public int[] getWidths()
{
// FIXME
return new int[0];
}
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() + "]";
}
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Status: Complete, but commented out until we have the required Java2D
classes. */
package java.awt;
public abstract class GraphicsConfiguration
{
/*
public abstract GraphicsDevice getDevice();
public abstract BufferedImage createCompatibleImage(int width, int height);
public abstract BufferedImage createCompatibleImage(int width, int height,
int transparency);
public abstract ColorModel getColorModel();
public abstract ColorModel getColorModel(int transparency);
public abstract AffineTransform getDefaultTransform();
public abstract AffineTransform getNormalizingTransform();
*/
/* @since 1.3 */
public abstract Rectangle getBounds();
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt;
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;
}
}
...@@ -8,26 +8,128 @@ details. */ ...@@ -8,26 +8,128 @@ details. */
package java.awt; package java.awt;
/* A very incomplete placeholder. */ import java.util.Vector;
/* Status: Incomplete. */
public class Menu extends MenuItem implements MenuContainer public class Menu extends MenuItem implements MenuContainer
{ {
public Menu (String label) // 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)
{ {
super(label); // ??? this(label, false);
throw new Error ("java.awt.Menu: not implemented"); }
public Menu(String label, boolean tearOff)
{
super(label);
this.tearOff = tearOff;
} }
public void add (String label) public void addNotify()
{ /* FIXME */ } {
// FIXME
}
public void removeNotify()
{
// FIXME
}
public synchronized MenuItem add (MenuItem item) public boolean isTearOff()
{ {
/* FIXME */ return tearOff;
return item;
} }
public Font getFont() { return null; } // FIXME public int getItemCount()
public boolean postEvent(Event evt) { return false; } // FIXME {
public void remove(MenuComponent comp) { } // FIXME 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()
} }
/* Copyright (C) 1999 Free Software Foundation /* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libjava. This file is part of libgcj.
This software is copyrighted work licensed under the terms of the This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */ details. */
package java.awt; package java.awt;
/* A very incomplete placeholder. */ /* Status: partially complete, untested. */
public abstract class MenuComponent public abstract class MenuComponent
{ {
// Fields from the serialization spec. Decalare others "transient".
Font font;
String name;
boolean nameExplicitlySet;
boolean newEventsOnly;
//AccessibleContext accessibleContext;
transient MenuContainer parent;
transient java.awt.peer.MenuComponentPeer peer;
public MenuComponent()
{
}
public String getName()
{
if (name == null && !nameExplicitlySet)
name = generateName();
return name;
}
/** Subclasses should override this to generate unique names like
* "menuitem0".
*/
String generateName()
{
// MenuComponent is abstract.
return null;
}
public void setName(String name)
{
nameExplicitlySet = true;
this.name = name;
}
public MenuContainer getParent()
{
return parent;
}
/** @deprecated Don't use this. */
public java.awt.peer.MenuComponentPeer getPeer()
{
return peer;
}
public Font getFont()
{
return font;
}
public void setFont(Font f)
{
this.font = f;
}
public void removeNotify()
{
// FIXME
}
/** @deprecated Replaced by dispatchEvent(AWTEvent) */
public boolean postEvent(Event evt)
{
return false;
}
public final void dispatchEvent(AWTEvent e)
{
// FIXME
dispatchEventImpl(e);
}
void dispatchEventImpl(AWTEvent e)
{
// This is overridden by subclasses that support events.
}
protected void processEvent(AWTEvent e)
{
// Nothing to do here? This is be overridden by subclasses that
// support events.
}
protected String paramString()
{
return name;
}
public String toString()
{
return this.getClass().getName() + "[" + paramString() + "]";
}
protected final Object getTreeLock()
{
// FIXME: figure out how the tree lock works.
return null;
}
// Accessibility API not yet implemented.
// public AccessibleContext getAccessibleContext()
} }
/* Copyright (C) 1999 Free Software Foundation /* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libjava. This file is part of libgcj.
This software is copyrighted work licensed under the terms of the This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */ details. */
package java.awt; package java.awt;
import java.awt.event.*; import java.awt.event.*;
import java.util.EventListener;
/* A very incomplete placeholder. */ /* A very incomplete placeholder. */
public class MenuItem extends MenuComponent public class MenuItem extends MenuComponent
{ {
// Fields from the serialization spec. Decalare others "transient".
boolean enabled;
String label;
String actionCommand;
long eventMask;
MenuShortcut shortcut;
int menuItemSerializedDataVersion;
transient ActionListener actionListener;
public MenuItem (String label) public MenuItem (String label)
{ {
throw new Error("java.awt.MenuItem: not implemented"); this.label = label;
}
public String getLabel()
{
return label;
}
public synchronized void setLabel(String label)
{
this.label = label;
}
public boolean isEnabled()
{
return enabled;
}
public synchronized void setEnabled(boolean b)
{
this.enabled = b;
}
/** @deprecated Use setEnabled() instead. */
public void enable()
{
setEnabled(true);
}
/** @deprecated Use setEnabled() instead. */
public void enable(boolean b)
{
setEnabled(b);
}
/** @deprecated Use setEnabled() instead. */
public void disable()
{
setEnabled(false);
}
public MenuShortcut getShortcut()
{
return shortcut;
}
public void setShortcut(MenuShortcut s)
{
this.shortcut = s;
}
public void deleteShortcut()
{
setShortcut(null);
} }
public synchronized void addActionListener (ActionListener listener) protected final void enableEvents(long eventsToEnable)
{ {
/* FIXME */ eventMask |= eventsToEnable;
// TODO: see comment in Component.enableEvents().
} }
protected final void disableEvents(long eventsToDisable)
{
eventMask &= ~eventsToDisable;
}
public void setActionCommand(String command)
{
this.actionCommand = command;
}
public String getActionCommand()
{
return actionCommand;
}
public synchronized void addActionListener(ActionListener l)
{
actionListener = AWTEventMulticaster.add(actionListener, l);
if (actionListener != null)
enableEvents(AWTEvent.ACTION_EVENT_MASK);
}
public synchronized void removeActionListener(ActionListener l)
{
actionListener = AWTEventMulticaster.remove(actionListener, l);
}
/** Returns all registered EventListers of the given listenerType.
* listenerType must be a subclass of EventListener, or a
* ClassClassException is thrown.
* @since 1.3
*/
public EventListener[] getListeners(Class listenerType)
{
if (listenerType == ActionListener.class)
return Component.getListenersImpl(listenerType, actionListener);
else
return Component.getListenersImpl(listenerType, null);
}
void dispatchEventImpl(AWTEvent e)
{
if (e.id <= ActionEvent.ACTION_LAST
&& e.id >= ActionEvent.ACTION_FIRST
&& (actionListener != null
|| (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0))
processEvent(e);
}
protected void processEvent(AWTEvent e)
{
if (e instanceof ActionEvent)
processActionEvent((ActionEvent) e);
}
protected void processActionEvent(ActionEvent e)
{
if (actionListener != null)
actionListener.actionPerformed(e);
}
public String paramString()
{
return name + ",label=" + label;
}
// Accessibility API not yet implemented.
// public AccessibleContext getAccessibleContext()
} }
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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.KeyEvent;
/* Status: Complete, except for hashCode(). Untested. */
public class MenuShortcut
{
// 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);
}
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt;
/* An incomplete placeholder. */
public class Panel extends Container
{
public Panel()
{
super();
}
public Panel(LayoutManager layout)
{
super();
setLayout (layout);
}
//public AccessibleContext getAccessibleContext()
public void addNotify()
{
// FIXME
}
}
/* Copyright (C) 2000 Free Software Foundation
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: Incomplete. */
public class PopupMenu extends Menu
{
public PopupMenu()
{
super();
}
public PopupMenu(String label)
{
super(label);
}
public void addNotify()
{
// FIXME
}
public void show(Component origin, int x, int y)
{
// FIXME
}
// Accessibility API not yet implemented.
// public AccessibleContext getAccessibleContext()
}
...@@ -8,28 +8,324 @@ details. */ ...@@ -8,28 +8,324 @@ details. */
package java.awt; package java.awt;
/* Status: Quite imcomplete. */ /* Status: Mostly complete. Some of the Java2D stuff is commented out. */
public class Rectangle implements Shape // FIXME: Should extend Rectangle2D for 1.2 implementation
public class Rectangle implements Cloneable, Shape
{ {
public int x; public int x;
public int y; public int y;
public int width; public int width;
public int height; public int height;
public Rectangle () { } public Rectangle()
{
x = 0;
y = 0;
width = 0;
height = 0;
}
public Rectangle(Rectangle r)
{
x = r.x;
y = r.y;
width = r.width;
height = r.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 (int width, int height) public Rectangle(int width, int height)
{ this.width = width; this.height = height; } {
x = 0;
y = 0;
this.width = width;
this.height = height;
}
public Rectangle(Point p, Dimension d)
{
x = p.x;
y = p.y;
width = d.width;
height = d.height;
}
public Rectangle(Point p)
{
x = p.x;
y = p.y;
width = 0;
height = 0;
}
public Rectangle (int x, int y, int width, int height) public Rectangle(Dimension d)
{ {
this.x = x; this.y = y; x = 0;
this.width = width; this.height = height; y = 0;
width = d.width;
height = d.height;
} }
public Rectangle getBounds () public Rectangle getBounds ()
{ {
return new Rectangle (x, y, width, height); return (Rectangle) this.clone();
}
public void add(int newx, int newy)
{
int x = this.x > newx ? newx : this.x;
int y = this.y > newy ? newy : this.y;
width = (this.x + width > newx ? this.x + width : newx) - x;
height = (this.y + height > newy ? this.y + height : newy) - y;
this.x = x;
this.y = y;
}
public void add(Point pt)
{
add (pt.x, pt.y);
}
public void add(Rectangle r)
{
int x = this.x > r.x ? r.x : this.x;
int y = this.y > r.y ? r.y : this.y;
width = (this.x + width > r.x + r.width ?
this.x + width : r.x + r.width) - x;
height = (this.y + height > r.y + r.height ?
this.y + height : r.y + r.height) - y;
this.x = x;
this.y = y;
}
public boolean contains(int x, int y)
{
return (x >= this.x && x <= this.x + this.width
&& y >= this.y && y <= this.y + this.height);
}
public boolean contains(int x, int y, int w, int h)
{
return (x >= this.x && x + w <= this.x + this.width
&& y >= this.y && y + h <= this.y + this.height);
}
public boolean contains(Point p)
{
return contains(p.x, p.y);
}
public boolean contains(Rectangle r)
{
return contains(r.x, r.y, r.width, r.height);
}
public boolean equals(Object obj)
{
if (obj instanceof Rectangle)
{
Rectangle r = (Rectangle) obj;
return (r.x == x
&& r.y == y
&& r.width == width
&& r.height == height);
}
return false;
}
public double getHeight()
{
return (double) this.height;
}
public Point getLocation()
{
return new Point(x,y);
}
public Dimension getSize()
{
return new Dimension(width, height);
}
public double getWidth()
{
return (double) this.width;
}
public double getX()
{
return (double) x;
}
public double getY()
{
return (double) y;
}
public void grow(int h, int v)
{
width += h;
height += v;
}
/** @deprecated Use contains() instead. */
public boolean inside(int x, int y)
{
return contains(x, y);
} }
/** @specnote If there is no intersection, an empty rectangle at 0,0
* is returned.
*/
public Rectangle intersection(Rectangle r)
{
int newx = x < r.x ? r.x : x;
int newy = y < r.y ? r.y : y;
int neww = (x + width < r.x + r.width ?
x + width : r.x + r.width) - newx;
int newh = (y + height < r.y + r.height ?
y + height : r.y + r.height) - newy;
if (neww >= 0 && newh >= 0)
return new Rectangle(newx, newy, neww, newh);
else
return new Rectangle(0, 0, 0, 0);
}
/** @specnote If the intersection is at an edge or corner only (an empty
* intersection with a non-zero location), false is returned.
*/
public boolean intersects(Rectangle r)
{
int neww = (x + width < r.x + r.width ?
x + width : r.x + r.width) - (x < r.x ? r.x : x);
int newh = (y + height < r.y + r.height ?
y + height : r.y + r.height) - (y < r.y ? r.y : y);
return (neww > 0 && newh > 0);
}
public boolean isEmpty()
{
return (width > 0 && height > 0);
}
/** @deprecated Use setLocation() instead. */
public void move(int x, int y)
{
setLocation(x, y);
}
public int outcode(double x, double y)
{
// FIXME
return 0;
}
/** @deprecated Use setBounds() instead. */
public void reshape(int x, int y, int width, int height)
{
setBounds(x, y, width, height);
}
/** @deprecated Use setSize() instead. */
public void resize(int width, int height)
{
setSize(width, height);
}
public void setBounds(int x, int y, int width, int height)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public void setBounds(Rectangle r)
{
this.x = r.x;
this.y = r.y;
this.width = r.width;
this.height = r.height;
}
public void setLocation(int x, int y)
{
this.x = x;
this.y = y;
}
public void setLocation(Point p)
{
this.x = p.x;
this.y = p.y;
}
public void setRect(double x, double y, double width, double height)
{
this.x = (int) x;
this.y = (int) y;
this.width = (int) width;
this.height = (int) height;
}
public void setSize(Dimension d)
{
this.width = d.width;
this.height = d.height;
}
public void setSize(int width, int height)
{
this.width = width;
this.height = height;
}
public void translate(int x, int y)
{
x += x;
y += y;
}
public Rectangle union(Rectangle r)
{
int newx = x > r.x ? r.x : x;
int newy = y > r.y ? r.y : y;
int neww = (this.x + width > r.x + r.width ?
this.x + width : r.x + r.width) - newx;
int newh = (this.y + height > r.y + r.height ?
this.y + height : r.y + r.height) - newy;
return new Rectangle(newx, newy, neww, newh);
}
// Commented out until we have Rectangle2D
/*
public Rectangle2D createIntersection(Rectangle2D r)
{
}
public Rectangle2D createUnion(Rectangle2D r)
{
}
public Rectangle2D getBounds2D()
{
}
*/
public String toString()
{
return getClass().getName() + "[x=" + x + ",y=" + y + ",width=" + width +
",height=" + height + "]";
}
} }
...@@ -15,6 +15,7 @@ import java.net.URL; ...@@ -15,6 +15,7 @@ import java.net.URL;
public abstract class Toolkit public abstract class Toolkit
{ {
static Toolkit defaultToolkit; static Toolkit defaultToolkit;
static EventQueue systemEventQueue = new EventQueue();
public static synchronized Toolkit getDefaultToolkit() public static synchronized Toolkit getDefaultToolkit()
{ {
...@@ -26,6 +27,11 @@ public abstract class Toolkit ...@@ -26,6 +27,11 @@ public abstract class Toolkit
protected abstract FramePeer createFrame(Frame target); protected abstract FramePeer createFrame(Frame target);
public abstract Image getImage(URL url); public abstract Image getImage(URL url);
public final EventQueue getSystemEventQueue()
{
return systemEventQueue;
}
private static void init() { } private static void init() { }
// private static native void init(); // private static native void init();
// static { init(); } // static { init(); }
......
...@@ -21,25 +21,25 @@ public class ActionEvent extends AWTEvent ...@@ -21,25 +21,25 @@ public class ActionEvent extends AWTEvent
public static final int META_MASK = 4; public static final int META_MASK = 4;
public static final int SHIFT_MASK = 1; public static final int SHIFT_MASK = 1;
String actionCommand; String cmd;
int modifiers; int modifiers;
public ActionEvent (Object source, int id, String command) public ActionEvent (Object source, int id, String command)
{ {
super(source, id); super(source, id);
actionCommand = command; cmd = command;
} }
public ActionEvent (Object source, int id, String command, int modifiers) public ActionEvent (Object source, int id, String command, int modifiers)
{ {
super(source, id); super(source, id);
actionCommand = command; cmd = command;
this.modifiers = modifiers; this.modifiers = modifiers;
} }
public String getActionCommand () public String getcmd ()
{ {
return actionCommand; return cmd;
} }
public int getModifiers () public int getModifiers ()
...@@ -49,7 +49,18 @@ public class ActionEvent extends AWTEvent ...@@ -49,7 +49,18 @@ public class ActionEvent extends AWTEvent
public String paramString () public String paramString ()
{ {
return ("ActionEvent[" + actionCommand + "," + modifiers String r;
+ ";" + super.paramString () + "]"); switch (id)
{
case ACTION_PERFORMED:
r = "ACTION_PERFORMED";
break;
default:
r = "unknown type";
break;
}
r += ",cmd=" + cmd;
return r;
} }
} }
...@@ -30,7 +30,7 @@ public class AdjustmentEvent extends AWTEvent ...@@ -30,7 +30,7 @@ public class AdjustmentEvent extends AWTEvent
public AdjustmentEvent (Adjustable source, int id, int type, int value) public AdjustmentEvent (Adjustable source, int id, int type, int value)
{ {
super (source, id); super (source, id);
this.type = type; this.adjType = type;
this.value = value; this.value = value;
} }
...@@ -41,7 +41,7 @@ public class AdjustmentEvent extends AWTEvent ...@@ -41,7 +41,7 @@ public class AdjustmentEvent extends AWTEvent
public int getAdjustmentType () public int getAdjustmentType ()
{ {
return type; return adjType;
} }
public int getValue () public int getValue ()
...@@ -51,10 +51,45 @@ public class AdjustmentEvent extends AWTEvent ...@@ -51,10 +51,45 @@ public class AdjustmentEvent extends AWTEvent
public String paramString () public String paramString ()
{ {
return ("AdjustmentEvent[" + type + "," + value String r;
+ ";" + super.paramString () + "]"); switch (id)
{
case ADJUSTMENT_VALUE_CHANGED:
r = "ADJUSTMENT_VALUE_CHANGED";
break;
default:
r = "unknown id";
break;
}
r += ",adjType=";
switch (adjType)
{
case BLOCK_DECREMENT:
r += "BLOCK_DECREMENT";
break;
case BLOCK_INCREMENT:
r += "BLOCK_INCREMENT";
break;
case TRACK:
r += "TRACK";
break;
case UNIT_DECREMENT:
r += "UNIT_DECREMENT";
break;
case UNIT_INCREMENT:
r += "UNIT_INCREMENT";
break;
default:
r += "unknown type";
break;
}
r += ",value=" + value;
return r;
} }
private int type; private int adjType;
private int value; private int value;
} }
...@@ -37,6 +37,25 @@ public class ComponentEvent extends AWTEvent ...@@ -37,6 +37,25 @@ public class ComponentEvent extends AWTEvent
public String paramString () public String paramString ()
{ {
return super.paramString (); String r;
switch (id)
{
case COMPONENT_HIDDEN:
r = "COMPONENT_HIDDEN";
break;
case COMPONENT_MOVED:
r = "COMPONENT_MOVED";
break;
case COMPONENT_RESIZED:
r = "COMPONENT_RESIZED";
break;
case COMPONENT_SHOWN:
r = "COMPONENT_SHOWN";
break;
default:
r = "unknown id";
break;
}
return r;
} }
} }
...@@ -23,8 +23,8 @@ public class ContainerEvent extends ComponentEvent ...@@ -23,8 +23,8 @@ public class ContainerEvent extends ComponentEvent
public static final int CONTAINER_FIRST = 300; public static final int CONTAINER_FIRST = 300;
public static final int CONTAINER_LAST = 301; public static final int CONTAINER_LAST = 301;
// FIXME: jdk1.2 docs say source is a Component. /** @specnote In JDK1.2 and 1.3, source is a Component. */
public ContainerEvent (Container source, int id, Component child) public ContainerEvent (Component source, int id, Component child)
{ {
super (source, id); super (source, id);
this.child = child; this.child = child;
...@@ -35,15 +35,29 @@ public class ContainerEvent extends ComponentEvent ...@@ -35,15 +35,29 @@ public class ContainerEvent extends ComponentEvent
return child; return child;
} }
public Component getContainer () public Component getComponent ()
{ {
return (Container) source; return (Component) source;
} }
public String paramString () public String paramString ()
{ {
return ("ContainerEvent[" + child String r;
+ ";" + super.paramString () + "]"); switch (id)
{
case COMPONENT_ADDED:
r = "COMPONENT_ADDED";
break;
case COMPONENT_REMOVED:
r = "COMPONENT_REMOVED";
break;
default:
r = "unknown id";
break;
}
r += ",child=" + child;
return r;
} }
private Component child; private Component child;
......
...@@ -42,8 +42,21 @@ public class FocusEvent extends AWTEvent ...@@ -42,8 +42,21 @@ public class FocusEvent extends AWTEvent
public String paramString () public String paramString ()
{ {
return ("FocusEvent[" + temporary String r = "";
+ ";" + super.paramString () + "]"); switch (id)
{
case FOCUS_GAINED:
r += "FOCUS_GAINED";
break;
case FOCUS_LOST:
r += "FOCUS_LOST";
break;
default:
r += "unknown id";
break;
}
r += (temporary ? "temporary" : "permanent");
return r;
} }
private boolean temporary; private boolean temporary;
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt.event;
/**
* @since 1.3
* @author Bryce McKinlay
*/
/* Status: Believed complete and correct. */
public abstract class HierarchyBoundsAdapter implements HierarchyBoundsListener
{
public void ancestorMoved(HierarchyEvent e)
{
}
public void ancestorResized(HierarchyEvent e)
{
}
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt.event;
/**
* @since 1.3
* @author Bryce McKinlay
*/
/* Status: Believed complete and correct. */
public interface HierarchyBoundsListener extends java.util.EventListener
{
public void ancestorMoved(HierarchyEvent e);
public void ancestorResized(HierarchyEvent e);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt.event;
import java.awt.*;
/**
* @since 1.3
* @author Bryce McKinlay
*/
/* Status: thought to be complete and correct. */
public class HierarchyEvent extends AWTEvent
{
public static final int PARENT_CHANGED = 1 << 0,
DISPLAYABILITY_CHANGED = 1 << 1,
SHOWING_CHANGED = 1 << 2,
HIERARCHY_FIRST = 1400,
HIERARCHY_CHANGED = 1400,
ANCESTOR_MOVED = 1401,
ANCESTOR_RESIZED = 1402,
HIERARCHY_LAST = 1402;
/* Serialized fields from the serialization spec. */
Component changed;
Container changedParent;
long changeFlags = 0;
public HierarchyEvent(Component source, int id, Component changed,
Container changedParent)
{
super(source, id);
this.changed = changed;
this.changedParent = changedParent;
}
public HierarchyEvent(Component source, int id, Component changed,
Container changedParent, long changeFlags)
{
super(source,id);
this.changed = changed;
this.changedParent = changedParent;
this.changeFlags = changeFlags;
}
public Component getComponent()
{
return (Component) source;
}
public Component getChanged()
{
return changed;
}
public Container getChangedParent()
{
return changedParent;
}
public long getChangeFlags()
{
return changeFlags;
}
public String paramString()
{
String r;
switch (id)
{
case HIERARCHY_CHANGED:
r = "HIERARCHY_CHANGED";
break;
case ANCESTOR_MOVED:
r = "ANCESTOR_MOVED";
break;
case ANCESTOR_RESIZED:
r = "ANCESTOR_RESIZED";
break;
default:
return "unknown type";
}
r += "(" + changed + "," + changedParent + ")";
return r;
}
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt.event;
/**
* @since 1.3
* @author Bryce McKinlay
*/
/* Status: Believed complete and correct. */
public interface HierarchyListener extends java.util.EventListener
{
public void hierarchyChanged(HierarchyEvent e);
}
...@@ -43,7 +43,21 @@ public class InputMethodEvent extends AWTEvent ...@@ -43,7 +43,21 @@ public class InputMethodEvent extends AWTEvent
public TextHitInfo getVisiblePosition (); public TextHitInfo getVisiblePosition ();
public boolean isConsumed (); public boolean isConsumed ();
public String paramString (); public String paramString ()
{
String r;
switch (id)
{
case CARET_POSITION_CHANGED:
r = "CARET_POSITION_CHANGED";
break;
case INPUT_METHOD_TEXT_CHANGED:
r = "INPUT_METHOD_TEXT_CHANGED";
break;
}
r += ""; // FIXME
return r;
}
*/ */
// FIXME: this is just to let it compile. // FIXME: this is just to let it compile.
......
...@@ -14,7 +14,7 @@ import java.awt.*; ...@@ -14,7 +14,7 @@ import java.awt.*;
* @date April 8, 2000 * @date April 8, 2000
*/ */
/* Status: Still one bug. */ /* Status: Believed to be complete and correct. */
public class InvocationEvent extends AWTEvent implements ActiveEvent public class InvocationEvent extends AWTEvent implements ActiveEvent
{ {
...@@ -37,28 +37,29 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent ...@@ -37,28 +37,29 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
this.runnable = runnable; this.runnable = runnable;
} }
public InvocationEvent (Object source, Runnable runnable, Object notifier) public InvocationEvent(Object source, Runnable runnable, Object notifier,
boolean catchExceptions)
{ {
super (source, INVOCATION_DEFAULT); super (source, INVOCATION_DEFAULT);
this.runnable = runnable; this.runnable = runnable;
this.notifier = notifier; this.notifier = notifier;
this.catchExceptions = catchExceptions;
} }
public void dispatch () public void dispatch ()
{ {
Exception e = null; Exception e = null;
try
{
runnable.run ();
}
catch (Exception _)
{
e = _;
}
// FIXME: what to do if !catchExceptions?
if (catchExceptions) if (catchExceptions)
exception = e; try
{
runnable.run ();
}
catch (Exception x)
{
exception = x;
}
else
runnable.run ();
if (notifier != null) if (notifier != null)
notifier.notifyAll (); notifier.notifyAll ();
...@@ -71,9 +72,15 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent ...@@ -71,9 +72,15 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
public String paramString () public String paramString ()
{ {
return ("InvocationEvent[" + notifier + "," + runnable String r;
+ "," + catchExceptions if (id == INVOCATION_DEFAULT)
+ ";" + super.paramString () + "]"); r = "INVOCATION_DEFAULT";
else
r = "unknown type";
r += ",runnable=" + runnable + ",notifier=" + notifier +
",catchExceptions=" + catchExceptions;
return r;
} }
protected boolean catchExceptions; protected boolean catchExceptions;
......
...@@ -48,8 +48,32 @@ public class ItemEvent extends AWTEvent ...@@ -48,8 +48,32 @@ public class ItemEvent extends AWTEvent
public String paramString () public String paramString ()
{ {
return ("ItemEvent[" + item + "," + stateChange String r;
+ ";" + super.paramString () + "]"); switch (id)
{
case ITEM_STATE_CHANGED:
r = "ITEM_STATE_CHANGED";
break;
default:
r = "unknown id";
break;
}
r += ",item=" + item + ",stateChange=";
switch (stateChange)
{
case SELECTED:
r += "SELECTED";
break;
case DESELECTED:
r += "DESELECTED";
break;
default:
r += "unknown";
break;
}
return r;
} }
private Object item; private Object item;
......
...@@ -251,8 +251,22 @@ public class KeyEvent extends InputEvent ...@@ -251,8 +251,22 @@ public class KeyEvent extends InputEvent
public String paramString () public String paramString ()
{ {
return ("KeyEvent[" + keyCode + "," + keyChar + "," + modifiers String r;
+ ";" + super.paramString () + "]"); switch (id)
{
case KEY_PRESSED:
r = "KEY_PRESSED";
break;
case KEY_RELEASED:
r = "KEY_RELEASED";
break;
case KEY_TYPED:
r = "KEY_TYPED";
break;
}
r += ",keyCode=" + keyCode + "," + getKeyText(keyCode) + ",modifiers=" +
getKeyModifiersText(modifiers);
return r;
} }
private int keyCode; private int keyCode;
......
...@@ -67,10 +67,37 @@ public class MouseEvent extends InputEvent ...@@ -67,10 +67,37 @@ public class MouseEvent extends InputEvent
public String paramString () public String paramString ()
{ {
return ("MouseEvent[" + when + "," + modifiers String r;
+ ",(" + x + "," + y + ")," switch (id)
+ clickCount + "," + popupTrigger {
+ ";" + super.paramString () + "]"); case MOUSE_CLICKED:
r = "MOUSE_CLICKED";
break;
case MOUSE_DRAGGED:
r = "MOUSE_DRAGGED";
break;
case MOUSE_ENTERED:
r = "MOUSE_ENTERED";
break;
case MOUSE_EXITED:
r = "MOUSE_EXITED";
break;
case MOUSE_MOVED:
r = "MOUSE_MOVED";
break;
case MOUSE_PRESSED:
r = "MOUSE_PRESSED";
break;
case MOUSE_RELEASED:
r = "MOUSE_RELEASED";
break;
default:
r = "unknown id";
break;
}
r += ",(" + x + "," + y + "),modifiers=" + modifiers + ",clickCount=" +
clickCount;
return r;
} }
public void translatePoint (int x, int y) public void translatePoint (int x, int y)
......
...@@ -36,8 +36,22 @@ public class PaintEvent extends ComponentEvent ...@@ -36,8 +36,22 @@ public class PaintEvent extends ComponentEvent
public String paramString () public String paramString ()
{ {
return ("PaintEvent[" + updateRect String r;
+ ";" + super.paramString () + "]"); switch (id)
{
case UPDATE:
r = "UPDATE";
break;
case PAINT:
r = "PAINT";
break;
default:
r = "unknown id";
break;
}
r += ",updateRect=" + updateRect;
return r;
} }
public void setUpdateRect (Rectangle updateRect) public void setUpdateRect (Rectangle updateRect)
......
...@@ -24,6 +24,6 @@ public class TextEvent extends AWTEvent ...@@ -24,6 +24,6 @@ public class TextEvent extends AWTEvent
public String paramString () public String paramString ()
{ {
return super.paramString (); return "TEXT_VALUE_CHANGED";
} }
} }
...@@ -35,6 +35,31 @@ public class WindowEvent extends ComponentEvent ...@@ -35,6 +35,31 @@ public class WindowEvent extends ComponentEvent
public String paramString () public String paramString ()
{ {
return super.paramString (); String r;
switch (id)
{
case WINDOW_ACTIVATED:
r = "WINDOW_ACTIVATED";
break;
case WINDOW_CLOSED:
r = "WINDOW_CLOSED";
break;
case WINDOW_CLOSING:
r = "WINDOW_CLOSING";
break;
case WINDOW_DEACTIVATED:
r = "WINDOW_DEACTIVATED";
break;
case WINDOW_DEICONIFIED:
r = "WINDOW_DEICONIFIED";
break;
case WINDOW_ICONIFIED:
r = "WINDOW_ICONIFIED";
break;
case WINDOW_OPENED:
r = "WINDOW_OPENED";
break;
}
return r;
} }
} }
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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
{
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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 addItem(String item, int index);
void remove(int index);
void select(int index);
}
/* Copyright (C) 1999 Free Software Foundation /* Copyright (C) 2000 Free Software Foundation
This file is part of libjava. This file is part of libgcj.
This software is copyrighted work licensed under the terms of the This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */ details. */
package java.awt.peer; package java.awt.peer;
import java.awt.*;
/* A very incomplete placeholder. */ import java.awt.*;
import java.awt.image.*;
public interface ComponentPeer public interface ComponentPeer
{ {
public abstract Toolkit getToolkit (); int checkImage(Image img, int width, int height, ImageObserver o);
Image createImage(ImageProducer prod);
public Dimension getMinimumSize (); Image createImage(int width, int height);
void disable();
public Dimension getPreferredSize (); void dispose();
void enable();
public void setBounds (int x, int y, int w, int h); ColorModel getColorModel();
FontMetrics getFontMetrics(Font f);
Graphics getGraphics();
Point getLocationOnScreen();
Dimension getMinimumSize();
Dimension getPreferredSize();
Toolkit getToolkit();
void handleEvent(AWTEvent e);
void hide();
boolean isFocusTraversable();
Dimension minimumSize();
Dimension preferredSize();
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 reshape(int x, int y, int width, int height);
void setBackground(Color color);
void setBounds(int x, int y, int width, int height);
void setCursor(Cursor cursor);
void setEnabled(boolean enabled);
void setFont(Font font);
void setForeground(Color color);
void setVisible(boolean visible);
void show();
} }
/* Copyright (C) 1999 Free Software Foundation /* Copyright (C) 2000 Free Software Foundation
This file is part of libjava. This file is part of libgcj.
This software is copyrighted work licensed under the terms of the This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */ details. */
package java.awt.peer; package java.awt.peer;
/* A very incomplete placeholder. */ import java.awt.Insets;
public interface ContainerPeer extends ComponentPeer public interface ContainerPeer extends ComponentPeer
{ {
Insets insets();
Insets getInsets();
void beginValidate();
void endValidate();
} }
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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;
import java.io.FilenameFilter;
public interface FileDialogPeer extends DialogPeer
{
void setDirectory(String dir);
void setFile(String file);
void setFilenameFilter(FilenameFilter filter);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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
{
}
/* Copyright (C) 1999 Free Software Foundation /* Copyright (C) 2000 Free Software Foundation
This file is part of libjava. This file is part of libgcj.
This software is copyrighted work licensed under the terms of the This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */ details. */
package java.awt.peer; package java.awt.peer;
/* A very incomplete placeholder. */ import java.awt.Image;
import java.awt.MenuBar;
public interface FramePeer extends WindowPeer public interface FramePeer extends WindowPeer
{ {
void setIconImage(Image image);
void setMenuBar(MenuBar mb);
void setResizable(boolean resizable);
void setTitle(String title); void setTitle(String title);
} }
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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
{
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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;
import java.awt.Dimension;
public interface ListPeer extends ComponentPeer
{
void add(String item, int index);
void addItem(String item, int index);
void clear();
void delItems(int start_index, int end_index);
void deselect(int index);
int[] getSelectedIndexes();
void makeVisible(int index);
Dimension minimumSize(int size);
Dimension preferredSize(int size);
void removeAll();
void select(int index);
void setMultipleMode(boolean multipleMode);
void setMultipleSelections(boolean multipleSelections);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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;
import java.awt.Menu;
public interface MenuBarPeer extends MenuComponentPeer
{
void addHelpMenu(Menu menu);
void addMenu(Menu menu);
void delMenu(int index);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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();
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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 disable();
void enable();
void setEnabled(boolean enabled);
void setLabel(String text);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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;
import java.awt.MenuItem;
public interface MenuPeer extends MenuItemPeer
{
void addItem(MenuItem item);
void addSeparator();
void delItem(int index);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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
{
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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;
import java.awt.Event;
public interface PopupMenuPeer extends MenuPeer
{
void show(Event e);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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;
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);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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;
import java.awt.Dimension;
public interface TextAreaPeer extends TextComponentPeer
{
Dimension getMinimumSize(int rows, int columns);
Dimension getPreferredSize(int rows, int columns);
void insert(String text, int pos);
void insertText(String text, int pos);
Dimension minimumSize(int rows, int cols);
Dimension preferredSize(int rows, int cols);
void replaceRange(String text, int start, int end);
void replaceText(String text, int start, int end);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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);
}
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
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;
import java.awt.Dimension;
public interface TextFieldPeer extends TextComponentPeer
{
Dimension getMinimumSize(int columns);
Dimension getPreferredSize(int columns);
Dimension minimumSize(int columns);
Dimension preferredSize(int columns);
void setEchoChar(char echo);
void setEchoCharacter(char echo);
}
/* Copyright (C) 1999 Free Software Foundation /* Copyright (C) 2000 Free Software Foundation
This file is part of libjava. This file is part of libgcj.
This software is copyrighted work licensed under the terms of the This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */ details. */
package java.awt.peer; package java.awt.peer;
/* A very incomplete placeholder. */
public interface WindowPeer extends ContainerPeer public interface WindowPeer extends ContainerPeer
{ {
void toBack();
void toFront();
} }
...@@ -28,6 +28,12 @@ public abstract class ResourceBundle ...@@ -28,6 +28,12 @@ public abstract class ResourceBundle
public ResourceBundle () public ResourceBundle ()
{ {
} }
public Locale getLocale()
{
// FIXME: Stub added for this missing method because it is needed for AWT.
return null;
}
public final String getString (String key) throws MissingResourceException public final String getString (String key) throws MissingResourceException
{ {
...@@ -110,9 +116,14 @@ public abstract class ResourceBundle ...@@ -110,9 +116,14 @@ public abstract class ResourceBundle
// Look for a properties file. // Look for a properties file.
{ {
String prop_name = (bundleName.replace('.', '/') + ".properties");
System.out.println ("trying '" + prop_name + "' for '" + bundleName);
InputStream i = ClassLoader.getSystemResourceAsStream (prop_name);
/*
InputStream i = InputStream i =
ClassLoader.getSystemResourceAsStream (bundleName.replace ('.', '/') ClassLoader.getSystemResourceAsStream (bundleName.replace ('.', '/')
+ ".properties"); + ".properties");
*/
if (i != null) if (i != null)
{ {
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment