Commit 7bde45b2 by Bryce McKinlay Committed by Bryce McKinlay

AWT/Swing merge from GNU Classpath.

From-SVN: r56147
parent 097684ce
...@@ -12,6 +12,7 @@ import java.awt.GraphicsConfiguration; ...@@ -12,6 +12,7 @@ import java.awt.GraphicsConfiguration;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.GraphicsDevice;
import java.awt.Point; import java.awt.Point;
import java.awt.Color; import java.awt.Color;
import java.awt.color.ColorSpace; import java.awt.color.ColorSpace;
...@@ -128,7 +129,8 @@ public class XGraphicsConfiguration extends GraphicsConfiguration ...@@ -128,7 +129,8 @@ public class XGraphicsConfiguration extends GraphicsConfiguration
* maybe be moved to a different location.] * maybe be moved to a different location.]
* *
* @param offset Offset to data. The given offset does not include * @param offset Offset to data. The given offset does not include
* data buffer offset, which will also be added. */ * data buffer offset, which will also be added.
*/
static void attachData(XImage ximage, DataBuffer dataB, int offset) static void attachData(XImage ximage, DataBuffer dataB, int offset)
{ {
offset += dataB.getOffset(); offset += dataB.getOffset();
...@@ -236,13 +238,47 @@ public class XGraphicsConfiguration extends GraphicsConfiguration ...@@ -236,13 +238,47 @@ public class XGraphicsConfiguration extends GraphicsConfiguration
rmap, gmap, bmap, amap); rmap, gmap, bmap, amap);
} }
/**
* Gets the associated device that this configuration describes.
*
* @return the device
*/
public GraphicsDevice getDevice()
{
throw new UnsupportedOperationException("not implemented");
}
/**
* Returns a buffered image optimized to this device, so that blitting can
* be supported in the buffered image.
*
* @param w the width of the buffer
* @param h the height of the buffer
* @return the buffered image, or null if none is supported
*/
public BufferedImage createCompatibleImage(int width, public BufferedImage createCompatibleImage(int width,
int height, int height,
int transparency) int transparency)
{ {
throw new UnsupportedOperationException("not implemented"); throw new UnsupportedOperationException("not implemented");
} }
/**
* Returns a buffered volatile image optimized to this device, so that
* blitting can be supported in the buffered image. Because the buffer is
* volatile, it can be optimized by native graphics accelerators.
*
* @param w the width of the buffer
* @param h the height of the buffer
* @return the buffered image, or null if none is supported
* @see Component#createVolatileImage(int, int)
* @since 1.4
*/
public VolatileImage createCompatibleVolatileImage(int w, int h)
{
throw new UnsupportedOperationException("not implemented");
}
/** /**
* FIXME: I'm not sure which color model that should be returned here. * FIXME: I'm not sure which color model that should be returned here.
*/ */
......
...@@ -9,12 +9,16 @@ details. */ ...@@ -9,12 +9,16 @@ details. */
package gnu.awt.xlib; package gnu.awt.xlib;
import java.awt.*; import java.awt.*;
import java.awt.dnd.*;
import java.awt.dnd.peer.*;
import java.awt.im.*;
import java.awt.peer.*; import java.awt.peer.*;
import java.awt.image.ImageProducer; import java.awt.image.ImageProducer;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
import java.net.*; import java.net.*;
import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.Clipboard;
import java.util.Properties; import java.util.Properties;
import java.util.Map;
import gnu.gcj.xlib.Display; import gnu.gcj.xlib.Display;
import gnu.gcj.xlib.Screen; import gnu.gcj.xlib.Screen;
...@@ -318,22 +322,24 @@ public class XToolkit extends Toolkit ...@@ -318,22 +322,24 @@ public class XToolkit extends Toolkit
return defaultConfig; return defaultConfig;
} }
public DragSourceContextPeer
createDragSourceContextPeer(DragGestureEvent dge)
throws InvalidDnDOperationException
{
throw new UnsupportedOperationException("not implemented");
}
/* public DragGestureRecognizer
public DragSourceContextPeer createDragGestureRecognizer(Class abstractRecognizerClass,
createDragSourceContextPeer(DragGestureEvent dge) DragSource ds, Component c,
throws InvalidDnDOperationException; int srcActions, DragGestureListener dgl)
{
public DragGestureRecognizer throw new UnsupportedOperationException("not implemented");
createDragGestureRecognizer(Class abstractRecognizerClass, }
DragSource ds, Component c,
int srcActions, DragGestureListener dgl) {
throw new UnsupportedOperationException("not implemented");
}
*/
/* public Map mapInputMethodHighlight(InputMethodHighlight highlight)
public Map mapInputMethodHighlight(InputMethodHighlight highlight); {
*/ throw new UnsupportedOperationException("not implemented");
}
} }
/* AWTError.java -- A serious AWT error occurred. /* AWTError.java -- A serious AWT error occurred.
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -39,24 +39,26 @@ exception statement from your version. */ ...@@ -39,24 +39,26 @@ exception statement from your version. */
package java.awt; package java.awt;
/** /**
* This error is thrown when a critical AWT error occurs. * This error is thrown when a critical Abstract Window Toolkit (AWT) error
* * occurs.
* @author Aaron M. Renn (arenn@urbanophile.com) *
*/ * @author Aaron M. Renn <arenn@urbanophile.com>
* @status updated to 1.4
*/
public class AWTError extends Error public class AWTError extends Error
{ {
/**
* Compatible with JDK 1.0+.
*/
private static final long serialVersionUID = -1819846354050686206L;
/** /**
* Initializes a new instance of <code>AWTError</code> with the specified * Create a new instance with the specified descriptive error message.
* descriptive error message. *
* * @param message the descriptive error message
* @param message The descriptive error message. */
*/ public AWTError(String message)
public {
AWTError(String message) super(message);
{ }
super(message); } // class AWTError
}
} // class AWTError
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation /* AWTEvent.java -- the root event in AWT
Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -37,123 +38,169 @@ exception statement from your version. */ ...@@ -37,123 +38,169 @@ exception statement from your version. */
package java.awt; package java.awt;
/* Written using on-line Java 2 Platform Standard Edition v1.3 API import java.util.EventObject;
* 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 * AWTEvent is the root event class for all AWT events in the JDK 1.1 event
* model. It supersedes the Event class from JDK 1.0. * model. It supersedes the Event class from JDK 1.0. Subclasses outside of
* the java.awt package should have IDs greater than RESERVED_ID_MAX.
*
* <p>Event masks defined here are used by components in
* <code>enableEvents</code> to select event types not selected by registered
* listeners. Event masks are appropriately set when registering on
* components.
*
* @author Warren Levy <warrenl@cygnus.com> * @author Warren Levy <warrenl@cygnus.com>
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn <arenn@urbanophile.com>
* @since 1.1
* @status updated to 1.4
*/ */
public abstract class AWTEvent extends java.util.EventObject public abstract class AWTEvent extends EventObject
{ {
/** /**
* @serial Indicates whether or not this event has been consumed. * Compatible with JDK 1.1+.
*/ */
protected boolean consumed; private static final long serialVersionUID = -1825314779160409405L;
/** /**
* @serial The identifier number of this event. * The ID of the event.
*
* @see #getID()
* @see #AWTEvent(Object, int)
* @serial the identifier number of this event
*/ */
protected int id; protected int id;
/** /**
* Mask for selecting component events. * Indicates if the event has been consumed. False mean it is passed to
*/ * the peer, true means it has already been processed. Semantic events
public static final long COMPONENT_EVENT_MASK = 0x001; * generated by low-level events always have the value true.
*
* @see #consume()
* @see #isConsumed()
* @serial whether the event has been consumed
*/
protected boolean consumed;
/** /**
* Mask for selecting container events. * Who knows? It's in the serial version.
*/ *
public static final long CONTAINER_EVENT_MASK = 0x002; * @serial No idea what this is for.
*/
byte[] bdata;
/** Mask for selecting component events. */
public static final long COMPONENT_EVENT_MASK = 0x00001;
/** Mask for selecting container events. */
public static final long CONTAINER_EVENT_MASK = 0x00002;
/** Mask for selecting component focus events. */
public static final long FOCUS_EVENT_MASK = 0x00004;
/** Mask for selecting keyboard events. */
public static final long KEY_EVENT_MASK = 0x00008;
/** Mask for mouse button events. */
public static final long MOUSE_EVENT_MASK = 0x00010;
/** Mask for mouse motion events. */
public static final long MOUSE_MOTION_EVENT_MASK = 0x00020;
/** Mask for window events. */
public static final long WINDOW_EVENT_MASK = 0x00040;
/** Mask for action events. */
public static final long ACTION_EVENT_MASK = 0x00080;
/** Mask for adjustment events. */
public static final long ADJUSTMENT_EVENT_MASK = 0x00100;
/** Mask for item events. */
public static final long ITEM_EVENT_MASK = 0x00200;
/** Mask for text events. */
public static final long TEXT_EVENT_MASK = 0x00400;
/** /**
* Mask for selecting component focus events. * Mask for input method events.
*/ * @since 1.3
public static final long FOCUS_EVENT_MASK = 0x004; */
public static final long INPUT_METHOD_EVENT_MASK = 0x00800;
/** /**
* Mask for selecting keyboard events. * Mask if input methods are enabled. Package visible only.
*/ */
public static final long KEY_EVENT_MASK = 0x008; static final long INPUT_ENABLED_EVENT_MASK = 0x01000;
/** /**
* Mask for mouse button events. * Mask for paint events.
*/ * @since 1.3
public static final long MOUSE_EVENT_MASK = 0x010; */
public static final long PAINT_EVENT_MASK = 0x02000;
/** /**
* Mask for mouse motion events. * Mask for invocation events.
*/ * @since 1.3
public static final long MOUSE_MOTION_EVENT_MASK = 0x020; */
public static final long INVOCATION_EVENT_MASK = 0x04000;
/** /**
* Mask for window events. * Mask for hierarchy events.
*/ * @since 1.3
public static final long WINDOW_EVENT_MASK = 0x040; */
public static final long HIERARCHY_EVENT_MASK = 0x08000;
/** /**
* Mask for action events. * Mask for hierarchy bounds events.
*/ * @since 1.3
public static final long ACTION_EVENT_MASK = 0x080; */
public static final long HIERARCHY_BOUNDS_EVENT_MASK = 0x10000;
/** /**
* Mask for adjustment events. * Mask for mouse wheel events.
*/ * @since 1.4
public static final long ADJUSTMENT_EVENT_MASK = 0x100; */
public static final long MOUSE_WHEEL_EVENT_MASK = 0x20000;
/** /**
* Mask for item events. * Mask for window state events.
*/ * @since 1.4
public static final long ITEM_EVENT_MASK = 0x200; */
public static final long WINDOW_STATE_EVENT_MASK = 0x40000;
/** /**
* Mask for text events. * Mask for window focus events.
*/ * @since 1.4
public static final long TEXT_EVENT_MASK = 0x400; */
public static final long WINDOW_FOCUS_EVENT_MASK = 0x80000;
/** /**
* This is the highest number for event ids that are reserved for use by * This is the highest number for event ids that are reserved for use by
* the AWT system itself. * the AWT system itself. Subclasses outside of java.awt should use higher
* ids.
*/ */
public static final int RESERVED_ID_MAX = 1999; public static final int RESERVED_ID_MAX = 1999;
public static final long 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;
/** /**
* Initializes a new instance of <code>AWTEvent</code> from the * Initializes a new AWTEvent from the old Java 1.0 event object.
* specified Java 1.0 event object.
*
* @param event The Java 1.0 event to initialize from.
*
*
* Removed this method because we no longer support Java 1.0
* *
* @param event the old-style event
* @throws NullPointerException if event is null
*/ */
public AWTEvent(Event event) public AWTEvent(Event event)
{ {
// FIXME?? this(event.target, event.id);
super(event.target); consumed = event.consumed;
this.id = event.id;
} }
/** /**
* Initializes a new instance of <code>AWTEvent</code> with the specified * Create an event on the specified source object and id.
* source and id.
* *
* @param source The object that caused the event. * @param source the object that caused the event
* @param id The event id. * @param id the event id
* @throws IllegalArgumentException if source is null
*/ */
public AWTEvent(Object source, int id) public AWTEvent(Object source, int id)
{ {
...@@ -162,9 +209,21 @@ public abstract class AWTEvent extends java.util.EventObject ...@@ -162,9 +209,21 @@ public abstract class AWTEvent extends java.util.EventObject
} }
/** /**
* Returns the id number of this event. * Retarget the event, such as converting a heavyweight component to a
* lightweight child of the original. This is not for general use, but
* is for event targeting systems like KeyboardFocusManager.
* *
* @return The id number of this event. * @param source the new source
*/
public void setSource(Object source)
{
this.source = source;
}
/**
* Returns the event type id.
*
* @return the id number of this event
*/ */
public int getID() public int getID()
{ {
...@@ -172,23 +231,26 @@ public abstract class AWTEvent extends java.util.EventObject ...@@ -172,23 +231,26 @@ public abstract class AWTEvent extends java.util.EventObject
} }
/** /**
* Returns a string representation of this event. * Returns a string representation of this event. This is in the format
* <code>getClass().getName() + '[' + paramString() + "] on "
* + source</code>.
* *
* @return A string representation of this event. * @return a string representation of this event
*/ */
public String paramString () public String toString()
{ {
return ""; return getClass().getName() + "[" + paramString() + "] on " + source;
} }
/** /**
* Returns a string representation of this event. * Returns a string representation of the state of this event. It may be
* empty, but must not be null; it is implementation defined.
* *
* @return A string representation of this event. * @return a string representation of this event
*/ */
public String toString () public String paramString()
{ {
return getClass().getName() + "[" + paramString() + "] on " + source; return "";
} }
/** /**
...@@ -201,14 +263,13 @@ public abstract class AWTEvent extends java.util.EventObject ...@@ -201,14 +263,13 @@ public abstract class AWTEvent extends java.util.EventObject
} }
/** /**
* Tests whether not not this event has been consumed. A consumed event * Tests whether not not this event has been consumed. A consumed event
* is not processed in the default manner. * is not processed in the default manner.
* *
* @return <code>true</code> if this event has been consumed, * @return true if this event has been consumed
* <code>false</code> otherwise.
*/ */
protected boolean isConsumed() protected boolean isConsumed()
{ {
return consumed; return consumed;
} }
} } // class AWTEvent
/* AWTException.java -- Generic AWT exception /* AWTException.java -- Generic AWT exception
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -39,25 +39,26 @@ exception statement from your version. */ ...@@ -39,25 +39,26 @@ exception statement from your version. */
package java.awt; package java.awt;
/** /**
* This is a generic exception that indicates an error occurred in the * This is a generic exception that indicates an exception occurred in the
* AWT system. * Abstract Window Toolkit (AWT) system.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn <arenn@urbanophile.com>
*/ * @status updated to 1.4
*/
public class AWTException extends Exception public class AWTException extends Exception
{ {
/**
* Compatible with JDK 1.0+.
*/
private static final long serialVersionUID = -1900414231151323879L;
/** /**
* Initializes a new instance of <code>AWTException</code> with the * Create a new instance with the specified detailed error message.
* specified detailed error message. *
* * @param message the detailed error message
* @param message The detailed error message. */
*/ public AWTException(String message)
public {
AWTException(String message) super(message);
{ }
super(message); } // class AWTException
}
} // class AWTException
// AWTPermission.java - AWT permissions /* AWTPermission.java -- AWT related permissions
Copyright (C) 2000, 2002 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -37,11 +36,6 @@ obligated to do so. If you do not wish to do so, delete this ...@@ -37,11 +36,6 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
/**
* @author Tom Tromey <tromey@redhat.com>
* @date December 2, 2000
*/
package java.awt; package java.awt;
import java.security.BasicPermission; import java.security.BasicPermission;
...@@ -49,25 +43,79 @@ import java.security.BasicPermission; ...@@ -49,25 +43,79 @@ import java.security.BasicPermission;
/** /**
* This class implements permissions for AWT. This is a named * This class implements permissions for AWT. This is a named
* permission. No actions are defined. * permission. No actions are defined.
*
* <p>The following table provides a list of all the possible AWTPermission
* permission names with a description of what that permission allows.<br>
* <table border=1>
* <tr><th>Permission Name</th><th>Permission Allows</th><th>Risks</th</tr>
* <tr>
* <td><code>accessClipboard</code></td>
* <td>posting and reading the AWT clipboard</td>
* <td>the clipboard may contain sensitive data</td></tr>
* <tr>
* <td><code>accessEventQueue</code></td>
* <td>access to the AWT event queue</td>
* <td>malicious code could remove real events and replace them with bogus
* ones, including simulating the user granting permission</td></tr>
* <tr>
* <td><code>listenToAllAWTEvents</code></td>
* <td>listen to system-wide AWT events</td>
* <td>malicious code can read passwords entered in an AWT event, and in
* combination with accessEventQueue, could fake system events</td></tr>
* <tr>
* <td><code>showWindowWithoutWarningBanner</code></td>
* <td>display a window without a banner notification of insecurity</td>
* <td>malicious code could install a Trojan horse applet that looks like
* a normal window, and thus steal data like passwords</td></tr>
* <tr>
* <td><code>readDisplayPixels</code></td>
* <td>read back pixels from the display screen</td>
* <td>malicious code could snoop on the user's actions</td></tr>
* <tr>
* <td><code>createRobot</code></td>
* <td>create an instance of java.awt.Robot</td>
* <td>these objects can generate events as though they were the user; so
* malicious code could control the system</td></tr>
* <tr>
* <td><code>fullScreenExclusive</code></td>
* <td>enter full-screen exclusive mode</td>
* <td>malicious code could masquerade as a trusted program</td><tr>
* </table>
*
* @author Tom Tromey <tromey@redhat.com>
* @since 1.2
* @status updated to 1.4
*/ */
public final class AWTPermission extends BasicPermission public final class AWTPermission extends BasicPermission
{ {
/** /**
* Compatible with JDK 1.2+.
*/
private static final long serialVersionUID = 8890392402588814465L;
/**
* Construct a AWTPermission with the given name. * Construct a AWTPermission with the given name.
* @param name The permission name *
* @param name the permission name
* @throws NullPointerException if name is null
* @throws IllegalArgumentException if name is invalid
*/ */
public AWTPermission (String name) public AWTPermission(String name)
{ {
super (name); super(name);
} }
/** /**
* Construct a AWTPermission with the given name. * Create a new permission with the specified name. The actions argument
* @param name The permission name * is ignored, as AWT permissions have no actions.
* @param actions The actions; this is ignored and should be null. *
* @param name the permission name
* @param actions ignored
* @throws NullPointerException if name is null
* @throws IllegalArgumentException if name is invalid
*/ */
public AWTPermission (String name, String actions) public AWTPermission(String name, String actions)
{ {
super (name, actions); super(name);
} }
} } // class AWTPermission
/* Copyright (C) 2000, 2002 Free Software Foundation /* ActiveEvent.java -- a self-dispatching event
Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -38,13 +39,23 @@ exception statement from your version. */ ...@@ -38,13 +39,23 @@ exception statement from your version. */
package java.awt; package java.awt;
/** /**
* An interface for events which can dispatch themselves in another thread.
* This has two uses: first, if your code is in a critical section, calling a
* synchronized method might deadlock. But by using an ActiveEvent to call
* the second section, it will not obtain the lock until you have left the
* critical section, avoiding deadlock. The second use is for calling
* untrusted code. For example, system code should use an ActiveEvent to
* invoke user code securely.
*
* @author Tom Tromey <tromey@cygnus.com> * @author Tom Tromey <tromey@cygnus.com>
* @date April 8, 2000 * @since 1.2
* @status updated to 1.4
*/ */
/* Status: Believed complete and correct to JDK 1.2. */
public interface ActiveEvent public interface ActiveEvent
{ {
public void dispatch (); /**
} * Dispatch the event, according to what the event needs done. Invoked
* automatically if this is placed on the <code>EventDispatchQueue</code>.
*/
public void dispatch();
} // interface ActiveEvent
/* Adjustable.java -- Objects with a numeric adjustment scale. /* Adjustable.java -- Objects with a numeric adjustment scale
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -41,183 +41,131 @@ package java.awt; ...@@ -41,183 +41,131 @@ package java.awt;
import java.awt.event.AdjustmentListener; import java.awt.event.AdjustmentListener;
/** /**
* This interface is for objects that take a numeric value that * This interface is for objects that take a numeric value that can be
* can be adjusted within a bounded range. For example, a scroll bar. * adjusted within a bounded range. For example, a scroll bar.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn <arenn@urbanophile.com>
*/ * @since 1.0
* @status updated to 1.4
*/
public interface Adjustable public interface Adjustable
{ {
/** Constant for an adjustable object with horizontal orientation. */
/* int HORIZONTAL = 0;
* Static Variables
*/ /** Constant for an adjustable object with vertical orientation. */
int VERTICAL = 1;
/**
* Constant for a horizontal orientation /** Constant for an adjustable object with no orientation. */
*/ int NO_ORIENTATION = 2;
public static final int HORIZONTAL = 0;
/**
/** * Returns a constant representing the orientation of the object.
* Constant for a vertical orientation *
*/ * @return the orientation of this object
public static final int VERTICAL = 1; * @see #HORIZONTAL
* @see #VERTICAL
/*************************************************************************/ * @see #NO_ORIENTATION
*/
/* int getOrientation();
* Instance Methods
*/ /**
* Sets the minimum value this object can have.
/** *
* Returns the current value of the object. * @param minimum the new minimum value
* */
* @return The current value of the object. void setMinimum(int minimum);
*/
public abstract int /**
getValue(); * Returns the minimum value this object can have.
*
/*************************************************************************/ * @return the minimum value
*/
/** int getMinimum();
* Sets the current value of the object.
* /**
* @param value The current value of the object. * Sets the maximum value this object can have.
*/ *
public abstract void * @param maximum the new maximum value
setValue(int value); */
void setMaximum(int maximum);
/*************************************************************************/
/**
/** * Returns the maximum value this object can have.
* Returns the orientation of the object, either <code>HORIZONTAL</code> *
* or <code>VERTICAL</code>. * @return the maximum value
* */
* @return The orientation of this object. int getMaximum();
*/
public abstract int /**
getOrientation(); * Sets the increment value for incrementing the value by units.
*
/*************************************************************************/ * @param increment the unit increment value
*/
/** void setUnitIncrement(int increment);
* Returns the minimum value this object can take.
* /**
* @return The minimum value this object can take. * Returns the increment value for incrementing the value by units.
*/ *
public abstract int * @return the unit increment value
getMinimum(); */
int getUnitIncrement();
/*************************************************************************/
/**
/** * Sets the increment value for incrementing the value by blocks.
* Sets the minimum value this object can take to the specified value. *
* * @param increment the block increment value
* @param minimum The new minimum value for this object. */
*/ void setBlockIncrement(int increment);
public abstract void
setMinimum(int minimum); /**
* Returns the increment value for incrementing the value by blocks.
/*************************************************************************/ *
* @return the block increment value
/** */
* Returns the maximum value this object can take. int getBlockIncrement();
*
* @return The maximum value this object can take. /**
*/ * Sets the length of the indicator for this object to the specified value.
public abstract int *
getMaximum(); * @param length the indicator length
*/
/*************************************************************************/ void setVisibleAmount(int length);
/** /**
* Sets the maximum value this object can take to the specified value. * Returns the length of the indicator for this object.
* *
* @param maximum The new maximum value for this object. * @return the indicator length
*/ */
public abstract void int getVisibleAmount();
setMaximum(int maximum);
/**
/*************************************************************************/ * Sets the current value of the object.
*
/** * @param value the new value
* Returns the increment value for incrementing by units. */
* void setValue(int value);
* @return The unit increment value.
*/ /**
public abstract int * Returns the current value of the object.
getUnitIncrement(); *
* @return the current value
/*************************************************************************/ */
int getValue();
/**
* Sets the increment value for incrementing by units to the specified value. /**
* * Adds a listener that will receive adjustment events for this object.
* @param increment The unit increment value. *
*/ * @param listener the adjustment listener to add
public abstract void * @see AdjustmentEvent
setUnitIncrement(int increment); */
void addAdjustmentListener(AdjustmentListener listener);
/*************************************************************************/
/**
/** * Removes an adjustment listener from this object.
* Returns the increment value for incrementing by blocks. *
* * @param listener the adjustment listener to remove
* @return The block increment value. * @see AdjustmentEvent
*/ */
public abstract int void removeAdjustmentListener(AdjustmentListener listener);
getBlockIncrement();
/*************************************************************************/
/**
* Sets the increment value for incrementing by blocks to the specified value.
*
* @param increment The block increment value.
*/
public abstract void
setBlockIncrement(int increment);
/*************************************************************************/
/**
* Returns the length of the indicator for this object.
*
* @return The indicator length.
*/
public abstract int
getVisibleAmount();
/*************************************************************************/
/**
* Sets the length of the indicator for this object to the specified value.
*
* @param length The indicator length
*/
public abstract void
setVisibleAmount(int length);
/*************************************************************************/
/**
* Adds a listener that will receive adjustment events for this object.
*
* @param listener The adjustment listener to add.
*/
public abstract void
addAdjustmentListener(AdjustmentListener listener);
/*************************************************************************/
/**
* Removes an adjustment listener from this object. It will no longer
* receive adjustment events.
*
* @param listener The adjustment listener to remove.
*/
public abstract void
removeAdjustmentListener(AdjustmentListener listener);
} // interface Adjustable } // interface Adjustable
/* AlphaComposite.java -- provides a context for performing alpha compositing
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
import java.awt.image.ColorModel;
import java.util.LinkedHashMap;
import java.util.Map;
/**
*
* @author Eric Blake <ebb9@email.byu.edu>
* @see Composite
* @see CompositeContext
* @since 1.3
* @status updated to 1.4 except for createContext, needs documentation
*/
public final class AlphaComposite implements Composite
{
/** Map Long to AlphaComposites. See getInstance for details. */
private static final LinkedHashMap cache = new LinkedHashMap(11, 0.75f, true)
{
/** The largest the alpha composite cache can grow. */
private static final int MAX_CACHE_SIZE = 2048;
/** Prune stale entries. */
protected boolean removeEldestEntry(Map.Entry eldest)
{ // XXX - FIXME Use Map.Entry, not just Entry as gcj 3.1 workaround.
return size() > MAX_CACHE_SIZE;
}
};
public static final int CLEAR = 1;
public static final int SRC = 2;
public static final int DST = 9;
public static final int SRC_OVER = 3;
public static final int DST_OVER = 4;
public static final int SRC_IN = 5;
public static final int DST_IN = 6;
public static final int SRC_OUT = 7;
public static final int DST_OUT = 8;
public static final int SRC_ATOP = 10;
public static final int DST_ATOP = 11;
public static final int XOR = 12;
public static final AlphaComposite Clear = getInstance(CLEAR);
public static final AlphaComposite Src = getInstance(SRC);
public static final AlphaComposite Dst = getInstance(DST);
public static final AlphaComposite SrcOver = getInstance(SRC_OVER);
public static final AlphaComposite DstOver = getInstance(DST_OVER);
public static final AlphaComposite SrcIn = getInstance(SRC_IN);
public static final AlphaComposite DstIn = getInstance(DST_IN);
public static final AlphaComposite SrcOut = getInstance(SRC_OUT);
public static final AlphaComposite DstOut = getInstance(DST_OUT);
public static final AlphaComposite SrcAtop = getInstance(SRC_ATOP);
public static final AlphaComposite DstAtop = getInstance(DST_ATOP);
public static final AlphaComposite Xor = getInstance(XOR);
private final int rule;
private final float alpha;
private AlphaComposite(int rule, float alpha)
{
this.rule = rule;
this.alpha = alpha;
}
public static AlphaComposite getInstance(int rule)
{
return getInstance(rule, 1);
}
public static AlphaComposite getInstance(int rule, float alpha)
{
if (rule < CLEAR || rule > XOR || ! (alpha >= 0 && alpha <= 1))
throw new IllegalArgumentException();
// This long is guaranteed unique for all valid alpha composites.
Long l = new Long(rule + Double.doubleToLongBits(alpha));
AlphaComposite a = (AlphaComposite) cache.get(l);
if (a == null)
{
a = new AlphaComposite(rule, alpha);
cache.put(l, a);
}
return a;
}
public CompositeContext createContext(ColorModel srcColorModel,
ColorModel dstColorModel,
RenderingHints hints)
{
// XXX Implement. Sun uses undocumented implementation class
// sun.java2d.SunCompositeContext.
throw new Error("not implemented");
}
public float getAlpha()
{
return alpha;
}
public int getRule()
{
return rule;
}
public int hashCode()
{
return 31 * Float.floatToIntBits(alpha) + rule;
}
public boolean equals(Object o)
{
if (! (o instanceof AlphaComposite))
return false;
AlphaComposite a = (AlphaComposite) o;
return rule == a.rule && alpha == a.alpha;
}
} // class AlphaComposite
/* AttributeValue.java -- parent of type-safe enums of attributes
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
/**
* This class is undocumented by Sun, but it is the parent of several other
* classes, all of which are type-safe enumerations. This takes care of
* <code>equals</code>, <code>toString</code>, and <code>hashCode</code>, so
* that you don't have to (although hashCode is commonly overridden).
*
* @author Eric Blake <ebb9@email.byu.edu>
*/
class AttributeValue
{
/** The value of the enumeration. Package visible for speed. */
final int value;
/** The list of enumeration names for the given subclass. */
private final String[] names;
/**
* Construct a type-safe enumeration element. For example,<br>
* <pre>
* class Foo extends AttributeValue
* {
* private static final String[] names = { "one", "two" }
* public static final Foo ONE = new Foo(0);
* public static final Foo TWO = new Foo(1);
* private Foo(int value) { super(value, names); }
* }
* </pre>
*
* @param value the position of this enumeration element, consecutive from 0
* @param names the constant list of enumeration names for the subclass
*/
AttributeValue(int value, String[] names)
{
this.value = value;
this.names = names;
}
/**
* Returns the hashcode of this element. This is the index of the element
* in the enumeration. Note that equals defaults to the == relation.
*
* @return the hashcode
*/
public int hashCode()
{
return value;
}
/**
* Returns the name of this enumeration element.
*
* @return the element name
*/
public String toString()
{
return names[value];
}
} // class AttributeValue
/* BasicStroke.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
import java.util.Arrays;
/**
* STUB CLASS ONLY
*/
public class BasicStroke implements Stroke
{
public static final int JOIN_MITER = 0;
public static final int JOIN_ROUND = 1;
public static final int JOIN_BEVEL = 2;
public static final int CAP_BUTT = 0;
public static final int CAP_ROUND = 1;
public static final int CAP_SQUARE = 2;
private final float width;
private final int cap;
private final int join;
private final float limit;
private final float[] dash;
private final float phase;
public BasicStroke(float width, int cap, int join, float miterlimit,
float[] dash, float dashPhase)
{
if (width < 0 || miterlimit < 1 || cap < CAP_BUTT || cap > CAP_SQUARE
|| join < JOIN_MITER || join > JOIN_BEVEL)
throw new IllegalArgumentException();
this.width = width;
this.cap = cap;
this.join = join;
limit = miterlimit;
this.dash = dash == null ? null : (float[]) dash.clone();
phase = dashPhase;
}
public BasicStroke(float width, int cap, int join, float miterlimit)
{
this(width, cap, join, miterlimit, null, 0);
}
public BasicStroke(float width, int cap, int join)
{
this(width, cap, join, 10, null, 0);
}
public BasicStroke(float width)
{
this(width, CAP_SQUARE, JOIN_MITER, 10, null, 0);
}
public BasicStroke()
{
this(1, CAP_SQUARE, JOIN_MITER, 10, null, 0);
}
public Shape createStrokedShape(Shape s)
{
throw new Error("not implemented");
}
public float getLineWidth()
{
return width;
}
public int getEndCap()
{
return cap;
}
public int getLineJoin()
{
return join;
}
public float getMiterLimit()
{
return limit;
}
public float[] getDashArray()
{
return dash;
}
public float getDashPhase()
{
return phase;
}
public int hashCode()
{
throw new Error("not implemented");
}
public boolean equals(Object o)
{
if (! (o instanceof BasicStroke))
return false;
BasicStroke s = (BasicStroke) o;
return width == s.width && cap == s.cap && join == s.join
&& limit == s.limit && Arrays.equals(dash, s.dash) && phase == s.phase;
}
} // class BasicStroke
...@@ -77,27 +77,107 @@ public static final String WEST = "West"; ...@@ -77,27 +77,107 @@ public static final String WEST = "West";
*/ */
public static final String CENTER = "Center"; public static final String CENTER = "Center";
/**
* Constant indicating the position just after the last line of the
* layout.
*/
public static final String AFTER_LAST_LINE = "Last";
/** /**
* Constant indicating the position just after the end of the line. * The constant indicating the position before the first line of the
*/ * layout. The exact position depends on the writing system: For a
public static final String AFTER_LINE_ENDS = "After"; * top-to-bottom orientation, it is the same as {@link #NORTH}, for
* a bottom-to-top orientation, it is the same as {@link #SOUTH}.
*
* <p>This constant is an older name for {@link #PAGE_START} which
* has exactly the same value.
*
* @since 1.2
*/
public static final String BEFORE_FIRST_LINE = "First";
/**
* The constant indicating the position after the last line of the
* layout. The exact position depends on the writing system: For a
* top-to-bottom orientation, it is the same as {@link #SOUTH}, for
* a bottom-to-top orientation, it is the same as {@link #NORTH}.
*
* <p>This constant is an older name for {@link #PAGE_END} which
* has exactly the same value.
*
* @since 1.2
*/
public static final String AFTER_LAST_LINE = "Last";
/**
* The constant indicating the position before the first item of the
* layout. The exact position depends on the writing system: For a
* left-to-right orientation, it is the same as {@link #WEST}, for
* a right-to-left orientation, it is the same as {@link #EAST}.
*
* <p>This constant is an older name for {@link #LINE_START} which
* has exactly the same value.
*
* @since 1.2
*/
public static final String BEFORE_LINE_BEGINS = "Before";
/**
* The constant indicating the position after the last item of the
* layout. The exact position depends on the writing system: For a
* left-to-right orientation, it is the same as {@link #EAST}, for
* a right-to-left orientation, it is the same as {@link #WEST}.
*
* <p>This constant is an older name for {@link #LINE_END} which
* has exactly the same value.
*
* @since 1.2
*/
public static final String AFTER_LINE_ENDS = "After";
/**
* The constant indicating the position before the first line of the
* layout. The exact position depends on the writing system: For a
* top-to-bottom orientation, it is the same as {@link #NORTH}, for
* a bottom-to-top orientation, it is the same as {@link #SOUTH}.
*
* @since 1.4
*/
public static final String PAGE_START = BEFORE_FIRST_LINE;
/**
* The constant indicating the position after the last line of the
* layout. The exact position depends on the writing system: For a
* top-to-bottom orientation, it is the same as {@link #SOUTH}, for
* a bottom-to-top orientation, it is the same as {@link #NORTH}.
*
* @since 1.4
*/
public static final String PAGE_END = AFTER_LAST_LINE;
/**
* The constant indicating the position before the first item of the
* layout. The exact position depends on the writing system: For a
* left-to-right orientation, it is the same as {@link #WEST}, for
* a right-to-left orientation, it is the same as {@link #EAST}.
*
* @since 1.4
*/
public static final String LINE_START = BEFORE_LINE_BEGINS;
/**
* The constant indicating the position after the last item of the
* layout. The exact position depends on the writing system: For a
* left-to-right orientation, it is the same as {@link #EAST}, for
* a right-to-left orientation, it is the same as {@link #WEST}.
*
* @since 1.4
*/
public static final String LINE_END = AFTER_LINE_ENDS;
/**
* Constant indicating the position just before the first line of the
* layout.
*/
public static final String BEFORE_FIRST_LINE = "First";
/**
* Constant indicating the position at the beginning of the line.
*/
public static final String BEFORE_LINE_BEGINS = "Before";
// Serialization constant // Serialization constant
private static final long serialVersionUID = -8658291919501921765L; private static final long serialVersionUID = -8658291919501921765L;
......
/* BufferCapabilities.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
/**
* Needs documentation...
*
* @author Eric Blake <ebb9@email.byu.edu>
* @see BufferStrategy#getCapabilities()
* @see GraphicsConfiguration#getCapabilities()
* @since 1.4
* @status updated to 1.4, lacks documentation
*/
public class BufferCapabilities implements Cloneable
{
public static final class FlipContents extends AttributeValue
{
private static final String[] NAMES
= { "undefined", "background", "prior", "copied" };
public static final FlipContents UNDEFINED = new FlipContents(0);
public static final FlipContents BACKGROUND = new FlipContents(1);
public static final FlipContents PRIOR = new FlipContents(2);
public static final FlipContents COPIED = new FlipContents(3);
private FlipContents(int value)
{
super(value, NAMES);
}
} // class FlipContents
private final ImageCapabilities front;
private final ImageCapabilities back;
private final FlipContents flip;
public BufferCapabilities(ImageCapabilities front, ImageCapabilities back,
FlipContents flip)
{
this.front = front;
this.back = back;
this.flip = flip;
if (front == null || back == null)
throw new IllegalArgumentException();
}
public ImageCapabilities getFrontBufferCapabilities()
{
return front;
}
public ImageCapabilities getBackBufferCapabilities()
{
return back;
}
public boolean isPageFlipping()
{
return flip != null;
}
public FlipContents getFlipContents()
{
return flip;
}
public boolean isFullScreenRequired()
{
return true;
}
public boolean isMultiBufferAvailable()
{
return false;
}
public Object clone()
{
try
{
return super.clone();
}
catch (CloneNotSupportedException e)
{
throw (Error) new InternalError().initCause(e); // Impossible
}
}
} // class BufferCapabilities
...@@ -42,6 +42,7 @@ import java.awt.event.ActionEvent; ...@@ -42,6 +42,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.peer.ButtonPeer; import java.awt.peer.ButtonPeer;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import java.lang.reflect.Array;
import java.util.EventListener; import java.util.EventListener;
/** /**
...@@ -200,13 +201,24 @@ removeActionListener(ActionListener listener) ...@@ -200,13 +201,24 @@ removeActionListener(ActionListener listener)
action_listeners = AWTEventMulticaster.remove(action_listeners, listener); action_listeners = AWTEventMulticaster.remove(action_listeners, listener);
} }
public EventListener[] public synchronized ActionListener[] getActionListeners()
getListeners(Class listenerType) {
{ return (ActionListener[])
if (listenerType == ActionListener.class) AWTEventMulticaster.getListeners(action_listeners,
return getListenersImpl(listenerType, action_listeners); ActionListener.class);
return super.getListeners(listenerType); }
}
/** 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 getActionListeners();
return (EventListener[]) Array.newInstance(listenerType, 0);
}
/*************************************************************************/ /*************************************************************************/
......
...@@ -234,7 +234,7 @@ remove(String item) ...@@ -234,7 +234,7 @@ remove(String item)
* *
* @param index The index of the item to remove. * @param index The index of the item to remove.
* *
* @exception ArrayIndexOutOfBoundException If the index is not valid. * @exception ArrayIndexOutOfBoundsException If the index is not valid.
*/ */
public synchronized void public synchronized void
remove(int index) remove(int index)
......
/* ColorPaintContext.java -- context for painting solid colors
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
import java.awt.image.ColorModel;
import java.awt.image.Raster;
/**
* This class provides a paint context which will fill a rectanglar region of
* a raster scan with the given color. However, it is not yet completely
* implemented.
*
* @author Eric Blake <ebb9@email.byu.edu>
*/
class ColorPaintContext implements PaintContext
{
/**
* The color to fill any raster with. Package visible for use in
* SystemColor.
*/
final int color;
/**
* Create the context for a given color.
*
* @param c the solid color to use
*/
ColorPaintContext(int c)
{
color = c;
}
/**
* Release the resources allocated for the paint. As the color is constant,
* there aren't any resources.
*/
public void dispose()
{
}
/**
* Return the color model of this context. This ignores the model passed
* in the request, since colors are always in sRGB.
*
* @return the context color model
*/
public ColorModel getColorModel()
{
return ColorModel.getRGBdefault();
}
/**
* Return a raster containing the colors for the graphics operation.
*
* @param x the x-coordinate, in device space
* @param y the y-coordinate, in device space
* @param w the width, in device space
* @param h the height, in device space
* @return a raster for the given area and color
*/
public Raster getRaster(int x, int y, int w, int h)
{
// XXX Implement. Sun uses undocumented implementation class
// sun.awt.image.IntegerInterleavedRaster.
throw new Error("not implemented");
}
} // class ColorPaintContext
This source diff could not be displayed because it is too large. You can view the blob instead.
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation /* ComponentOrientation.java -- describes a component's orientation
Copyright (C) 2000, 2001, 2002 Free Software Foundation
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -34,83 +35,179 @@ this exception to your version of the library, but you are not ...@@ -34,83 +35,179 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
/**
* @author Bryce McKinlay <bryce@albatross.co.nz>
*/
/* Status: Incomplete. Needs a Locale lookup table. */
package java.awt; package java.awt;
import java.io.Serializable;
import java.util.Locale; import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
public final class ComponentOrientation implements java.io.Serializable /**
* This class is used to differentiate different orientations for text layout.
* It controls whether text flows left-to-right or right-to-left, and whether
* lines are horizontal or vertical, as in this table:<br>
* <pre>
* LT RT TL TR
* A B C C B A A D G G D A
* D E F F E D B E H H E B
* G H I I H G C F I I F C
* </pre>
* <b>LT</b> languages are most common (left-to-right lines, top-to-bottom).
* This includes Western European languages, and optionally includes Japanese,
* Chinese, and Korean. <b>RT</b> languages (right-to-left lines,
* top-to-bottom) are mainly middle eastern, such as Hebrew and Arabic.
* <b>TR</b> languages flow top-to-bottom in a line, right-to-left, and are
* the basis of Japanese, Chinese, and Korean. Finally, <b>TL</b> languages
* flow top-to-bottom in a line, left-to-right, as in Mongolian.
*
* <p>This is a pretty poor excuse for a type-safe enum, since it is not
* guaranteed that orientation objects are unique (thanks to serialization),
* yet there is no equals() method. You would be wise to compare the output
* of isHorizontal() and isLeftToRight() rather than comparing objects with
* ==, especially since more constants may be added in the future.
*
* @author Bryce McKinlay <bryce@albatross.co.nz>
* @since 1.0
* @status updated to 1.4
*/
public final class ComponentOrientation implements Serializable
{ {
// Here is a wild guess. /**
private static int HORIZONTAL_ID = 1 << 0, * Compatible with JDK 1.0+.
LEFT_TO_RIGHT_ID = 1 << 1; */
private static final long serialVersionUID = -4113291392143563828L;
/** Constant for unknown orientation. */
private static final int UNKNOWN_ID = 1;
/** Constant for horizontal line orientation. */
private static final int HORIZONTAL_ID = 2;
/** Constant for left-to-right orientation. */
private static final int LEFT_TO_RIGHT_ID = 4;
/**
* Items run left to right, and lines flow top to bottom. Examples: English,
* French.
*/
public static final ComponentOrientation LEFT_TO_RIGHT public static final ComponentOrientation LEFT_TO_RIGHT
= new ComponentOrientation(HORIZONTAL_ID & LEFT_TO_RIGHT_ID); = new ComponentOrientation(HORIZONTAL_ID | LEFT_TO_RIGHT_ID);
/**
* Items run right to left, and lines flow top to bottom. Examples: Arabic,
* Hebrew.
*/
public static final ComponentOrientation RIGHT_TO_LEFT public static final ComponentOrientation RIGHT_TO_LEFT
= new ComponentOrientation(HORIZONTAL_ID); = 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;
ComponentOrientation(int orientation) /**
* The orientation is unknown for the locale. For backwards compatibility,
* this behaves like LEFT_TO_RIGHT in the instance methods.
*/
public static final ComponentOrientation UNKNOWN
= new ComponentOrientation(UNKNOWN_ID | HORIZONTAL_ID | LEFT_TO_RIGHT_ID);
/**
* The orientation of this object; bitwise-or of unknown (1), horizontal (2),
* and left-to-right (4).
*
* @serial the orientation
*/
private final int orientation;
/**
* Construct a given orientation.
*
* @param orientation the orientation
*/
private ComponentOrientation(int orientation)
{ {
this.orientation = orientation; this.orientation = orientation;
} }
/**
* Returns true if the lines are horizontal, in which case lines flow
* top-to-bottom. For example, English, Hebrew. Counterexamples: Japanese,
* Chinese, Korean, Mongolian.
*
* @return true if this orientation has horizontal lines
*/
public boolean isHorizontal() public boolean isHorizontal()
{ {
return ((orientation & HORIZONTAL_ID) != 0); return (orientation & HORIZONTAL_ID) != 0;
} }
/**
* If isHorizontal() returns true, then this determines whether items in
* the line flow left-to-right. If isHorizontal() returns false, items in
* a line flow top-to-bottom, and this determines if lines flow
* left-to-right.
*
* @return true if this orientation flows left-to-right
*/
public boolean isLeftToRight() public boolean isLeftToRight()
{ {
return ((orientation & LEFT_TO_RIGHT_ID) != 0); return (orientation & LEFT_TO_RIGHT_ID) != 0;
} }
/**
* Gets an orientation appropriate for the locale.
*
* @param locale the locale
* @return the orientation for that locale
* @throws NullPointerException if locale is null
*/
public static ComponentOrientation getOrientation(Locale locale) public static ComponentOrientation getOrientation(Locale locale)
{ {
// FIXME: Use a table to look this up. // Based on iterating over all languages defined in JDK 1.4, this behavior
// matches Sun's. However, it makes me wonder if any non-horizontal
// orientations even exist, as it sure contradicts their documentation.
String language = locale.getLanguage();
if ("ar".equals(language) || "fa".equals(language) || "iw".equals(language)
|| "ur".equals(language))
return RIGHT_TO_LEFT;
return LEFT_TO_RIGHT; return LEFT_TO_RIGHT;
} }
/**
* Gets an orientation from a resource bundle. This tries the following:<ol>
* <li>Use the key "Orientation" to find an instance of ComponentOrientation
* in the bundle.</li>
* <li>Get the locale of the resource bundle, and get the orientation of
* that locale.</li>
* <li>Give up and get the orientation of the default locale.<li>
* <ol>
*
* @param bdl the bundle to use
* @return the orientation
* @throws NullPointerException if bdl is null
* @deprecated use {@link #getOrientation(Locale)} instead
*/
public static ComponentOrientation getOrientation(ResourceBundle bdl) public static ComponentOrientation getOrientation(ResourceBundle bdl)
{ {
ComponentOrientation r; ComponentOrientation r;
try try
{ {
Object obj = bdl.getObject("Orientation"); r = (ComponentOrientation) bdl.getObject("Orientation");
r = (ComponentOrientation) obj; if (r != null)
if (r != null) return r;
return r; }
} catch (MissingResourceException ignored)
catch (Exception x) {
{ }
// Fall through catch (ClassCastException ignored)
} {
}
try try
{ {
Locale l = bdl.getLocale(); r = getOrientation(bdl.getLocale());
r = getOrientation(l); if (r != null)
if (r != null) return r;
return r; }
} catch (Exception ignored)
catch (Exception x) {
{ }
// Fall through return getOrientation(Locale.getDefault());
}
return (getOrientation (Locale.getDefault ()));
} }
} } // class ComponentOrientation
/* Composite.java -- graphics formed from composite layers
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
import java.awt.image.ColorModel;
/**
* This interface is for graphics which are formed as composites of others.
* It combines {@link Graphics2D} shapes according to defined rules to form
* the new image. Implementations of this interface must be immutable, because
* they are not cloned when a Graphics2D container is cloned.
*
* <p>Since this can expose pixels to untrusted code, there is a security
* check on custom objects, <code>readDisplayPixels</code>, to prevent leaking
* restricted information graphically.
*
* @author Eric Blake <ebb9@email.byu.edu>
* @see AlphaComposite
* @see CompositeContext
* @see Graphics2D#setComposite(Composite)
* @since 1.2
* @status updated to 1.4
*/
public interface Composite
{
/**
* Create a context state for performing the compositing operation. Several
* contexts may exist for this object, in a multi-threaded environment.
*
* @param srcColorModel the color model of the source
* @param dstColorModel the color model of the destination
* @param hints hints for choosing between rendering alternatives
*/
CompositeContext createContext(ColorModel srcColorModel,
ColorModel dstColorModel,
RenderingHints hints);
} // interface Composite
/* Composite.java -- the context for compositing graphics layers
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
/**
* This interface provides an optimized environment for compositing graphics.
* Several such contexts may exist for a given <code>Composite</code> object.
*
* @author Eric Blake <ebb9@email.byu.edu>
* @see Composite
* @since 1.2
* @status updated to 1.4
*/
public interface CompositeContext
{
/**
* Release resources allocated for the compositing.
*/
void dispose();
/**
* Compose the two source images into the composite image. The destination
* can be the same as one of the two inputs, and the destination must be
* compatible with the ColorModel chosen in {@link Composite#createContext}.
*
* @param src the lower image source in compositing
* @param dstIn the upper image source in compositing
* @param dstOut the destination for the composite
* @see Composite
*/
void compose(Raster src, Raster dstIn, WritableRaster dstOut);
} // interface CompositeContext
/* ContainerOrderFocusTraversalPolicy.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
import java.io.Serializable;
/**
* STUB CLASS ONLY
*/
public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
implements Serializable
{
private boolean downCycle = true;
public ContainerOrderFocusTraversalPolicy()
{
throw new Error("not implemented");
}
public Component getComponentAfter(Container root, Component current)
{
return null;
}
public Component getComponentBefore(Container root, Component current)
{
return null;
}
public Component getFirstComponent(Container root)
{
return null;
}
public Component getLastComponent(Container root)
{
return null;
}
public Component getDefaultComponent(Container root)
{
return null;
}
public void setImplicitDownCycleTraversal(boolean value)
{
downCycle = value;
}
public boolean getImplicitDownCycleTraversal()
{
return downCycle;
}
protected boolean accept(Component current)
{
return current.visible && current.isDisplayable() && current.enabled
&& current.focusable;
}
} // class ContainerOrderFocusTraversalPolicy
/* DefaultFocusTraversalPolicy.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
/**
* STUB CLASS ONLY
*/
public class DefaultFocusTraversalPolicy
extends ContainerOrderFocusTraversalPolicy
{
public DefaultFocusTraversalPolicy()
{
}
protected boolean accept(Component comp)
{
throw new Error("not implemented");
}
} // class DefaultFocusTraversalPolicy
/* DefaultKeyboardFocusManager.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
import java.awt.event.KeyEvent;
/**
* STUB CLASS ONLY
*/
public class DefaultKeyboardFocusManager extends KeyboardFocusManager
{
public DefaultKeyboardFocusManager()
{
}
public boolean dispatchEvent(AWTEvent e)
{
throw new Error("not implemented");
}
public boolean dispatchKeyEvent(KeyEvent e)
{
throw new Error("not implemented");
}
public boolean postProcessKeyEvent(KeyEvent e)
{
throw new Error("not implemented");
}
public void processKeyEvent(Component comp, KeyEvent e)
{
throw new Error("not implemented");
}
protected void enqueueKeyEvents(long after, Component comp)
{
throw new Error("not implemented");
}
protected void dequeueKeyEvents(long after, Component comp)
{
throw new Error("not implemented");
}
protected void discardKeyEvents(Component comp)
{
throw new Error("not implemented");
}
public void focusPreviousComponent(Component comp)
{
throw new Error("not implemented");
}
public void focusNextComponent(Component comp)
{
throw new Error("not implemented");
}
public void upFocusCycle(Component comp)
{
throw new Error("not implemented");
}
public void downFocusCycle(Container cont)
{
throw new Error("not implemented");
}
} // class DefaultKeyboardFocusManager
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation /* Dimension.java -- represents a 2-dimensional span
Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -37,136 +38,197 @@ exception statement from your version. */ ...@@ -37,136 +38,197 @@ exception statement from your version. */
package java.awt; package java.awt;
/* Written using "Java Class Libraries", 2nd edition, plus online import java.awt.geom.Dimension2D;
* API docs for JDK 1.2 beta from http://www.javasoft.com. import java.io.Serializable;
* Status: Believed complete and correct, except that neither toString
* has not been compared with JDK output.
*/
/** /**
* This class holds a width and height value pair. * This class holds a width and height value pair. This is used in plenty
* * of windowing classes, but also has geometric meaning.
* @author Per Bothner <bothner@cygnus.com> *
* @author Aaron M. Renn (arenn@urbanophile.com) * <p>It is valid for a dimension to have negative width or height; but it
* @date Fenruary 8, 1999. * is considered to have no area. Therefore, the behavior in various methods
*/ * is undefined in such a case.
public class Dimension extends java.awt.geom.Dimension2D *
implements java.io.Serializable * <p>There are some public fields; if you mess with them in an inconsistent
* manner, it is your own fault when you get invalid results. Also, this
* class is not threadsafe.
*
* @author Per Bothner <bothner@cygnus.com>
* @author Aaron M. Renn <arenn@urbanophile.com>
* @author Eric Blake <ebb9@email.byu.edu>
* @see Component
* @see LayoutManager
* @since 1.0
* @status updated to 1.14
*/
public class Dimension extends Dimension2D implements Serializable
{ {
/** /**
* This width of this object. * Compatible with JDK 1.0+.
*/
private static final long serialVersionUID = 4723952579491349524L;
/**
* The width of this object.
*
* @see #getSize()
* @see #setSize(double, double)
* @serial the width
*/ */
public int width; public int width;
/** /**
* The height of this object. * The height of this object.
*
* @see #getSize()
* @see #setSize(double, double)
* @serial the height
*/ */
public int height; public int height;
/** /**
* Initializes a new instance of <code>Dimension</code> with a width * Create a new Dimension with a width and height of zero.
* and height of zero.
*/ */
public Dimension () { } public Dimension()
{
}
/** /**
* Initializes a new instance of <code>Dimension</code> to have a width * Create a new Dimension with width and height identical to that of the
* and height identical to that of the specified dimension object. * specified dimension.
* *
* @param dim The <code>Dimension</code> to take the width and height from. * @param d the Dimension to copy
* @throws NullPointerException if d is null
*/ */
public Dimension (Dimension dim) public Dimension(Dimension d)
{ {
this.width = dim.width; width = d.width;
this.height = dim.height; height = d.height;
} }
/** /**
* Initializes a new instance of <code>Dimension</code> with the * Create a new Dimension with the specified width and height.
* specified width and height.
* *
* @param width The width of this object. * @param w the width of this object
* @param height The height of this object. * @param h the height of this object
*/ */
public Dimension (int width, int height) public Dimension(int w, int h)
{ {
this.width = width; width = w;
this.height = height; height = h;
} }
/** /**
* Tests this object for equality against the specified object. This will * Gets the width of this dimension.
* be true if and only if the specified object:
* <p>
* <ul>
* <li>Is not <code>null</code>.
* <li>Is an instance of <code>Dimension</code>.
* <li>Has width and height values identical to this object.
* </ul>
* *
* @param obj The object to test against. * @return the width, as a double
*/
public double getWidth()
{
return width;
}
/**
* Gets the height of this dimension.
* *
* @return <code>true</code> if the specified object is equal to this * @return the height, as a double
* object, <code>false</code> otherwise.
*/ */
public boolean equals (Object obj) public double getHeight()
{ {
if (! (obj instanceof Dimension)) return height;
return false;
Dimension dim = (Dimension) obj;
return height == dim.height && width == dim.width;
} }
/** /**
* Returns the size of this object. Not very useful. * Sets the size of this dimension. The values are rounded to int.
* *
* @return This object. * @param w the new width
* @param h the new height
* @since 1.2
*/ */
public Dimension getSize () { return new Dimension(this); } public void setSize(double w, double h)
{
width = (int) w;
height = (int) h;
}
/**
* Returns the size of this dimension. A pretty useless method, as this is
* already a dimension.
*
* @return a copy of this dimension
* @see #setSize(Dimension)
* @since 1.1
*/
public Dimension getSize()
{
return new Dimension(width, height);
}
/** /**
* Sets the width and height of this object to match that of the * Sets the width and height of this object to match that of the
* specified object. * specified object.
* *
* @param dim The <code>Dimension</code> object to get the new width and * @param d the Dimension to get the new width and height from
* height from. * @throws NullPointerException if d is null
* @see #getSize()
* @since 1.1
*/ */
public void setSize (Dimension dim) public void setSize(Dimension d)
{ {
this.width = dim.width; width = d.width;
this.height = dim.height; height = d.height;
} }
/** /**
* Sets the width and height of this object to the specified values. * Sets the width and height of this object to the specified values.
* *
* @param width The new width value. * @param w the new width value
* @param height The new height value. * @param h the new height value
*/ */
public void setSize (int width, int height) public void setSize(int w, int h)
{ {
this.width = width; width = w;
this.height = height; height = h;
} }
/** /**
* Returns a string representation of this object. * Tests this object for equality against the specified object. This will
* be true if and only if the specified object is an instance of
* Dimension2D, and has the same width and height.
* *
* @return A string representation of this object. * @param obj the object to test against
* @return true if the object is equal to this
*/ */
public String toString () public boolean equals(Object obj)
{ {
return "Dimension[w:"+width+",h:"+height+']'; if (! (obj instanceof Dimension))
return false;
Dimension dim = (Dimension) obj;
return height == dim.height && width == dim.width;
} }
/* Note: There is no Dimension.hashCode. */ /**
* Return the hashcode for this object. It is not documented, but appears
public double getWidth() { return width; } * to be <code>((width + height) * (width + height + 1) / 2) + width</code>.
public double getHeight() { return height; } *
* @return the hashcode
*/
public int hashCode()
{
// Reverse engineering this was fun!
return (width + height) * (width + height + 1) / 2 + width;
}
public void setSize (double width, double height) /**
* Returns a string representation of this object. The format is:
* <code>getClass().getName() + "[width=" + width + ",height=" + height
* + ']'</code>.
*
* @return a string representation of this object
*/
public String toString()
{ {
this.width = (int) width; return getClass().getName()
this.height = (int) height; + "[width=" + width + ",height=" + height + ']';
} }
} } // class Dimension
/* DisplayMode.java -- a description of display mode configurations
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
/**
* This encapsulates information about the display mode for a graphics
* device configuration. They are device dependent, and may not always be
* available.
*
* @author Eric Blake <ebb9@email.byu.edu>
* @see GraphicsDevice
* @since 1.4
* @status updated to 1.4
*/
public final class DisplayMode
{
/**
* Value of the bit depth if multiple depths are supported.
*
* @see #getBitDepth()
*/
public static final int BIT_DEPTH_MULTI = -1;
/**
* Value of an unknown refresh rate.
*
* @see #getRefreshRate()
*/
public static final int REFRESH_RATE_UNKNOWN = 0;
/** The width. */
private final int width;
/** The height. */
private final int height;
/** The bit depth. */
private final int bitDepth;
/** The refresh rate. */
private final int refreshRate;
/**
* Create a mode with the given parameters.
*
* @param width the width
* @param height the height
* @param bitDepth the bitDepth
* @param refreshRate the refreshRate
* @see #BIT_DEPTH_MULTI
* @see #REFRESH_RATE_UNKNOWN
*/
public DisplayMode(int width, int height, int bitDepth, int refreshRate)
{
this.width = width;
this.height = height;
this.bitDepth = bitDepth;
this.refreshRate = refreshRate;
}
/**
* Returns the height, in pixels.
*
* @return the height
*/
public int getHeight()
{
return height;
}
/**
* Returns the width, in pixels.
*
* @return the width
*/
public int getWidth()
{
return width;
}
/**
* Returns the bit depth, in bits per pixel. This may be BIT_DEPTH_MULTI.
*
* @return the bit depth
* @see #BIT_DEPTH_MULTI
*/
public int getBitDepth()
{
return bitDepth;
}
/**
* Returns the refresh rate, in hertz. This may be REFRESH_RATE_UNKNOWN.
*
* @return the refresh rate
* @see #REFRESH_RATE_UNKNOWN
*/
public int getRefreshRate()
{
return refreshRate;
}
/**
* Test for equality. This returns true for two modes with identical
* parameters.
*
* @param o the object to compare to
* @return true if it is equal
*/
public boolean equals(Object o)
{
if (! (o instanceof DisplayMode))
return false;
DisplayMode m = (DisplayMode) o;
return width == m.width && height == m.height && bitDepth == m.bitDepth
&& refreshRate == m.refreshRate;
}
/**
* Returns a hash code for the display mode.
*
* @return the hash code
*/
public int hashCode()
{
return width + height + bitDepth + refreshRate;
}
} // class DisplayMode
...@@ -320,4 +320,27 @@ public class EventQueue ...@@ -320,4 +320,27 @@ public class EventQueue
} }
} }
} }
}
/**
* Returns the timestamp of the most recent event that had a timestamp, or
* the initialization time of the event queue if no events have been fired.
* At present, only <code>InputEvent</code>s, <code>ActionEvent</code>s,
* <code>InputMethodEvent</code>s, and <code>InvocationEvent</code>s have
* timestamps, but this may be added to other events in future versions.
* If this is called by the event dispatching thread, it can be any
* (sequential) value, but to other threads, the safest bet is to return
* System.currentTimeMillis().
*
* @return the most recent timestamp
* @see InputEvent#getWhen()
* @see ActionEvent#getWhen()
* @see InvocationEvent#getWhen()
* @see InputMethodEvent#getWhen()
* @since 1.4
*/
public static long getMostRecentEventTime()
{
// XXX For now, this ONLY does the current time.
return System.currentTimeMillis();
}
} // class EventQueue
/* FocusTraversalPolicy.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
/**
* STUB CLASS ONLY
*/
public abstract class FocusTraversalPolicy
{
public FocusTraversalPolicy()
{
}
public abstract Component getComponentAfter(Container root,
Component current);
public abstract Component getComponentBefore(Container root,
Component current);
public abstract Component getFirstComponent(Container root);
public abstract Component getLastComponent(Container root);
public abstract Component getDefaultComponent(Container root);
public Component getInitialComponent(Window window)
{
return getDefaultComponent(window);
}
} // class FocusTraversalPolicy
...@@ -73,6 +73,66 @@ public static final int ROMAN_BASELINE = 0; ...@@ -73,6 +73,66 @@ public static final int ROMAN_BASELINE = 0;
public static final int CENTER_BASELINE = 1; public static final int CENTER_BASELINE = 1;
public static final int HANGING_BASELINE = 2; public static final int HANGING_BASELINE = 2;
/**
* Indicates to <code>createFont</code> that the supplied font data
* is in TrueType format.
*
* <p><em>Specification Note:</em> The Sun JavaDoc for J2SE 1.4 does
* not indicate whether this value also subsumes OpenType. OpenType
* is essentially the same format as TrueType, but allows to define
* glyph shapes in the same way as PostScript, using cubic bezier
* curves.
*
* @since 1.3
*/
public static final int TRUETYPE_FONT = 0;
/**
* A flag for <code>layoutGlyphVector</code>, indicating that the
* orientation of a text run is from left to right.
*
* @since 1.4
*/
public static final int LAYOUT_LEFT_TO_RIGHT = 0;
/**
* A flag for <code>layoutGlyphVector</code>, indicating that the
* orientation of a text run is from right to left.
*
* @since 1.4
*/
public static final int LAYOUT_RIGHT_TO_LEFT = 1;
/**
* A flag for <code>layoutGlyphVector</code>, indicating that the
* text does not contain valid characters before the
* <code>start</code> position. If this flag is set,
* <code>layoutGlyphVector</code> does not examine the text before
* <code>start</code>, even if this would be necessary to select the
* correct glyphs (e.g., for Arabic text).
*
* @since 1.4
*/
public static final int LAYOUT_NO_START_CONTEXT = 2;
/**
* A flag for <code>layoutGlyphVector</code>, indicating that the
* text does not contain valid characters after the
* <code>limit</code> position. If this flag is set,
* <code>layoutGlyphVector</code> does not examine the text after
* <code>limit</code>, even if this would be necessary to select the
* correct glyphs (e.g., for Arabic text).
*
* @since 1.4
*/
public static final int LAYOUT_NO_LIMIT_CONTEXT = 4;
// Serialization constant // Serialization constant
private static final long serialVersionUID = -4206021311591459213L; private static final long serialVersionUID = -4206021311591459213L;
...@@ -162,7 +222,7 @@ decode(String fontspec) ...@@ -162,7 +222,7 @@ decode(String fontspec)
{ {
tokenval = Integer.parseInt(token); tokenval = Integer.parseInt(token);
} }
catch(Exception e) { ; } catch(NumberFormatException e) { ; }
if (tokenval != 0) if (tokenval != 0)
size = tokenval; size = tokenval;
......
/* FontFormatException.java -- the specified font is bad
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
/**
* Thrown when a specified font is bad.
*
* @author Eric Blake <ebb9@email.byu.edu>
* @see Font
* @since 1.3
* @status updated to 1.4
*/
public class FontFormatException extends Exception
{
/**
* Compatible with JDK 1.4+.
*/
private static final long serialVersionUID = -4481290147811361272L;
/**
* Create a new instance with the specified detailed error message.
*
* @param message the detailed error message
*/
public FontFormatException(String message)
{
super(message);
}
} // class FontFormatException
/* GradientPaint.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.ColorModel;
/**
* STUB CLASS ONLY
*/
public class GradientPaint implements Paint
{
private final float x1;
private final float y1;
private final Color c1;
private final float x2;
private final float y2;
private final Color c2;
private final boolean cyclic;
public GradientPaint(float x1, float y1, Color c1,
float x2, float y2, Color c2)
{
this(x1, y1, c1, x2, y2, c2, false);
}
public GradientPaint(Point2D p1, Color c1, Point2D p2, Color c2)
{
this((float) p1.getX(), (float) p1.getY(), c1,
(float) p2.getX(), (float) p2.getY(), c2, false);
}
public GradientPaint(float x1, float y1, Color c1,
float x2, float y2, Color c2, boolean cyclic)
{
if (c1 == null || c2 == null)
throw new NullPointerException();
this.x1 = x1;
this.y1 = y1;
this.c1 = c1;
this.x2 = x2;
this.y2 = y2;
this.c2 = c2;
this.cyclic = cyclic;
}
public GradientPaint(Point2D p1, Color c1, Point2D p2, Color c2,
boolean cyclic)
{
this((float) p1.getX(), (float) p1.getY(), c1,
(float) p2.getX(), (float) p2.getY(), c2, cyclic);
}
public Point2D getPoint1()
{
return new Point2D.Float(x1, y1);
}
public Color getColor1()
{
return c1;
}
public Point2D getPoint2()
{
return new Point2D.Float(x2, y2);
}
public Color getColor2()
{
return c2;
}
public boolean isCyclic()
{
return cyclic;
}
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform xform,
RenderingHints hints)
{
throw new Error("not implemented");
}
public int getTransparency()
{
throw new Error("not implemented");
}
} // class GradientPaint
/* GraphicsConfigTemplate.java -- a template for selecting configurations
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
import java.io.Serializable;
/**
* This allows filtering an array of GraphicsConfigurations for the best
* one based on various requirements. The resulting configuration has had
* all non-default attributes set as required to meet or exceed the request.
*
* @author Eric Blake <ebb9@email.byu.edu>
* @see GraphicsConfiguration
* @see GraphicsDevice
* @since 1.2
* @status updated to 1.4
*/
public abstract class GraphicsConfigTemplate implements Serializable
{
/**
* Compatible with JDK 1.2+.
*/
private static final long serialVersionUID = -8061369279557787079L;
/** States that a feature is required to select a configuration. */
public static final int REQUIRED = 1;
/**
* States that a feature is preferred, but not required, to select a
* configuration. In the case of multiple valid configurations, the tie
* breaks in favor of the one with the feature.
*/
public static final int PREFERRED = 2;
/**
* States that a feature is not necessary in the configuration. In the case
* of multiple valid configurations, the tie breaks in favor of the one
* without the feature, to reduce overhead.
*/
public static final int UNNECESSARY = 3;
/**
* The default constructor.
*/
public GraphicsConfigTemplate()
{
}
/**
* Returns the "best" match among the array of possible configurations, given
* the criteria of this template.
*
* @param array the array to choose from
* @return the best match
* @throws NullPointerException if array is null
*/
public abstract GraphicsConfiguration getBestConfiguration
(GraphicsConfiguration[] array);
/**
* Returns true if the given configuration supports all the features required
* by this template.
*
* @param config the configuration to test
* @return true if it is a match
* @throws NullPointerException if config is null
*/
public abstract boolean isGraphicsConfigSupported
(GraphicsConfiguration config);
} // class GraphicsConfigTemplate
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation /* GraphicsConfiguration.java -- describes characteristics of graphics
Copyright (C) 2000, 2001, 2002 Free Software Foundation
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -34,35 +35,184 @@ this exception to your version of the library, but you are not ...@@ -34,35 +35,184 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
/* Status: Complete, but commented out until we have the required
GraphicsDevice. */
package java.awt; package java.awt;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.ColorModel; import java.awt.image.ColorModel;
import java.awt.geom.AffineTransform; import java.awt.image.VolatileImage;
/**
* This class describes the configuration of various graphics devices, such
* as a monitor or printer. Different configurations may exist for the same
* device, according to the different native modes supported.
*
* <p>Virtual devices are supported (for example, in a multiple screen
* environment, a virtual device covers all screens simultaneously); the
* configuration will have a non-zero relative coordinate system in such
* a case.
*
* @author Eric Blake <ebb9@email.byu.edu>
* @see Window
* @see Frame
* @see GraphicsEnvironment
* @see GraphicsDevice
* @since 1.0
* @status updated to 1.4
*/
public abstract class GraphicsConfiguration public abstract class GraphicsConfiguration
{ {
// Can't instantiate directly. Having a protected constructor seems /**
// redundant, but that is what the docs specify. * The default constructor.
*
* @see GraphicsDevice#getConfigurations()
* @see GraphicsDevice#getDefaultConfiguration()
* @see GraphicsDevice#getBestConfiguration(GraphicsConfigTemplate)
* @see Graphics2D#getDeviceConfiguration()
*/
protected GraphicsConfiguration () protected GraphicsConfiguration ()
{ {
} }
/* /**
* Gets the associated device that this configuration describes.
*
* @return the device
*/
public abstract GraphicsDevice getDevice(); public abstract GraphicsDevice getDevice();
*/
public abstract BufferedImage createCompatibleImage(int width, int height); /**
public abstract BufferedImage createCompatibleImage(int width, int height, * Returns a buffered image optimized to this device, so that blitting can
* be supported in the buffered image.
*
* @param w the width of the buffer
* @param h the height of the buffer
* @return the buffered image, or null if none is supported
*/
public abstract BufferedImage createCompatibleImage(int w, int h);
/**
* Returns a buffered volatile image optimized to this device, so that
* blitting can be supported in the buffered image. Because the buffer is
* volatile, it can be optimized by native graphics accelerators.
*
* @param w the width of the buffer
* @param h the height of the buffer
* @return the buffered image, or null if none is supported
* @see Component#createVolatileImage(int, int)
* @since 1.4
*/
public abstract VolatileImage createCompatibleVolatileImage(int w, int h);
/**
* Returns a buffered volatile image optimized to this device, and with the
* given capabilities, so that blitting can be supported in the buffered
* image. Because the buffer is volatile, it can be optimized by native
* graphics accelerators.
*
* @param w the width of the buffer
* @param h the height of the buffer
* @param caps the desired capabilities of the image buffer
* @return the buffered image, or null if none is supported
* @throws AWTException if the capabilities cannot be met
* @since 1.4
*/
public VolatileImage createCompatibleVolatileImage(int w, int h,
ImageCapabilities caps)
throws AWTException
{
throw new AWTException("not implemented");
}
/**
* Returns a buffered image optimized to this device, and with the specified
* transparency, so that blitting can be supported in the buffered image.
*
* @param w the width of the buffer
* @param h the height of the buffer
* @param transparency the transparency of the buffer
* @return the buffered image, or null if none is supported
* @see Transparency#OPAQUE
* @see Transparency#BITMASK
* @see Transparency#TRANSLUCENT
*/
public abstract BufferedImage createCompatibleImage(int w, int h,
int transparency); int transparency);
/**
* Gets the color model of the corresponding device.
*
* @return the color model
*/
public abstract ColorModel getColorModel(); public abstract ColorModel getColorModel();
/**
* Gets a color model for the corresponding device which supports the desired
* transparency level.
*
* @param transparency the transparency of the model
* @return the color model, with transparency
* @see Transparency#OPAQUE
* @see Transparency#BITMASK
* @see Transparency#TRANSLUCENT
*/
public abstract ColorModel getColorModel(int transparency); public abstract ColorModel getColorModel(int transparency);
/**
* Returns a transform that maps user coordinates to device coordinates. The
* preferred mapping is about 72 user units to 1 inch (2.54 cm) of physical
* space. This is often the identity transform. The device coordinates have
* the origin at the upper left, with increasing x to the right, and
* increasing y to the bottom.
*
* @return the transformation from user space to device space
* @see #getNormalizingTransform()
*/
public abstract AffineTransform getDefaultTransform(); public abstract AffineTransform getDefaultTransform();
/**
* Returns a transform that maps user coordinates to device coordinates. The
* exact mapping is 72 user units to 1 inch (2.54 cm) of physical space.
* This is often the identity transform. The device coordinates have the
* origin at the upper left, with increasing x to the right, and increasing
* y to the bottom. Note that this is more accurate (and thus, sometimes more
* costly) than the default transform.
*
* @return the normalized transformation from user space to device space
* @see #getDefaultTransform()
*/
public abstract AffineTransform getNormalizingTransform(); public abstract AffineTransform getNormalizingTransform();
/* @since 1.3 */ /**
* Returns the bounds of the configuration, in device coordinates. If this
* is a virtual device (for example, encompassing several screens), the
* bounds may have a non-zero origin.
*
* @return the device bounds
* @since 1.3
*/
public abstract Rectangle getBounds(); public abstract Rectangle getBounds();
}
/**
* Returns the buffering capabilities of this configuration.
*
* @return the buffer capabilities
* @since 1.4
*/
public BufferCapabilities getBufferCapabilities()
{
throw new Error("not implemented");
}
/**
* Returns the imaging capabilities of this configuration.
*
* @return the image capabilities
* @since 1.4
*/
public ImageCapabilities getImageCapabilities()
{
throw new Error("not implemented");
}
} // class GraphicsConfiguration
/* GraphicsDevice.java -- information about a graphics device
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
/**
* This describes a graphics device available to the given environment. This
* includes screen and printer devices, and the different configurations for
* each device. Also, this allows you to create virtual devices which operate
* over a multi-screen environment.
*
* @author Eric Blake <ebb9@email.byu.edu>
* @see GraphicsEnvironment
* @see GraphicsConfiguration
* @since 1.3
* @status updated to 1.4
*/
public abstract class GraphicsDevice
{
/** Device is a raster screen. */
public static final int TYPE_RASTER_SCREEN = 0;
/** Device is a printer. */
public static final int TYPE_PRINTER = 1;
/** Device is an image buffer not visible to the user. */
public static final int TYPE_IMAGE_BUFFER = 2;
/** The current full-screen window, or null if there is none. */
private Window full_screen;
/** The current display mode, or null if unknown. */
private DisplayMode mode;
/**
* The default constructor.
*
* @see GraphicsEnvironment#getScreenDevices()
* @see GraphicsEnvironment#getDefaultScreenDevice()
* @see GraphicsConfiguration#getDevice()
*/
protected GraphicsDevice()
{
}
/**
* Returns the type of the device.
*
* @return the device type
* @see #TYPE_RASTER_SCREEN
* @see #TYPE_PRINTER
* @see #TYPE_IMAGE_BUFFER
*/
public abstract int getType();
/**
* Returns an identification string for the device. This can be
* vendor-specific, and may be useful for debugging.
*
* @return the identification
*/
public abstract String getIDstring();
/**
* Return all configurations valid for this device.
*
* @return an array of configurations
*/
public abstract GraphicsConfiguration[] getConfigurations();
/**
* Return the default configuration for this device.
*
* @return the default configuration
*/
public abstract GraphicsConfiguration getDefaultConfiguration();
/**
* Return the best configuration, according to the criteria in the given
* template.
*
* @param template the template to adjust by
* @return the best configuration
* @throws NullPointerException if template is null
*/
public GraphicsConfiguration getBestConfiguration
(GraphicsConfigTemplate template)
{
return template.getBestConfiguration(getConfigurations());
}
/**
* Returns true if the device supports full-screen exclusive mode. The
* default implementation returns true; subclass it if this is not the case.
*
* @return true if full screen support is available
* @since 1.4
*/
public boolean isFullScreenSupported()
{
return true;
}
/**
* Toggle the given window between full screen and normal mode. The previous
* full-screen window, if different, is restored; if the given window is
* null, no window will be full screen. If
* <code>isFullScreenSupported()</code> returns true, full screen mode is
* considered to be exclusive, which implies:<ul>
* <li>Windows cannot overlap the full-screen window. All other application
* windows will always appear beneath the full-screen window in the
* Z-order.</li>
* <li>Input method windows are disabled. It is advisable to call
* <code>Component.enableInputMethods(false)</code> to make a component
* a non-client of the input method framework.</li>
* </ul><br>
* If <code>isFullScreenSupported()</code> returns false, full-screen
* exclusive mode is simulated by resizing the window to the size of the
* screen and positioning it at (0,0).
*
* XXX Not yet implemented in Classpath.
*
* @param w the window to toggle
* @see #isFullScreenSupported()
* @see getFullScreenWindow()
* @see setDisplayMode(DisplayMode)
* @see Component#enableInputMethods(boolean)
* @since 1.4
*/
public synchronized void setFullScreenWindow(Window w)
{
if (full_screen != null)
; // XXX Restore the previous window to normal mode.
full_screen = w;
// XXX If w != null, make it full-screen.
throw new Error("not implemented");
}
/**
* Returns the current full-screen window of the device, or null if no
* window is full-screen.
*
* @return the full-screen window
* @see #setFullScreenWindow(Window)
* @since 1.4
*/
public Window getFullScreenWindow()
{
return full_screen;
}
/**
* Returns whether this device supports low-level display changes. This may
* depend on whether full-screen exclusive mode is available.
*
* XXX The default implementation returns false for now.
*
* @return true if display changes are supported
* @see #setDisplayMode(DisplayMode)
* @since 1.4
*/
public boolean isDisplayChangeSupported()
{
return false;
}
/**
* Sets the display mode. This may be dependent on the availability of
* full-screen exclusive mode.
*
* @param mode the new mode
* @throws IllegalArgumentException if the new mode is not in getDisplayModes
* @throws UnsupportedOperationException if ! isDisplayChangeSupported()
* @see #getDisplayMode()
* @see #getDisplayModes()
* @see #isDisplayChangeSupported()
* @since 1.4
*/
public void setDisplayMode(DisplayMode mode)
{
DisplayMode[] array = getDisplayModes();
if (! isDisplayChangeSupported())
throw new UnsupportedOperationException();
int i = array == null ? 0 : array.length;
while (--i >= 0)
if (array[i].equals(mode))
break;
if (i < 0)
throw new IllegalArgumentException();
this.mode = mode;
}
/**
* Returns the current display mode of this device, or null if unknown.
*
* @return the current display mode
* @see #setDisplayMode(DisplayMode)
* @see #getDisplayModes()
* @since 1.4
*/
public DisplayMode getDisplayMode()
{
return mode;
}
/**
* Return an array of all available display modes. This implementation
* returns a 0-length array, so subclasses must override this.
*
* @return the array of available modes
* @since 1.4
*/
public DisplayMode[] getDisplayModes()
{
return new DisplayMode[0];
}
/**
* Return the number of bytes available in accelerated memory on this
* device. The device may support creation or caching on a first-come,
* first-served basis, depending on the operating system and driver.
* Memory may be a finite resource, and because of multi-threading, you
* are not guaranteed that the result of this method ensures your image
* will successfully be put in accelerated memory. A negative result means
* the memory is unlimited. The default implementation assumes no special
* memory is available, and returns 0.
*
* @return the size of accelerated memory available
* @see VolatileImage#flush()
* @see ImageCapabilities#isAccelerated()
*/
public int getAvailableAcceleratedMemory()
{
return 0;
}
} // class GraphicsDevice
/* GraphicsEnvironment.java -- information about the graphics environment
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
import java.awt.image.BufferedImage;
import java.util.Locale;
/**
* This descibes the collection of GraphicsDevice and Font objects available
* on a given platform. The resources might be local or remote, and specify
* the valid configurations for displaying graphics.
*
* @author Eric Blake <ebb9@email.byu.edu>
* @see GraphicsDevice
* @see GraphicsConfiguration
* @since 1.4
* @status updated to 1.4
*/
public abstract class GraphicsEnvironment
{
/**
* The environment must be obtained from a factory or query method, hence
* this constructor is protected.
*/
protected GraphicsEnvironment()
{
}
/**
* Returns the local graphics environment.
*
* XXX Not implemented in Classpath yet.
* @return the local environment
*/
public static GraphicsEnvironment getLocalGraphicsEnvironment()
{
throw new Error("not implemented");
}
/**
* Check if the local environment is headless, meaning that it does not
* support a display, keyboard, or mouse. Many methods in the Abstract
* Windows Toolkit (java.awt) throw a {@link HeadlessException} if this
* returns true.
*
* XXX For now, Classpath assumes that it is never headless.
*
* @return true if the environment is headless, meaning that graphics are
* unsupported
* @since 1.4
*/
public static boolean isHeadless()
{
// XXX Should be: getLocalGraphicsEnvironment().isHeadlessInstance();
return false;
}
/**
* Check if the given environment is headless, meaning that it does not
* support a display, keyboard, or mouse. Many methods in the Abstract
* Windows Toolkit (java.awt) throw a {@link HeadlessException} if this
* returns true. This default implementation returns false, so subclasses
* need only override it if they are headless.
*
* @return true if the environment is headless, meaning that graphics are
* unsupported
* @since 1.4
*/
public boolean isHeadlessInstance()
{
return false;
}
/**
* Get an array of all the GraphicsDevice objects.
*
* @return the available graphics devices, may be 0 length
* @throws HeadlessException if the environment is headless
*/
public abstract GraphicsDevice[] getScreenDevices();
/**
* Get the default screen GraphicsDevice object.
*
* @return the default screen device
* @throws HeadlessException if the environment is headless
*/
public abstract GraphicsDevice getDefaultScreenDevice();
/**
* Return a Graphics2D object which will render into the specified image.
*
* @param image the image to render into
* @return the object that renders into the image
*/
public abstract Graphics2D createGraphics(BufferedImage image);
/**
* Returns an array of the one-point size fonts available in this
* environment. From there, the user can select the font and derive the
* correct one of proper size and attributes, using <code>deriveFont</code>.
* Only one master version of each font appears in this array; if a font
* can be derived from another, it must be created in that way.
*
* @return the array of available fonts
* @see #getAvailableFontFamilyNames()
* @see Font#deriveFont(int, float)
* @since 1.2
*/
public abstract Font[] getAllFonts();
/**
* Returns an array of the font family names available in this environment.
* This allows flexibility in choosing the style of font, while still letting
* the Font class decide its best match.
*
* @return the array of available font families
* @see #getAllFonts()
* @see Font#getFamily()
* @since 1.2
*/
public abstract String[] getAvailableFontFamilyNames();
/**
* Returns an array of the font family names available in this environment,
* localized to the current Locale if l is non-null. This allows
* flexibility in choosing the style of font, while still letting the Font
* class decide its best match.
*
* @param l the locale to use
* @return the array of available font families, localized
* @see #getAllFonts()
* @see Font#getFamily()
* @since 1.2
*/
public abstract String[] getAvailableFontFamilyNames(Locale l);
/**
* Returns the point where a window should be centered. You should probably
* also check that the window fits within the screen bounds. The default
* simply returns the center of the maximum window bounds; subclasses should
* override this if native objects (like scrollbars) make that off-centered.
*
* @return the centering point
* @throws HeadlessException if the environment is headless
* @see #getMaximumWindowBounds()
* @since 1.4
*/
public Point getCenterPoint()
{
Rectangle r = getMaximumWindowBounds();
return new Point(r.x + r.width / 2, r.y + r.height / 2);
}
/**
* Returns the maximum bounds for a centered window object. The default
* implementation simply returns the bounds of the default configuration
* of the default screen; subclasses should override this to if native
* objects (like scrollbars) reduce what is truly available. Also,
* subclasses should override this if the window should be centered across
* a multi-screen display.
*
* @return the maximum window bounds
* @throws HeadlessException if the environment is headless
* @see #getCenterPoint()
* @see GraphicsConfiguration#getBounds()
* @see Toolkit#getScreenInsets(GraphicsConfiguration)
* @since 1.4
*/
public Rectangle getMaximumWindowBounds()
{
return getDefaultScreenDevice().getDefaultConfiguration().getBounds();
}
} // class GraphicsEnvironment
/* HeadlessException.java -- operation not possible in headless environment
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
/**
* This exception is thrown when code dependent on a keyboard, mouse, or
* display is executed in a headless environment.
*
* @author Eric Blake <ebb9@email.byu.edu>
* @since 1.4
* @status updated to 1.4
*/
public class HeadlessException extends UnsupportedOperationException
{
/**
* Compatible with JDK 1.4+.
*/
private static final long serialVersionUID = 167183644944358563L;
/**
* Create a new instance with no detailed error message.
*/
public HeadlessException()
{
}
/**
* Create a new instance with the specified detailed error message.
*
* @param message the detailed error message
*/
public HeadlessException(String message)
{
super(message);
}
} // class HeadlessException
/* IllegalComponentStateException.java -- Bad component state /* IllegalComponentStateException.java -- bad component state
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -39,37 +39,33 @@ exception statement from your version. */ ...@@ -39,37 +39,33 @@ exception statement from your version. */
package java.awt; package java.awt;
/** /**
* This exception is thrown when the requested operation failed because * This exception is thrown when the requested operation failed because
* a component was not in the proper state. * a component was not in the proper state.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn <arenn@urbanophile.com>
*/ * @status updated to 1.4
*/
public class IllegalComponentStateException extends IllegalStateException public class IllegalComponentStateException extends IllegalStateException
{ {
/**
* Compatible with JDK 1.0+.
*/
private static final long serialVersionUID = -1889339587208144238L;
/** /**
* Initializes a new instance of <code>IllegalComponentStateException</code> * Create a new instance with no detailed error message.
* with the specified detailed error message. */
* public IllegalComponentStateException()
* @param message The detailed error message. {
*/ }
public
IllegalComponentStateException(String message)
{
super(message);
}
/*************************************************************************/
/**
* Initializes a new instance of <code>IllegalComponentStateException</code>
* with no detailed error message.
*/
public
IllegalComponentStateException()
{
super();
}
/**
* Create a new instance with the specified detailed error message.
*
* @param message the detailed error message
*/
public IllegalComponentStateException(String message)
{
super(message);
}
} // class IllegalComponentStateException } // class IllegalComponentStateException
/* Image.java -- Java class for images /* Image.java -- superclass for images
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -38,160 +38,153 @@ exception statement from your version. */ ...@@ -38,160 +38,153 @@ exception statement from your version. */
package java.awt; package java.awt;
import java.awt.image.*; import java.awt.image.AreaAveragingScaleFilter;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.image.ReplicateScaleFilter;
/** /**
* This is the abstract superclass of all image objects in Java. * This is the abstract superclass of all image objects in Java.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn <arenn@urbanophile.com>
*/ * @since 1.0
public abstract class Image * @status updated to 1.4
{
/*
* Static Variables
*/ */
public abstract class Image
/**
* Constant indicating that the default scaling algorithm should be used.
*/
public static final int SCALE_DEFAULT = 1;
/**
* Constant indicating that a fast scaling algorithm should be used.
*/
public static final int SCALE_FAST = 2;
/**
* Constant indicating that a smooth scaling algorithm should be used.
*/
public static final int SCALE_SMOOTH = 4;
/**
* Constant indicating that the <code>ReplicateScaleFilter</code> class
* algorithm should be used for scaling.
*/
public static final int SCALE_REPLICATE = 8;
/**
* Constant indicating that the area averaging scaling algorithm should be
* used.
*/
public static final int SCALE_AREA_AVERAGING = 16;
/**
* This variable is returned whenever a property that is not defined
* is requested.
*/
public static final Object UndefinedProperty = Image.class;
/*************************************************************************/
/*
* Constructors
*/
/**
* A default constructor for subclasses.
*/
public
Image()
{ {
} /**
* This variable is returned whenever a property that is not defined
/*************************************************************************/ * is requested.
*/
/* // For debug purposes, this might as well be a unique string.
* Instance Methods public static final Object UndefinedProperty
*/ = new String("undefined property");
/** /**
* Returns the width of the image, or -1 if it is unknown. If the * Constant indicating that the default scaling algorithm should be used.
* image width is unknown, the observer object will be notified when *
* the value is known. * @since 1.1
* */
* @param observer The image observer for this object. public static final int SCALE_DEFAULT = 1;
*/
public abstract int /**
getWidth(ImageObserver observer); * Constant indicating that a fast scaling algorithm should be used.
*
/*************************************************************************/ * @since 1.1
*/
/** public static final int SCALE_FAST = 2;
* Returns the height of the image, or -1 if it is unknown. If the
* image height is unknown, the observer object will be notified when /**
* the value is known. * Constant indicating that a smooth scaling algorithm should be used.
* *
* @param observer The image observer for this object. * @since 1.1
*/ */
public abstract int public static final int SCALE_SMOOTH = 4;
getHeight(ImageObserver observer);
/**
/*************************************************************************/ * Constant indicating that the <code>ReplicateScaleFilter</code> class
* algorithm should be used for scaling.
/** *
* Returns the image producer object for this object. * @see ReplicateScaleFilter
* * @since 1.1
* @return The image producer for this object. */
*/ public static final int SCALE_REPLICATE = 8;
public abstract ImageProducer
getSource(); /**
* Constant indicating that the area averaging scaling algorithm should be
/*************************************************************************/ * used.
*
/** * @see AreaAveragingScaleFilter
* Returns a graphics context object for drawing an off-screen object. * @since 1.1
* This method is only valid for off-screen objects. */
* public static final int SCALE_AREA_AVERAGING = 16;
* @return A graphics context object for an off-screen object.
*/ /**
public abstract Graphics * A default constructor for subclasses.
getGraphics(); */
public Image()
/*************************************************************************/
/**
* This method requests a named property for an object. The value of the
* property is returned. The value <code>UndefinedProperty</code> is
* returned if there is no property with the specified name. The value
* <code>null</code> is returned if the properties for the object are
* not yet known. In this case, the specified image observer is notified
* when the properties are known.
*
* @param name The requested property name.
* @param observer The image observer for this object.
*/
public abstract Object
getProperty(String name, ImageObserver observer);
/*************************************************************************/
/**
* Scales the image to the requested dimension.
*
* XXX: FIXME
*
* @param width The width of the scaled image.
* @param height The height of the scaled image.
* @param flags A value indicating the algorithm to use, which will be
* set from contants defined in this class.
*
* @return The scaled <code>Image</code> object.
*/
public Image
getScaledInstance(int width, int height, int flags)
{ {
return null;
} }
/*************************************************************************/ /**
* Returns the width of the image, or -1 if it is unknown. If the
/** * image width is unknown, the observer object will be notified when
* Flushes (that is, destroys) any resources used for this image. This * the value is known.
* includes the actual image data. *
*/ * @param observer the image observer for this object
public abstract void * @return the width in pixels
flush(); * @see #getHeight(ImageObserver)
*/
public abstract int getWidth(ImageObserver observer);
/**
* Returns the height of the image, or -1 if it is unknown. If the
* image height is unknown, the observer object will be notified when
* the value is known.
*
* @param observer the image observer for this object
* @return the height in pixels
* @see #getWidth(ImageObserver)
*/
public abstract int getHeight(ImageObserver observer);
/**
* Returns the image producer object for this object. The producer is the
* object which generates pixels for this image.
*
* @return the image producer for this object
*/
public abstract ImageProducer getSource();
/**
* Returns a graphics context object for drawing an off-screen object.
* This method is only valid for off-screen objects.
*
* @return a graphics context object for an off-screen object
* @see Graphics#createImage(int, int)
*/
public abstract Graphics getGraphics();
/**
* This method requests a named property for an object. The value of the
* property is returned. The value <code>UndefinedProperty</code> is
* returned if there is no property with the specified name. The value
* <code>null</code> is returned if the properties for the object are
* not yet known. In this case, the specified image observer is notified
* when the properties are known.
*
* @param name the requested property name
* @param observer the image observer for this object
* @return the named property, if available
* @see #UndefinedProperty
*/
public abstract Object getProperty(String name, ImageObserver observer);
/**
* Scales the image to the requested dimension. A new Image with asynchronous
* loading will be produced according to the hints of the algorithm
* requested. If either the width or height is non-positive, it is adjusted
* to preserve the original aspect ratio.
*
* @param width the width of the scaled image
* @param height the height of the scaled image
* @param flags a value indicating the algorithm to use
* @return the scaled <code>Image</code> object
* @see #SCALE_DEFAULT
* @see #SCALE_FAST
* @see #SCALE_SMOOTH
* @see #SCALE_REPLICATE
* @see #SCALE_AREA_AVERAGING
* @since 1.1
*/
public Image getScaledInstance(int width, int height, int flags)
{
throw new Error("not implemented");
}
/**
* Flushes (that is, destroys) any resources used for this image. This
* includes the actual image data.
*/
public abstract void flush();
} // class Image } // class Image
/* ImageCapabilities.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
/**
* STUBS ONLY
*/
public class ImageCapabilities implements Cloneable
{
private final boolean accelerated;
public ImageCapabilities(boolean accelerated)
{
this.accelerated = accelerated;
}
public boolean isAccelerated()
{
return accelerated;
}
public boolean isTrueVolatile()
{
return true;
}
public Object clone()
{
try
{
return super.clone();
}
catch (CloneNotSupportedException e)
{
throw (Error) new InternalError().initCause(e); // Impossible
}
}
} // class ImageCapabilities
/* Insets.java -- Information about a container border. /* Insets.java -- information about a container border
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -38,137 +38,121 @@ exception statement from your version. */ ...@@ -38,137 +38,121 @@ exception statement from your version. */
package java.awt; package java.awt;
/** import java.io.Serializable;
* This class represents the "margin" or space around a container.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class Insets implements Cloneable, java.io.Serializable
{
/*
* Instance Variable
*/
/**
* @serial The top inset
*/
public int top;
/**
* @serial This bottom inset
*/
public int bottom;
/** /**
* @serial The left inset * This class represents the "margin" or space around a container.
*/ *
public int left; * @author Aaron M. Renn <arenn@urbanophile.com>
* @author Eric Blake <ebb9@email.byu.edu>
/** * @status
* @serial The right inset
*/
public int right;
/*************************************************************************/
/**
* Initializes a new instance of <code>Inset</code> with the specified
* inset values.
*
* @param top The top inset
* @param left The left inset
* @param bottom The bottom inset
* @param right The right inset
*/
public
Insets(int top, int left, int bottom, int right)
{
this.top = top;
this.left = left;
this.bottom = bottom;
this.right = right;
}
/*************************************************************************/
/*
* Instance Methods
*/ */
public class Insets implements Cloneable, Serializable
/**
* Tests whether this object is equal to the specified object. This will
* be true if and only if the specified object:
* <p>
* <ul>
* <li>Is not <code>null</code>.
* <li>Is an instance of <code>Insets</code>.
* <li>Has the same top, bottom, left, and right inset values as this object.
* </ul>
*
* @param obj The object to test against.
*
* @return <code>true</code> if the specified object is equal to this
* one, <code>false</code> otherwise.
*/
public boolean
equals(Object obj)
{
if (!(obj instanceof Insets))
return(false);
Insets i = (Insets)obj;
if (i.top != top)
return(false);
if (i.bottom != bottom)
return(false);
if (i.left != left)
return(false);
if (i.right != right)
return(false);
return(true);
}
public int
hashCode()
{
return top + bottom + left + right;
}
/*************************************************************************/
/**
* Returns a string representation of this object.
*
* @return A string representation of this object.
*/
public String
toString()
{
return(getClass().getName() + "(top=" + top + ",bottom=" + bottom +
",left=" + left + ",right=" + right + ")");
}
/*************************************************************************/
/**
* Returns a copy of this object.
*
* @return A copy of this object.
*/
public Object
clone()
{ {
try /**
{ * Compatible with JDK 1.0+.
return(super.clone()); */
} private static final long serialVersionUID = -2272572637695466749L;
catch(Exception e)
{ /**
return(null); * The gap from the top.
} *
} * @serial the top inset
*/
} // class Insets public int top;
/**
* The gap from the left.
*
* @serial the left inset
*/
public int left;
/**
* The gap from the bottom.
*
* @serial the bottom inset
*/
public int bottom;
/**
* The gap from the right.
*
* @serial the right inset
*/
public int right;
/**
* Initializes a new instance of <code>Inset</code> with the specified
* inset values.
*
* @param top the top inset
* @param left the left inset
* @param bottom the bottom inset
* @param right the right inset
*/
public Insets(int top, int left, int bottom, int right)
{
this.top = top;
this.left = left;
this.bottom = bottom;
this.right = right;
}
/**
* Tests whether this object is equal to the specified object. The other
* object must be an instance of Insets with identical field values.
*
* @param obj the object to test against
* @return true if the specified object is equal to this one
*/
public boolean equals(Object obj)
{
if (! (obj instanceof Insets))
return false;
Insets i = (Insets) obj;
return top == i.top && bottom == i.bottom
&& left == i.left && right == i.right;
}
/**
* Returns a hashcode for this instance. The formula is unspecified, but
* appears to be <code>XXX what is it? </code>.
*
* @return the hashcode
*/
public int hashCode()
{
// This can't be right...
return top + bottom + left + right;
}
/**
* Returns a string representation of this object, which will be non-null.
* The format is unspecified, but appears to be <code>XXX what is it?</code>.
*
* @return a string representation of this object
*/
public String toString()
{
return getClass().getName() + "(top=" + top + ",bottom=" + bottom +
",left=" + left + ",right=" + right + ')';
}
/**
* Returns a copy of this object.
*
* @return a copy of this object
*/
public Object clone()
{
try
{
return super.clone();
}
catch (CloneNotSupportedException e)
{
throw (Error) new InternalError().initCause(e); // Impossible
}
}
} // class Insets
/* ItemSelectable.java -- Items that can be selected /* ItemSelectable.java -- items that can be selected
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -41,44 +41,35 @@ package java.awt; ...@@ -41,44 +41,35 @@ package java.awt;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
/** /**
* This interface is for objects that can have one or more items * This interface is for objects that can have one or more items selected.
* selected. For example, radio buttons. * For example, radio buttons.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn <arenn@urbanophile.com>
*/ * @since 1.0
* @status updated to 1.4
*/
public interface ItemSelectable public interface ItemSelectable
{ {
/**
/** * Returns the list of objects that are selected in this component.
* Returns the list of objects that are selected in this component. *
* * @return the list of selected objects, or null
* @return The list of objects that are selected, or <code>null</code> if */
* no objects are selected. Object[] getSelectedObjects();
*/
public abstract Object[] /**
getSelectedObjects(); * Adds an item listener to this object. It will receive selection events
* for this object by the user (but not programatically). If listener is
/*************************************************************************/ * null, it is ignored.
*
/** * @param listener the item listener to add
* Adds an item listener to this object. It will receive */
* selection events for this object. void addItemListener(ItemListener listener);
*
* @param listener The item listener to add. /**
*/ * Removes an item listener from this object.
public abstract void *
addItemListener(ItemListener listener); * @param listener the item listener to remove
*/
/*************************************************************************/ void removeItemListener(ItemListener listener);
/**
* Removes an item listener from this object. It will no longer receive
* selection change events.
*
* @param listener The item listener to remove.
*/
public abstract void
removeItemListener(ItemListener listener);
} // interface ItemSelectable } // interface ItemSelectable
/* KeyEventDispatcher.java -- dispatches key events
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt;
import java.awt.event.KeyEvent;
/**
* An instance of this interface coordinates with a KeyboardFocusManager to
* target and dispatch all key events. This allows retargeting, consuming,
* changing, or otherwise manipulating the key event before sending it on to
* a target.
*
* <p>By default, the KeyboardFocusManager is the sink for all key events not
* dispatched by other dispatchers. Therefore, it is unnecessary for the user
* to register the focus manager as a dispatcher.
*
* @author Eric Blake <ebb9@email.byu.edu>
* @see KeyboardFocusManager#addKeyEventDispatcher(KeyEventDispatcher)
* @see KeyboardFocusManager#removeKeyEventDispatcher(KeyEventDispatcher)
* @since 1.4
* @status updated to 1.4
*/
public interface KeyEventDispatcher
{
/**
* Called by the KeyboardFocusManager to request that a key event be
* dispatched. The dispatcher is free to retarget the event, consume it,
* dispatch it, or make other changes. This is usually done to allow
* delivery of key events to objects other than the window in focus, such
* as for navigating non-focusable components. If this dispatcher chooses
* to dispatch the event itself, it should call <code>redispatchEvent</code>
* to avoid infinite recursion.
*
* <p>If the return value is false, the KeyEvent is passed to the next
* dispatcher in the chain, ending with the KeyboardFocusManager. If the
* return value is true, the event has been consumed (although it might
* have been ignored), and no further action will be taken on the event. Be
* sure to check whether the event was consumed before dispatching it
* further.
*
* @param e the key event
* @return true if the event has been consumed
* @see KeyboardFocusManager#redispatchEvent(Component, AWTEvent)
*/
boolean dispatchKeyEvent(KeyEvent e);
} // interface KeyEventDispatcher
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