Commit 3bd483f2 by Tom Tromey Committed by Tom Tromey

Start of AWT merge with Classpath:

	* Makefile.in: Rebuilt.
	* Makefile.am (awt_java_source_files): Reference files in
	gnu/java/awt, not gnu/gcj/awt.
	* java/awt/image/BufferedImage.java: Updated copyright.
	* java/awt/image/ComponentColorModel.java: Updated copyright.
	* java/awt/image/ComponentSampleModel.java: Updated copyright.
	* java/awt/image/DataBuffer.java: Updated copyright.
	* java/awt/image/DataBufferByte.java: Updated copyright.
	* java/awt/image/DataBufferInt.java: Updated copyright.
	* java/awt/image/DataBufferUShort.java: Updated copyright.
	* java/awt/image/IndexColorModel.java: Updated copyright.
	* java/awt/image/PackedColorModel.java: Updated copyright.
	* java/awt/image/Raster.java: Updated copyright.
	* java/awt/image/RasterOp.java: Updated copyright.
	* java/awt/image/SampleModel.java: Updated copyright.
	* java/awt/image/SinglePixelPackedSampleModel.java: Updated copyright.
	* java/awt/image/WritableRaster.java: Updated copyright.
	* java/awt/color/ColorSpace.java: Updated copyright.
	* java/awt/color/ICC_ColorSpace.java: Updated copyright
	* java/awt/color/ICC_Profile.java: Updated copyright.
	* java/awt/event/HierarchyBoundsAdapter.java: Updated copyright.
	* java/awt/event/HierarchyBoundsListener.java: Updated copyright.
	* java/awt/event/HierarchyEvent.java: Updated copyright.
	* java/awt/event/HierarchyListener.java: Updated copyright.
	* java/awt/geom/AffineTransform.java: Updated copyright.
	* java/awt/geom/Dimension2D.java: Updated copyright.
	* java/awt/geom/Ellipse2D.java: Updated copyright.
	* java/awt/geom/IllegalPathStateException.java: Updated copyright.
	* java/awt/geom/Line2D.java: Updated copyright.
	* java/awt/geom/NoninvertibleTransformException.java: Updated
	copyright.
	* java/awt/geom/PathIterator.java: Updated copyright.
	* java/awt/geom/Point2D.java: Updated copyright.
	* java/awt/geom/Rectangle2D.java: Updated copyright.
	* java/awt/geom/RectangularShape.java: Updated copyright.
	* java/awt/geom/RoundRectangle2D.java: Updated copyright.
	* java/awt/Toolkit.java: Updated import for file moves.
	* java/awt/Rectangle.java: Updated copyright; added javadoc from
	Classpath.
	(hashCode): New method from Classpath.
	* java/awt/Graphics2D.java: Updated copyright.
	* java/awt/Transparency.java: Updated copyright.
	* java/awt/Paint.java: Updated copyright.
	* java/awt/Graphics.java: New version from Classpath.
	* java/awt/EventDispatchThread.java: Updated copyright.
	* java/awt/CardLayout.java (layoutContainer): Don't skip invisible
	children.
	(gotoComponent): Wrap around on next/previous.
	* gnu/gcj/awt/BitMaskExtent.java: Removed.
	* gnu/gcj/awt/Buffers.java: Removed.
	* gnu/gcj/awt/ComponentDataBlitOp.java: Removed.
	* gnu/gcj/awt/GLightweightPeer.java: Removed.
	* gnu/java/awt/BitMaskExtent.java: Added.
	* gnu/java/awt/Buffers.java: Added.
	* gnu/java/awt/ComponentDataBlitOp.java: Added.
	* gnu/java/awt/GLightweightPeer.java: Added.
	* java/awt/geom/Line2D.java (clone): Ignore
	CloneNotSupportedException.
	* gnu/gcj/awt/GLightweightPeer.java (getColorModel): New method.
	* java/awt/Frame.java: Merged with Classpath.
	* java/awt/RenderingHints.java: Copyright update.
	* java/awt/Paint.java: Copyright update.
	* java/awt/image/DirectColorModel.java: Merged with Classpath.
	* java/awt/image/ColorModel.java: Merged with Classpath.
	* java/awt/Window.java (show): New Implementation from Classpath.
	(isShowing): Use super.isShowing().
	* java/awt/EventQueue.java: Merged with Classpath.
	* java/awt/AWTEventMulticaster.java (save): Throw
	RuntimeException.
	(saveInternal): Likewise.
	* java/awt/AWTEvent.java: Now implements Serializable.
	* java/awt/Event.java: Copyright update.
	* java/awt/peer/ComponentPeer.java: Merged with Classpath.
	* java/awt/image/BufferedImage.java: Copyright update.
	* java/awt/GraphicsConfiguration.java: Copyright update.
	* java/awt/Component.java: (addNotify): Don't call
	addNotifyContainerChildren().
	(addNotifyContainerChildren): Removed.
	(setPeer): New method from Classpath.
	(setTreeLock): Likewise.
	(setVisible): Rewrote.
	(show): Use it.
	(hide): Likewise.
	(validate): Set `valid'.
	(checkImage(Image,ImageObserver)): Implementation from Classpath.
	(createImage(ImageProducer)): Likewise.
	(prepareImage): Likewise.
	* java/awt/Container.java (addImpl): Handle case where constraint
	is not a String.  Post event via system event queue.
	(remove): Post event via system event queue.
	(validateTree): Only validate child if it is invalid.
	(getAlignmentX): Call super method as default.
	(getAlignmentY): Likewise.
	(addContainerListener): Now synchronized.
	(removeContainerListener): Likewise.
	(addNotifyContainerChildren): Now private.
	* java/awt/ComponentOrientation.java: Updated copyright.  Added
	@author.
	* java/awt/FlowLayout.java (serialVersionUID): New field.
	(setAlignment): Better exception message.
	(layoutContainer): Don't compute component's preferred size unless
	we're going to use it.
	* java/awt/BorderLayout.java (AFTER_LAST_LINE, AFTER_LINE_ENDS,
	BEFORE_FIRST_LINE, BEFORE_LINE_BEGINS): New constants.
	(firstLine, lastLine, firstItem, lastItem): New fields.
	(addLayoutComponent): Handle case where constraints is null.
	Also, handle relative locations.
	(removeLayoutComponent): Handle relative locations.
	(MIN, MAX, PREF): New constants.
	(calcCompSize): New method.
	(calcSize): New method.
	(minimumLayoutSize): Use it.
	(preferredLayoutSize): Likewise.
	(maximumLayoutSize): Likewise.
	(toString): Include more information.
	(setBounds): New method.
	(layoutContainer): Use libgcj implementation; extended to handle
	relative locations.

From-SVN: r48896
parent c342f126
2002-01-15 Tom Tromey <tromey@redhat.com>
Start of AWT merge with Classpath:
* Makefile.in: Rebuilt.
* Makefile.am (awt_java_source_files): Reference files in
gnu/java/awt, not gnu/gcj/awt.
* java/awt/image/BufferedImage.java: Updated copyright.
* java/awt/image/ComponentColorModel.java: Updated copyright.
* java/awt/image/ComponentSampleModel.java: Updated copyright.
* java/awt/image/DataBuffer.java: Updated copyright.
* java/awt/image/DataBufferByte.java: Updated copyright.
* java/awt/image/DataBufferInt.java: Updated copyright.
* java/awt/image/DataBufferUShort.java: Updated copyright.
* java/awt/image/IndexColorModel.java: Updated copyright.
* java/awt/image/PackedColorModel.java: Updated copyright.
* java/awt/image/Raster.java: Updated copyright.
* java/awt/image/RasterOp.java: Updated copyright.
* java/awt/image/SampleModel.java: Updated copyright.
* java/awt/image/SinglePixelPackedSampleModel.java: Updated copyright.
* java/awt/image/WritableRaster.java: Updated copyright.
* java/awt/color/ColorSpace.java: Updated copyright.
* java/awt/color/ICC_ColorSpace.java: Updated copyright
* java/awt/color/ICC_Profile.java: Updated copyright.
* java/awt/event/HierarchyBoundsAdapter.java: Updated copyright.
* java/awt/event/HierarchyBoundsListener.java: Updated copyright.
* java/awt/event/HierarchyEvent.java: Updated copyright.
* java/awt/event/HierarchyListener.java: Updated copyright.
* java/awt/geom/AffineTransform.java: Updated copyright.
* java/awt/geom/Dimension2D.java: Updated copyright.
* java/awt/geom/Ellipse2D.java: Updated copyright.
* java/awt/geom/IllegalPathStateException.java: Updated copyright.
* java/awt/geom/Line2D.java: Updated copyright.
* java/awt/geom/NoninvertibleTransformException.java: Updated
copyright.
* java/awt/geom/PathIterator.java: Updated copyright.
* java/awt/geom/Point2D.java: Updated copyright.
* java/awt/geom/Rectangle2D.java: Updated copyright.
* java/awt/geom/RectangularShape.java: Updated copyright.
* java/awt/geom/RoundRectangle2D.java: Updated copyright.
* java/awt/Toolkit.java: Updated import for file moves.
* java/awt/Rectangle.java: Updated copyright; added javadoc from
Classpath.
(hashCode): New method from Classpath.
* java/awt/Graphics2D.java: Updated copyright.
* java/awt/Transparency.java: Updated copyright.
* java/awt/Paint.java: Updated copyright.
* java/awt/Graphics.java: New version from Classpath.
* java/awt/EventDispatchThread.java: Updated copyright.
* java/awt/CardLayout.java (layoutContainer): Don't skip invisible
children.
(gotoComponent): Wrap around on next/previous.
* gnu/gcj/awt/BitMaskExtent.java: Removed.
* gnu/gcj/awt/Buffers.java: Removed.
* gnu/gcj/awt/ComponentDataBlitOp.java: Removed.
* gnu/gcj/awt/GLightweightPeer.java: Removed.
* gnu/java/awt/BitMaskExtent.java: Added.
* gnu/java/awt/Buffers.java: Added.
* gnu/java/awt/ComponentDataBlitOp.java: Added.
* gnu/java/awt/GLightweightPeer.java: Added.
* java/awt/geom/Line2D.java (clone): Ignore
CloneNotSupportedException.
* gnu/gcj/awt/GLightweightPeer.java (getColorModel): New method.
* java/awt/Frame.java: Merged with Classpath.
* java/awt/RenderingHints.java: Copyright update.
* java/awt/Paint.java: Copyright update.
* java/awt/image/DirectColorModel.java: Merged with Classpath.
* java/awt/image/ColorModel.java: Merged with Classpath.
* java/awt/Window.java (show): New Implementation from Classpath.
(isShowing): Use super.isShowing().
* java/awt/EventQueue.java: Merged with Classpath.
* java/awt/AWTEventMulticaster.java (save): Throw
RuntimeException.
(saveInternal): Likewise.
* java/awt/AWTEvent.java: Now implements Serializable.
* java/awt/Event.java: Copyright update.
* java/awt/peer/ComponentPeer.java: Merged with Classpath.
* java/awt/image/BufferedImage.java: Copyright update.
* java/awt/GraphicsConfiguration.java: Copyright update.
* java/awt/Component.java: (addNotify): Don't call
addNotifyContainerChildren().
(addNotifyContainerChildren): Removed.
(setPeer): New method from Classpath.
(setTreeLock): Likewise.
(setVisible): Rewrote.
(show): Use it.
(hide): Likewise.
(validate): Set `valid'.
(checkImage(Image,ImageObserver)): Implementation from Classpath.
(createImage(ImageProducer)): Likewise.
(prepareImage): Likewise.
* java/awt/Container.java (addImpl): Handle case where constraint
is not a String. Post event via system event queue.
(remove): Post event via system event queue.
(validateTree): Only validate child if it is invalid.
(getAlignmentX): Call super method as default.
(getAlignmentY): Likewise.
(addContainerListener): Now synchronized.
(removeContainerListener): Likewise.
(addNotifyContainerChildren): Now private.
* java/awt/ComponentOrientation.java: Updated copyright. Added
@author.
* java/awt/FlowLayout.java (serialVersionUID): New field.
(setAlignment): Better exception message.
(layoutContainer): Don't compute component's preferred size unless
we're going to use it.
* java/awt/BorderLayout.java (AFTER_LAST_LINE, AFTER_LINE_ENDS,
BEFORE_FIRST_LINE, BEFORE_LINE_BEGINS): New constants.
(firstLine, lastLine, firstItem, lastItem): New fields.
(addLayoutComponent): Handle case where constraints is null.
Also, handle relative locations.
(removeLayoutComponent): Handle relative locations.
(MIN, MAX, PREF): New constants.
(calcCompSize): New method.
(calcSize): New method.
(minimumLayoutSize): Use it.
(preferredLayoutSize): Likewise.
(maximumLayoutSize): Likewise.
(toString): Include more information.
(setBounds): New method.
(layoutContainer): Use libgcj implementation; extended to handle
relative locations.
2002-01-15 Tom Tromey <tromey@redhat.com>
* java/lang/Float.java (equals): Preserve old code.
* java/lang/Double.java (equals): Preserve old code.
......
......@@ -583,10 +583,10 @@ gnu/awt/j2d/DirectRasterGraphics.java \
gnu/awt/j2d/Graphics2DImpl.java \
gnu/awt/j2d/IntegerGraphicsState.java \
gnu/awt/j2d/MappedRaster.java \
gnu/gcj/awt/BitMaskExtent.java \
gnu/gcj/awt/Buffers.java \
gnu/gcj/awt/ComponentDataBlitOp.java \
gnu/gcj/awt/GLightweightPeer.java \
gnu/java/awt/BitMaskExtent.java \
gnu/java/awt/Buffers.java \
gnu/java/awt/ComponentDataBlitOp.java \
gnu/java/awt/GLightweightPeer.java \
gnu/java/beans/editors/ColorEditor.java \
gnu/java/beans/editors/FontEditor.java \
gnu/java/beans/editors/NativeBooleanEditor.java \
......
......@@ -334,10 +334,10 @@ gnu/awt/j2d/DirectRasterGraphics.java \
gnu/awt/j2d/Graphics2DImpl.java \
gnu/awt/j2d/IntegerGraphicsState.java \
gnu/awt/j2d/MappedRaster.java \
gnu/gcj/awt/BitMaskExtent.java \
gnu/gcj/awt/Buffers.java \
gnu/gcj/awt/ComponentDataBlitOp.java \
gnu/gcj/awt/GLightweightPeer.java \
gnu/java/awt/BitMaskExtent.java \
gnu/java/awt/Buffers.java \
gnu/java/awt/ComponentDataBlitOp.java \
gnu/java/awt/GLightweightPeer.java \
gnu/java/beans/editors/ColorEditor.java \
gnu/java/beans/editors/FontEditor.java \
gnu/java/beans/editors/NativeBooleanEditor.java \
......@@ -1732,11 +1732,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/awt/xlib/XGraphicsConfiguration.P \
.deps/gnu/awt/xlib/XPanelPeer.P .deps/gnu/awt/xlib/XToolkit.P \
.deps/gnu/classpath/Configuration.P .deps/gnu/gcj/Core.P \
.deps/gnu/gcj/RawData.P .deps/gnu/gcj/awt/BitMaskExtent.P \
.deps/gnu/gcj/awt/Buffers.P .deps/gnu/gcj/awt/ComponentDataBlitOp.P \
.deps/gnu/gcj/awt/GLightweightPeer.P \
.deps/gnu/gcj/convert/BytesToUnicode.P .deps/gnu/gcj/convert/Convert.P \
.deps/gnu/gcj/convert/IOConverter.P \
.deps/gnu/gcj/RawData.P .deps/gnu/gcj/convert/BytesToUnicode.P \
.deps/gnu/gcj/convert/Convert.P .deps/gnu/gcj/convert/IOConverter.P \
.deps/gnu/gcj/convert/Input_8859_1.P \
.deps/gnu/gcj/convert/Input_ASCII.P \
.deps/gnu/gcj/convert/Input_EUCJIS.P \
......@@ -1802,6 +1799,9 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/gcj/xlib/natXColor.P .deps/gnu/gcj/xlib/natXConfigureEvent.P \
.deps/gnu/gcj/xlib/natXException.P .deps/gnu/gcj/xlib/natXExposeEvent.P \
.deps/gnu/gcj/xlib/natXImage.P .deps/gnu/gcj/xlib/natXUnmapEvent.P \
.deps/gnu/java/awt/BitMaskExtent.P .deps/gnu/java/awt/Buffers.P \
.deps/gnu/java/awt/ComponentDataBlitOp.P \
.deps/gnu/java/awt/GLightweightPeer.P \
.deps/gnu/java/beans/BeanInfoEmbryo.P \
.deps/gnu/java/beans/EmptyBeanInfo.P \
.deps/gnu/java/beans/ExplicitBeanInfo.P \
......
......@@ -26,7 +26,7 @@ import gnu.gcj.xlib.Colormap;
import gnu.gcj.xlib.XColor;
import gnu.gcj.xlib.Screen;
import gnu.gcj.xlib.Display;
import gnu.gcj.awt.Buffers;
import gnu.java.awt.Buffers;
import java.util.Hashtable;
public class XGraphicsConfiguration extends GraphicsConfiguration
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
package gnu.gcj.awt;
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.awt;
/**
* Simple transparent utility class that can be used to perform bit
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
package gnu.gcj.awt;
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.awt;
import java.awt.image.*;
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
package gnu.gcj.awt;
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.awt;
import java.awt.geom.*;
import java.awt.image.*;
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
package gnu.gcj.awt;
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.awt;
import java.awt.*;
import java.awt.peer.*;
......@@ -131,4 +148,9 @@ public class GLightweightPeer implements LightweightPeer
public void setVisible(boolean visible) {}
public void show() {}
public ColorModel getColorModel ()
{
return null;
}
}
......@@ -396,6 +396,9 @@
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
/* Define if your <locale.h> file defines LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* Required define if using POSIX threads */
#undef _REENTRANT
......
/* Copyright (C) 1999, 2000 Free Software Foundation
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt;
......@@ -18,26 +36,83 @@ package java.awt;
/**
* 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.
* @author Warren Levy <warrenl@cygnus.com>
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public abstract class AWTEvent extends java.util.EventObject
{
/**
* @serial Indicates whether or not this event has been consumed.
*/
protected boolean consumed;
/**
* @serial The identifier number of this event.
*/
protected int id;
/* Event selection masks */
public static final long COMPONENT_EVENT_MASK = 1 << 0,
CONTAINER_EVENT_MASK = 1 << 1,
FOCUS_EVENT_MASK = 1 << 2,
KEY_EVENT_MASK = 1 << 3,
MOUSE_EVENT_MASK = 1 << 4,
MOUSE_MOTION_EVENT_MASK = 1 << 5,
WINDOW_EVENT_MASK = 1 << 6,
ACTION_EVENT_MASK = 1 << 7,
ADJUSTMENT_EVENT_MASK = 1 << 8,
ITEM_EVENT_MASK = 1 << 9,
TEXT_EVENT_MASK = 1 << 10,
INPUT_METHOD_EVENT_MASK = 1 << 11;
/**
* Mask for selecting component events.
*/
public static final long COMPONENT_EVENT_MASK = 0x001;
/**
* Mask for selecting container events.
*/
public static final long CONTAINER_EVENT_MASK = 0x002;
/**
* Mask for selecting component focus events.
*/
public static final long FOCUS_EVENT_MASK = 0x004;
/**
* Mask for selecting keyboard events.
*/
public static final long KEY_EVENT_MASK = 0x008;
/**
* Mask for mouse button events.
*/
public static final long MOUSE_EVENT_MASK = 0x010;
/**
* Mask for mouse motion events.
*/
public static final long MOUSE_MOTION_EVENT_MASK = 0x020;
/**
* Mask for window events.
*/
public static final long WINDOW_EVENT_MASK = 0x040;
/**
* Mask for action events.
*/
public static final long ACTION_EVENT_MASK = 0x080;
/**
* Mask for adjustment events.
*/
public static final long ADJUSTMENT_EVENT_MASK = 0x100;
/**
* Mask for item events.
*/
public static final long ITEM_EVENT_MASK = 0x200;
/**
* Mask for text events.
*/
public static final long TEXT_EVENT_MASK = 0x400;
/**
* This is the highest number for event ids that are reserved for use by
* the AWT system itself.
*/
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,
......@@ -45,8 +120,16 @@ public abstract class AWTEvent extends java.util.EventObject
HIERARCHY_EVENT_MASK = 1 << 15,
HIERARCHY_BOUNDS_EVENT_MASK = 1 << 16;
public static final int RESERVED_ID_MAX = 0x7cf;
/**
* Initializes a new instance of <code>AWTEvent</code> from the
* 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
*
*/
public AWTEvent(Event event)
{
// FIXME??
......@@ -54,32 +137,65 @@ public abstract class AWTEvent extends java.util.EventObject
this.id = event.id;
}
/**
* Initializes a new instance of <code>AWTEvent</code> with the specified
* source and id.
*
* @param source The object that caused the event.
* @param id The event id.
*/
public AWTEvent(Object source, int id)
{
super(source);
this.id = id;
}
/**
* Returns the id number of this event.
*
* @return The id number of this event.
*/
public int getID()
{
return id;
}
/**
* Returns a string representation of this event.
*
* @return A string representation of this event.
*/
public String paramString ()
{
return "";
}
/**
* Returns a string representation of this event.
*
* @return A string representation of this event.
*/
public String toString ()
{
return getClass().getName() + "[" + paramString() + "] on " + source;
}
/**
* Consumes this event so that it will not be processed in the default
* manner.
*/
protected void consume()
{
consumed = true;
}
/**
* Tests whether not not this event has been consumed. A consumed event
* is not processed in the default manner.
*
* @return <code>true</code> if this event has been consumed,
* <code>false</code> otherwise.
*/
protected boolean isConsumed()
{
return consumed;
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt;
......@@ -21,20 +39,65 @@ import java.io.ObjectOutputStream;
*/
/**
* Convienience class for thread-safe multicasting of AWT events,
* without synchronization.
* This class is used to implement a chain of event handlers. Dispatching
* using this class is thread safe. Here is a quick example of how to
* add and delete listeners using this class. For this example, we will
* assume are firing <code>AdjustableEvent</code>'s. However, this
* same approach is useful for all events in the <code>java.awt.event</code>
* package, and more if this class is subclassed.
* <p>
* <code>
* AdjustmentListener al;
*
* public void
* addAdjustmentListener(AdjustmentListener listener)
* {
* al = AWTEventMulticaster.add(al, listener);
* }
*
* public void
* removeAdjustmentListener(AdjustmentListener listener)
* {
* al = AWTEventMulticaster.remove(al, listener);
* }
* </code>
* <p>
* When it come time to process an event, simply call <code>al</code>,
* assuming it is not <code>null</code>.
* <p>
* The first time <code>add</code> is called it is passed
* <code>null</code> and <code>listener</code> as its arguments. This
* starts building the chain. This class returns <code>listener</code>
* which becomes the new <code>al</code>. The next time, <code>add</code>
* is called with <code>al</code> and <code>listener</code> and the
* new listener is then chained to the old.
*
* @author Bryce McKinlay
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class AWTEventMulticaster implements ComponentListener,
ContainerListener, FocusListener, KeyListener, MouseListener,
MouseMotionListener, WindowListener, ActionListener, ItemListener,
AdjustmentListener, TextListener, InputMethodListener, HierarchyListener,
HierarchyBoundsListener
{
protected final EventListener a, b;
/**
* A variable in the event chain.
*/
protected final EventListener a;
/**
* A variable in the event chain
*/
protected final EventListener b;
/**
* Initializes a new instance of <code>AWTEventMulticaster</code> with
* the specified event listener parameters.
*
* @param a The "a" listener object.
* @param b The "b" listener object.
*/
protected AWTEventMulticaster(EventListener a,
EventListener b)
{
......@@ -42,6 +105,14 @@ public class AWTEventMulticaster implements ComponentListener,
this.b = b;
}
/**
* Chain <code>EventListener</code> b to a.
*
* @param a - Listener to chain to.
* @param b - Listener to chain.
*
* @return Latest entry in the chain.
*/
protected static EventListener addInternal(EventListener a, EventListener b)
{
if (a == null)
......@@ -51,6 +122,14 @@ public class AWTEventMulticaster implements ComponentListener,
else return new AWTEventMulticaster(a, b);
}
/**
* Removes the listener <code>old</code> from the listener <code>lis</code>.
*
* @param lis The listener to remove <code>old</code> from.
* @param old The listener to remove.
*
* @return The resulting listener after the remove operation.
*/
protected static EventListener removeInternal(EventListener l,
EventListener oldl)
{
......@@ -64,7 +143,17 @@ public class AWTEventMulticaster implements ComponentListener,
return l;
}
/* Remove oldl from this multicaster. */
/**
* Removes the specified object from this multicaster object. If the
* object to remove is not part of this multicaster, then the remove
* method on the parent multicaster (if it exists) is called and a
* new multicaster object is returned based on that object and this
* multicaster's non-parent object.
*
* @param old The object to remove from this multicaster.
*
* @return The resulting multicaster with the specified listener removed.
*/
protected EventListener remove(EventListener oldl)
{
// If oldl is an immediate child, return the other child.
......@@ -73,7 +162,7 @@ public class AWTEventMulticaster implements ComponentListener,
if (b == oldl)
return a;
// If a and/or b are Multicaster's, search them recursivly.
// If a and/or b are Multicaster's, search them recursively.
if (a instanceof AWTEventMulticaster)
{
AWTEventMulticaster mc = (AWTEventMulticaster) a;
......@@ -93,27 +182,67 @@ public class AWTEventMulticaster implements ComponentListener,
return this;
}
/**
* Chain <code>ActionListener</code> b to a.
*
* @param a - Listener to chain to.
* @param b - Listener to chain.
*
* @return Latest entry in the chain.
*/
public static ActionListener add(ActionListener a, ActionListener b)
{
return (ActionListener) addInternal(a, b);
}
/**
* Chain <code>AdjustmentListener</code> b to a.
*
* @param a - Listener to chain to.
* @param b - Listener to chain.
*
* @return Latest entry in the chain.
*/
public static AdjustmentListener add(AdjustmentListener a,
AdjustmentListener b)
{
return (AdjustmentListener) addInternal(a, b);
}
/**
* Chain <code>ComponentListener</code> b to a.
*
* @param a - Listener to chain to.
* @param b - Listener to chain.
*
* @return Latest entry in the chain.
*/
public static ComponentListener add(ComponentListener a, ComponentListener b)
{
return (ComponentListener) addInternal(a, b);
}
/**
* Chain <code>ContainerListener</code> b to a.
*
* @param a - Listener to chain to.
* @param b - Listener to chain.
*
* @return Latest entry in the chain.
*/
public static ContainerListener add(ContainerListener a, ContainerListener b)
{
return (ContainerListener) addInternal(a, b);
}
/**
* Chain <code>FocusListener</code> b to a.
*
* @param a - Listener to chain to.
* @param b - Listener to chain.
*
* @return Latest entry in the chain.
*/
public static FocusListener add(FocusListener a, FocusListener b)
{
return (FocusListener) addInternal(a, b);
......@@ -136,60 +265,148 @@ public class AWTEventMulticaster implements ComponentListener,
return (InputMethodListener) addInternal(a, b);
}
/**
* Chain <code>ItemListener</code> b to a.
*
* @param a - Listener to chain to.
* @param b - Listener to chain.
*
* @return Latest entry in the chain.
*/
public static ItemListener add(ItemListener a, ItemListener b)
{
return (ItemListener) addInternal(a, b);
}
/**
* Chain <code>KeyListener</code> b to a.
*
* @param a - Listener to chain to.
* @param b - Listener to chain.
*
* @return Latest entry in the chain.
*/
public static KeyListener add(KeyListener a, KeyListener b)
{
return (KeyListener) addInternal(a, b);
}
/**
* Chain <code>MouseListener</code> b to a.
*
* @param a - Listener to chain to.
* @param b - Listener to chain.
*
* @return Latest entry in the chain.
*/
public static MouseListener add(MouseListener a, MouseListener b)
{
return (MouseListener) addInternal(a, b);
}
/**
* Chain <code>MouseMotionListener</code> b to a.
*
* @param a - Listener to chain to.
* @param b - Listener to chain.
*
* @return Latest entry in the chain.
*/
public static MouseMotionListener add(MouseMotionListener a,
MouseMotionListener b)
{
return (MouseMotionListener) addInternal(a, b);
}
/**
* Chain <code>AdjustmentListener</code> b to a.
*
* @param a - Listener to chain to.
* @param b - Listener to chain.
*
* @return Latest entry in the chain.
*/
public static TextListener add(TextListener a, TextListener b)
{
return (TextListener) addInternal(a, b);
}
/**
* Chain <code>WindowListener</code> b to a.
*
* @param a - Listener to chain to.
* @param b - Listener to chain.
*
* @return Latest entry in the chain.
*/
public static WindowListener add(WindowListener a, WindowListener b)
{
return (WindowListener) addInternal(a, b);
}
/**
* Removes the listener <code>old</code> from the listener <code>lis</code>.
*
* @param lis The listener to remove <code>old</code> from.
* @param old The listener to remove.
*
* @return The resulting listener after the remove operation.
*/
public static ActionListener remove(ActionListener l, ActionListener oldl)
{
return (ActionListener) removeInternal(l, oldl);
}
/**
* Removes the listener <code>old</code> from the listener <code>lis</code>.
*
* @param lis The listener to remove <code>old</code> from.
* @param old The listener to remove.
*
* @return The resulting listener after the remove operation.
*/
public static AdjustmentListener remove(AdjustmentListener l,
AdjustmentListener oldl)
{
return (AdjustmentListener) removeInternal(l, oldl);
}
/**
* Removes the listener <code>old</code> from the listener <code>lis</code>.
*
* @param lis The listener to remove <code>old</code> from.
* @param old The listener to remove.
*
* @return The resulting listener after the remove operation.
*/
public static ComponentListener remove(ComponentListener l,
ComponentListener oldl)
{
return (ComponentListener) removeInternal(l, oldl);
}
/**
* Removes the listener <code>old</code> from the listener <code>lis</code>.
*
* @param lis The listener to remove <code>old</code> from.
* @param old The listener to remove.
*
* @return The resulting listener after the remove operation.
*/
public static ContainerListener remove(ContainerListener l,
ContainerListener oldl)
{
return (ContainerListener) removeInternal(l, oldl);
}
/**
* Removes the listener <code>old</code> from the listener <code>lis</code>.
*
* @param lis The listener to remove <code>old</code> from.
* @param old The listener to remove.
*
* @return The resulting listener after the remove operation.
*/
public static FocusListener remove(FocusListener l, FocusListener oldl)
{
return (FocusListener) removeInternal(l, oldl);
......@@ -213,237 +430,487 @@ public class AWTEventMulticaster implements ComponentListener,
return (InputMethodListener) removeInternal(l, oldl);
}
/**
* Removes the listener <code>old</code> from the listener <code>lis</code>.
*
* @param lis The listener to remove <code>old</code> from.
* @param old The listener to remove.
*
* @return The resulting listener after the remove operation.
*/
public static ItemListener remove(ItemListener l, ItemListener oldl)
{
return (ItemListener) removeInternal(l, oldl);
}
/**
* Removes the listener <code>old</code> from the listener <code>lis</code>.
*
* @param lis The listener to remove <code>old</code> from.
* @param old The listener to remove.
*
* @return The resulting listener after the remove operation.
*/
public static KeyListener remove(KeyListener l, KeyListener oldl)
{
return (KeyListener) removeInternal(l, oldl);
}
/**
* Removes the listener <code>old</code> from the listener <code>lis</code>.
*
* @param lis The listener to remove <code>old</code> from.
* @param old The listener to remove.
*
* @return The resulting listener after the remove operation.
*/
public static MouseListener remove(MouseListener l, MouseListener oldl)
{
return (MouseListener) removeInternal(l, oldl);
}
/**
* Removes the listener <code>old</code> from the listener <code>lis</code>.
*
* @param lis The listener to remove <code>old</code> from.
* @param old The listener to remove.
*
* @return The resulting listener after the remove operation.
*/
public static MouseMotionListener remove(MouseMotionListener l,
MouseMotionListener oldl)
{
return (MouseMotionListener) removeInternal(l, oldl);
}
/**
* Removes the listener <code>old</code> from the listener <code>lis</code>.
*
* @param lis The listener to remove <code>old</code> from.
* @param old The listener to remove.
*
* @return The resulting listener after the remove operation.
*/
public static TextListener remove(TextListener l, TextListener oldl)
{
return (TextListener) removeInternal(l, oldl);
}
/**
* Removes the listener <code>old</code> from the listener <code>lis</code>.
*
* @param lis The listener to remove <code>old</code> from.
* @param old The listener to remove.
*
* @return The resulting listener after the remove operation.
*/
public static WindowListener remove(WindowListener l, WindowListener oldl)
{
return (WindowListener) removeInternal(l, oldl);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void actionPerformed(ActionEvent e)
{
((ActionListener) a).actionPerformed(e);
((ActionListener) b).actionPerformed(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void adjustmentValueChanged(AdjustmentEvent e)
{
((AdjustmentListener) a).adjustmentValueChanged(e);
((AdjustmentListener) b).adjustmentValueChanged(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void componentHidden(ComponentEvent e)
{
((ComponentListener) a).componentHidden(e);
((ComponentListener) b).componentHidden(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void componentMoved(ComponentEvent e)
{
((ComponentListener) a).componentMoved(e);
((ComponentListener) b).componentMoved(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void componentResized(ComponentEvent e)
{
((ComponentListener) a).componentResized(e);
((ComponentListener) b).componentResized(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void componentShown(ComponentEvent e)
{
((ComponentListener) a).componentShown(e);
((ComponentListener) b).componentShown(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void componentAdded(ContainerEvent e)
{
((ContainerListener) a).componentAdded(e);
((ContainerListener) b).componentAdded(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void componentRemoved(ContainerEvent e)
{
((ContainerListener) a).componentRemoved(e);
((ContainerListener) b).componentRemoved(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void focusGained(FocusEvent e)
{
((FocusListener) a).focusGained(e);
((FocusListener) b).focusGained(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void focusLost(FocusEvent e)
{
((FocusListener) a).focusLost(e);
((FocusListener) b).focusLost(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void ancestorMoved(HierarchyEvent e)
{
((HierarchyBoundsListener) a).ancestorMoved(e);
((HierarchyBoundsListener) b).ancestorMoved(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void ancestorResized(HierarchyEvent e)
{
((HierarchyBoundsListener) a).ancestorResized(e);
((HierarchyBoundsListener) b).ancestorResized(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void hierarchyChanged(HierarchyEvent e)
{
((HierarchyListener) a).hierarchyChanged(e);
((HierarchyListener) b).hierarchyChanged(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void caretPositionChanged(InputMethodEvent e)
{
((InputMethodListener) a).caretPositionChanged(e);
((InputMethodListener) b).caretPositionChanged(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void inputMethodTextChanged(InputMethodEvent e)
{
((InputMethodListener) a).inputMethodTextChanged(e);
((InputMethodListener) b).inputMethodTextChanged(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void itemStateChanged(ItemEvent e)
{
((ItemListener) a).itemStateChanged(e);
((ItemListener) b).itemStateChanged(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void keyPressed(KeyEvent e)
{
((KeyListener) a).keyPressed(e);
((KeyListener) b).keyPressed(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void keyReleased(KeyEvent e)
{
((KeyListener) a).keyReleased(e);
((KeyListener) b).keyReleased(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void keyTyped(KeyEvent e)
{
((KeyListener) a).keyTyped(e);
((KeyListener) b).keyTyped(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void mouseClicked(MouseEvent e)
{
((MouseListener) a).mouseClicked(e);
((MouseListener) b).mouseClicked(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void mouseEntered(MouseEvent e)
{
((MouseListener) a).mouseEntered(e);
((MouseListener) b).mouseEntered(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void mouseExited(MouseEvent e)
{
((MouseListener) a).mouseExited(e);
((MouseListener) b).mouseExited(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void mousePressed(MouseEvent e)
{
((MouseListener) a).mousePressed(e);
((MouseListener) b).mousePressed(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void mouseReleased(MouseEvent e)
{
((MouseListener) a).mouseReleased(e);
((MouseListener) b).mouseReleased(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void mouseDragged(MouseEvent e)
{
((MouseMotionListener) a).mouseDragged(e);
((MouseMotionListener) b).mouseDragged(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void mouseMoved(MouseEvent e)
{
((MouseMotionListener) a).mouseMoved(e);
((MouseMotionListener) b).mouseMoved(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void textValueChanged(TextEvent e)
{
((TextListener) a).textValueChanged(e);
((TextListener) b).textValueChanged(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void windowActivated(WindowEvent e)
{
((WindowListener) a).windowActivated(e);
((WindowListener) b).windowActivated(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void windowClosed(WindowEvent e)
{
((WindowListener) a).windowClosed(e);
((WindowListener) b).windowClosed(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void windowClosing(WindowEvent e)
{
((WindowListener) a).windowClosing(e);
((WindowListener) b).windowClosing(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void windowDeactivated(WindowEvent e)
{
((WindowListener) a).windowDeactivated(e);
((WindowListener) b).windowDeactivated(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void windowDeiconified(WindowEvent e)
{
((WindowListener) a).windowDeiconified(e);
((WindowListener) b).windowDeiconified(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void windowIconified(WindowEvent e)
{
((WindowListener) a).windowIconified(e);
((WindowListener) b).windowIconified(e);
}
/**
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
* @param event The event to handle.
*/
public void windowOpened(WindowEvent e)
{
((WindowListener) a).windowOpened(e);
......@@ -452,12 +919,11 @@ public class AWTEventMulticaster implements ComponentListener,
protected static void save(ObjectOutputStream s, String k, EventListener l)
{
// FIXME
throw new RuntimeException("Not Implemented");
}
protected void saveInternal(ObjectOutputStream s, String k)
{
// FIXME
throw new RuntimeException("Not Implemented");
}
}
/* Copyright (C) 1999, 2000 Free Software Foundation
/* BorderLayout.java -- A layout manager class
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This file is part of libjava.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
package java.awt;
/**
* This class implements a layout manager that positions components
* in certain sectors of the parent container.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
*/
public class BorderLayout implements LayoutManager2, java.io.Serializable
{
public static final String NORTH = "North",
SOUTH = "South",
EAST = "East",
WEST = "West",
CENTER = "Center";
// FIXME: use these too
public static final String BEFORE_FIRST_LINE = "First",
AFTER_LAST_LINE = "Last",
BEFORE_LINE_BEGINS = "Before",
AFTER_LINE_ENDS = "After";
/*
* Static Variables
*/
/**
* Constant indicating the top of the container
*/
public static final String NORTH = "North";
// FIXME: check serialization of fields
int hgap;
int vgap;
Component north, south, east, west, center;
/**
* Constant indicating the bottom of the container
*/
public static final String SOUTH = "South";
public BorderLayout ()
{
this (0, 0);
}
/**
* Constant indicating the right side of the container
*/
public static final String EAST = "East";
public BorderLayout (int hgap, int vgap)
{
/**
* Constant indicating the left side of the container
*/
public static final String WEST = "West";
/**
* Constant indicating the center of the container
*/
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.
*/
public static final String AFTER_LINE_ENDS = "After";
/**
* 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
private static final long serialVersionUID = -8658291919501921765L;
/*************************************************************************/
/*
* Instance Variables
*/
/**
* @serial
*/
private Component north;
/**
* @serial
*/
private Component south;
/**
* @serial
*/
private Component east;
/**
* @serial
*/
private Component west;
/**
* @serial
*/
private Component center;
/**
* @serial
*/
private Component firstLine;
/**
* @serial
*/
private Component lastLine;
/**
* @serial
*/
private Component firstItem;
/**
* @serial
*/
private Component lastItem;
/**
* @serial The horizontal gap between components
*/
private int hgap;
/**
* @serial The vertical gap between components
*/
private int vgap;
/*************************************************************************/
/*
* Constructors
*/
/**
* Initializes a new instance of <code>BorderLayout</code> with no
* horiztonal or vertical gaps between components.
*/
public
BorderLayout()
{
this(0,0);
}
/*************************************************************************/
/**
* Initializes a new instance of <code>BorderLayout</code> with the
* specified horiztonal and vertical gaps between components.
*
* @param hgap The horizontal gap between components.
* @param vgap The vertical gap between components.
*/
public
BorderLayout(int hgap, int vgap)
{
this.hgap = hgap;
this.vgap = vgap;
}
}
public int getHgap()
{
return hgap;
}
/*************************************************************************/
public void setHgap(int hgap)
{
/*
* Instance Variables
*/
/**
* Returns the horitzontal gap value.
*
* @return The horitzontal gap value.
*/
public int
getHgap()
{
return(hgap);
}
/*************************************************************************/
/**
* Sets the horizontal gap to the specified value.
*
* @param hgap The new horizontal gap.
*/
public void
setHgap(int hgap)
{
this.hgap = hgap;
}
}
public int getVgap()
{
return vgap;
}
/*************************************************************************/
public void setVgap(int vgap)
{
/**
* Returns the vertical gap value.
*
* @return The vertical gap value.
*/
public int
getVgap()
{
return(vgap);
}
/*************************************************************************/
/**
* Sets the vertical gap to the specified value.
*
* @param vgap The new vertical gap value.
*/
public void
setVgap(int vgap)
{
this.vgap = vgap;
}
}
public void addLayoutComponent(Component comp, Object constraints)
{
if ((constraints == null) || CENTER.equals(constraints))
{
center = comp;
}
else if (NORTH.equals(constraints))
{
north = comp;
}
else if (SOUTH.equals(constraints))
{
south = comp;
}
else if (EAST.equals(constraints))
{
east = comp;
}
else if (WEST.equals(constraints))
{
west = comp;
}
}
/*************************************************************************/
public void addLayoutComponent(String name, Component comp)
{
addLayoutComponent(comp, name);
}
/**
* Adds a component to the layout in the specified constraint position,
* which must be one of the string constants defined in this class.
*
* @param component The component to add.
* @param constraints The constraint string.
*
* @exception IllegalArgumentException If the constraint object is not
* a string, or is not one of the specified constants in this class.
*/
public void
addLayoutComponent(Component component, Object constraints)
{
if (constraints != null && ! (constraints instanceof String))
throw new IllegalArgumentException("Constraint must be a string");
String str = (String)constraints;
if (str == null || str.equals(CENTER))
center = component;
if (str.equals(NORTH))
north = component;
else if (str.equals(SOUTH))
south = component;
else if (str.equals(EAST))
east = component;
else if (str.equals(WEST))
west = component;
else if (str.equals(BEFORE_FIRST_LINE))
firstLine = component;
else if (str.equals(AFTER_LAST_LINE))
lastLine = component;
else if (str.equals(BEFORE_LINE_BEGINS))
firstItem = component;
else if (str.equals(AFTER_LINE_ENDS))
lastItem = component;
else
throw new IllegalArgumentException("Constraint value not valid: " + str);
}
public void removeLayoutComponent(Component comp)
{
if (center == comp)
{
center = null;
}
else if (north == comp)
{
/*************************************************************************/
/**
* Adds a component to the layout in the specified constraint position,
* which must be one of the string constants defined in this class.
*
* @param constraints The constraint string.
* @param component The component to add.
*
* @exception IllegalArgumentException If the constraint object is not
* one of the specified constants in this class.
*
* @deprecated This method is deprecated in favor of
* <code>addLayoutComponent(Component, Object)</code>.
*/
public void
addLayoutComponent(String constraints, Component component)
{
addLayoutComponent(component, constraints);
}
/*************************************************************************/
/**
* Removes the specified component from the layout.
*
* @param component The component to remove from the layout.
*/
public void
removeLayoutComponent(Component component)
{
if (north == component)
north = null;
}
else if (south == comp)
{
if (south == component)
south = null;
}
else if (east == comp)
{
if (east == component)
east = null;
}
else if (west == comp)
{
if (west == component)
west = null;
}
}
if (center == component)
center = null;
if (firstItem == component)
firstItem = null;
if (lastItem == component)
lastItem = null;
if (firstLine == component)
firstLine = null;
if (lastLine == component)
lastLine = null;
}
public Dimension minimumLayoutSize(Container target)
{
return calcSize(getMinimumSize(center),
getMinimumSize(north),
getMinimumSize(south),
getMinimumSize(east),
getMinimumSize(west),
target);
}
/*************************************************************************/
public Dimension preferredLayoutSize(Container target)
{
return calcSize(getPreferredSize(center),
getPreferredSize(north),
getPreferredSize(south),
getPreferredSize(east),
getPreferredSize(west),
target);
}
/**
* Returns the minimum size of the specified container using this layout.
*
* @param target The container to calculate the minimum size for.
*
* @return The minimum size of the container
*/
public Dimension
minimumLayoutSize(Container target)
{
return calcSize(target, MIN);
}
/**
* Completely disregards the requested maximum sizes of the
* components, and states that the container has no upper size
* limit.
/*************************************************************************/
/**
* Returns the preferred size of the specified container using this layout.
*
* @param target The container to calculate the preferred size for.
*
* @return a dimension of width and height Integer.MAX_VALUE.
* @return The preferred size of the container
*/
public Dimension maximumLayoutSize(Container target)
{
return (Dimension) DIM_MAX.clone();
}
public Dimension
preferredLayoutSize(Container target)
{
return calcSize(target, PREF);
}
public float getLayoutAlignmentX(Container parent)
{
return Component.CENTER_ALIGNMENT;
}
/*************************************************************************/
/**
* Returns the maximum size of the specified container using this layout.
*
* @param target The container to calculate the maximum size for.
*
* @return The maximum size of the container
*/
public Dimension
maximumLayoutSize(Container target)
{
return calcSize(target, MAX);
}
/*************************************************************************/
/**
* Returns the X axis alignment, which is a <code>float</code> indicating
* where along the X axis this container wishs to position its layout.
* 0 indicates align to the left, 1 indicates align to the right, and 0.5
* indicates align to the center.
*
* @param parent The parent container.
*
* @return The X alignment value.
*/
public float
getLayoutAlignmentX(Container parent)
{
return(parent.getAlignmentX());
}
public float getLayoutAlignmentY(Container parent)
/*************************************************************************/
/**
* Returns the Y axis alignment, which is a <code>float</code> indicating
* where along the Y axis this container wishs to position its layout.
* 0 indicates align to the top, 1 indicates align to the bottom, and 0.5
* indicates align to the center.
*
* @param parent The parent container.
*
* @return The Y alignment value.
*/
public float
getLayoutAlignmentY(Container parent)
{
return(parent.getAlignmentY());
}
/*************************************************************************/
/**
* Instructs this object to discard any layout information it might
* have cached.
*
* @param parent The parent container.
*/
public void
invalidateLayout(Container parent)
{
}
/*************************************************************************/
/**
* Lays out the specified container according to the constraints
* in this object.
*
* @param target The container to lay out.
*/
public void
layoutContainer(Container target)
{
Insets i = target.getInsets();
ComponentOrientation orient = target.getComponentOrientation ();
boolean left_to_right = orient.isLeftToRight ();
Component my_north = north;
Component my_east = east;
Component my_south = south;
Component my_west = west;
// Note that we currently don't handle vertical layouts. Neither
// does JDK 1.3.
if (firstLine != null)
my_north = firstLine;
if (lastLine != null)
my_south = lastLine;
if (firstItem != null)
{
return Component.CENTER_ALIGNMENT;
if (left_to_right)
my_west = firstItem;
else
my_east = firstItem;
}
public void invalidateLayout(Container target)
if (lastItem != null)
{
// TODO... implement caching?
if (left_to_right)
my_east = lastItem;
else
my_west = lastItem;
}
public void layoutContainer(Container target)
{
Insets i = target.getInsets();
Dimension c = getPreferredSize(center);
Dimension n = getPreferredSize(north);
Dimension s = getPreferredSize(south);
Dimension e = getPreferredSize(east);
Dimension w = getPreferredSize(west);
Dimension c = calcCompSize(center, PREF);
Dimension n = calcCompSize(my_north, PREF);
Dimension s = calcCompSize(my_south, PREF);
Dimension e = calcCompSize(my_east, PREF);
Dimension w = calcCompSize(my_west, PREF);
Dimension t = target.getSize();
/*
......@@ -201,54 +508,108 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
int hh = y3-y2-vgap;
setBounds(center, x2, y2, x3-x2-hgap, hh);
setBounds(north, x1, y1, ww, n.height);
setBounds(south, x1, y3, ww, s.height);
setBounds(west, x1, y2, w.width, hh);
setBounds(east, x3, y2, e.width, hh);
}
public String toString()
{
return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + "]";
}
setBounds(my_north, x1, y1, ww, n.height);
setBounds(my_south, x1, y3, ww, s.height);
setBounds(my_west, x1, y2, w.width, hh);
setBounds(my_east, x3, y2, e.width, hh);
}
// Support:
/*************************************************************************/
static final Dimension DIM_0 = new Dimension(0, 0);
static final Dimension DIM_MAX = new Dimension(Integer.MAX_VALUE,
Integer.MAX_VALUE);
/**
* Returns a string representation of this layout manager.
*
* @return A string representation of this object.
*/
public String
toString()
{
return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + "]";
}
void setBounds(Component comp, int x, int y, int w, int h)
{
private void
setBounds(Component comp, int x, int y, int w, int h)
{
if (comp == null)
return;
comp.setBounds(x, y, w, h);
}
}
Dimension getMinimumSize(Component comp)
{
// Some constants for use with calcSize().
private static final int MIN = 0;
private static final int MAX = 1;
private static final int PREF = 2;
private Dimension
calcCompSize(Component comp, int what)
{
if (comp == null)
return DIM_0;
return new Dimension(0, 0);
if (what == MIN)
return comp.getMinimumSize();
}
else if (what == MAX)
return comp.getMaximumSize();
return comp.getPreferredSize();
}
Dimension getPreferredSize(Component comp)
// This is a helper function used to compute the various sizes for
// this layout.
private Dimension
calcSize(Container target, int what)
{
Insets ins = target.getInsets();
ComponentOrientation orient = target.getComponentOrientation ();
boolean left_to_right = orient.isLeftToRight ();
Component my_north = north;
Component my_east = east;
Component my_south = south;
Component my_west = west;
// Note that we currently don't handle vertical layouts. Neither
// does JDK 1.3.
if (firstLine != null)
my_north = firstLine;
if (lastLine != null)
my_south = lastLine;
if (firstItem != null)
{
if (comp == null)
return DIM_0;
return comp.getPreferredSize();
if (left_to_right)
my_west = firstItem;
else
my_east = firstItem;
}
Dimension calcSize(Dimension c, Dimension n, Dimension s,
Dimension e, Dimension w, Container target)
if (lastItem != null)
{
Insets i = target.getInsets();
return new Dimension(c.width + e.width + w.width + hgap*2 +
i.left + i.right,
c.height + n.height + s.height + vgap*2 +
i.top + i.bottom
);
if (left_to_right)
my_east = lastItem;
else
my_west = lastItem;
}
Dimension ndim = calcCompSize(my_north, what);
Dimension sdim = calcCompSize(my_south, what);
Dimension edim = calcCompSize(my_east, what);
Dimension wdim = calcCompSize(my_west, what);
Dimension cdim = calcCompSize(center, what);
int width = edim.width + cdim.width + wdim.width + (hgap * 2);
if (ndim.width > width)
width = ndim.width;
if (sdim.width > width)
width = sdim.width;
width += (ins.left + ins.right);
int height = edim.height;
if (cdim.height > height)
height = cdim.height;
if (wdim.height > height)
height = wdim.height;
height += (ndim.height + sdim.height + (vgap * 2) + ins.top + ins.bottom);
return(new Dimension(width, height));
}
} // class BorderLayout
// CardLayout.java - Card-based layout engine
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
......@@ -137,14 +137,9 @@ public class CardLayout implements LayoutManager2, Serializable
for (int i = 0; i < num; ++i)
{
if (comps[i].isVisible ())
{
// Only resize the one we care about.
comps[i].setBounds (hgap + ins.left, vgap + ins.top,
width - 2 * hgap - ins.left - ins.right,
height - 2 * vgap - ins.top - ins.bottom);
break;
}
}
}
......@@ -272,13 +267,13 @@ public class CardLayout implements LayoutManager2, Serializable
{
choice = i + 1;
if (choice == num)
choice = num - 1;
choice = 0;
}
else if (what == PREV)
{
choice = i - 1;
if (choice < 0)
choice = 0;
choice = num - 1;
}
else
{
......
/* Copyright (C) 1999, 2000, 2001 Free Software Foundation
/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt;
import java.awt.event.*;
......@@ -34,13 +51,41 @@ import java.beans.PropertyChangeListener;
public abstract class Component implements ImageObserver, MenuContainer,
java.io.Serializable
{
/**
* Constant returned by the <code>getAlignmentY</code> method to indicate
* that the component wishes to be aligned to the bottom relative to
* other components.
*/
public static final float BOTTOM_ALIGNMENT = (float)1.0;
/**
* Constant returned by the <code>getAlignmentY</code> and
* <code>getAlignmentX</code> methods to indicate
* that the component wishes to be aligned to the center relative to
* other components.
*/
public static final float CENTER_ALIGNMENT = (float)0.5;
/* Constants for use with getAlignmentX()/getAlignmentY(). */
public static final float BOTTOM_ALIGNMENT = 1.0f,
CENTER_ALIGNMENT = 0.5f,
LEFT_ALIGNMENT = 0.0f,
RIGHT_ALIGNMENT = 1.0f,
TOP_ALIGNMENT = 0.0f;
/**
* Constant returned by the <code>getAlignmentY</code> method to indicate
* that the component wishes to be aligned to the top relative to
* other components.
*/
public static final float TOP_ALIGNMENT = (float)0.0;
/**
* Constant returned by the <code>getAlignmentX</code> method to indicate
* that the component wishes to be aligned to the right relative to
* other components.
*/
public static final float RIGHT_ALIGNMENT = (float)1.0;
/**
* Constant returned by the <code>getAlignmentX</code> method to indicate
* that the component wishes to be aligned to the left relative to
* other components.
*/
public static final float LEFT_ALIGNMENT = (float)0.0;
/* Make the treelock a String so that it can easily be identified
in debug dumps. We clone the String in order to avoid a conflict in
......@@ -92,10 +137,18 @@ public abstract class Component implements ImageObserver, MenuContainer,
transient ComponentOrientation orientation = ComponentOrientation.UNKNOWN;
/**
* Default constructor for subclasses.
*/
protected Component()
{
}
/**
* Returns the name of this component.
*
* @return The name of this component.
*/
public String getName()
{
if (name == null && !nameExplicitlySet)
......@@ -103,6 +156,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
return name;
}
/**
* Sets the name of this component to the specified name.
*
* @param name The new name of this component.
*/
public void setName(String name)
{
nameExplicitlySet = true;
......@@ -118,13 +176,29 @@ public abstract class Component implements ImageObserver, MenuContainer,
return null;
}
/**
* Returns the parent of this component.
*
* @return The parent of this component.
*/
public Container getParent()
{
return parent;
}
/** @deprecated */
// However, Classpath's Gtk peers rely on it.
// Sets the peer for this component.
final void setPeer (ComponentPeer peer)
{
this.peer = peer;
}
/**
* Returns the native windowing system peer for this component.
*
* @return The peer for this component.
* @deprecated
*/
// Classpath's Gtk peers rely on this.
public java.awt.peer.ComponentPeer getPeer()
{
return peer;
......@@ -167,11 +241,28 @@ public abstract class Component implements ImageObserver, MenuContainer,
return null;
}
/**
* Returns the object used for synchronization locks on this component
* when performing tree and layout functions.
*
* @return The synchronization lock for this component.
*/
public final Object getTreeLock()
{
return treeLock;
}
// The sync lock object for this component.
final void setTreeLock(Object tree_lock)
{
this.treeLock = tree_lock;
}
/**
* Returns the toolkit in use for this component.
*
* @return The toolkit for this component.
*/
public Toolkit getToolkit()
{
if (peer != null)
......@@ -185,6 +276,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
return Toolkit.getDefaultToolkit ();
}
/**
* Tests whether or not this component is valid. A invalid component needs
* to have its layout redone.
*
* @return <code>true</code> if this component is valid, <code>false</code>
* otherwise.
*/
public boolean isValid()
{
return valid;
......@@ -198,11 +296,25 @@ public abstract class Component implements ImageObserver, MenuContainer,
return false;
}
/**
* Tests whether or not this component is visible.
*
* @return <code>true</code> if the component is visible,
* <code>false</code> otherwise.
*/
public boolean isVisible()
{
return visible;
}
/**
* Tests whether or not this component is actually being shown on
* the screen. This will be true if and only if it this component is
* visible and its parent components are all visible.
*
* @return <code>true</code> if the component is showing on the screen,
* <code>false</code> otherwise.
*/
public boolean isShowing()
{
if (! visible || peer == null)
......@@ -211,11 +323,25 @@ public abstract class Component implements ImageObserver, MenuContainer,
return parent == null ? true : parent.isShowing ();
}
/**
* Tests whether or not this component is enabled.
*
* @return <code>true</code> if the component is enabled,
* <code>false</code> otherwise.
*/
public boolean isEnabled()
{
return enabled;
}
/**
* Enables or disables this component.
*
* @param enabled <code>true</code> to enable this component,
* <code>false</code> to disable it.
*
* @deprecated Deprecated in favor of <code>setEnabled()</code>.
*/
public void setEnabled(boolean b)
{
this.enabled = b;
......@@ -223,19 +349,34 @@ public abstract class Component implements ImageObserver, MenuContainer,
peer.setEnabled(b);
}
/** @deprecated */
/**
* Enables this component.
*
* @deprecated Deprecated in favor of <code>setEnabled()</code>.
*/
public void enable()
{
setEnabled(true);
}
/** @deprecated */
/**
* Enables or disables this component.
*
* @param enabled <code>true</code> to enable this component,
* <code>false</code> to disable it.
*
* @deprecated Deprecated in favor of <code>setEnabled()</code>.
*/
public void enable(boolean b)
{
setEnabled(b);
}
/** @deprecated */
/**
* Disables this component.
*
* @deprecated Deprecated in favor of <code>setEnabled()</code>.
*/
public void disable()
{
setEnabled(false);
......@@ -252,40 +393,61 @@ public abstract class Component implements ImageObserver, MenuContainer,
// FIXME
}
/** @specnote Inspection by subclassing shows that Sun's implementation
calls show(boolean) which then calls show() or hide(). It is
the show() method that is overriden in subclasses like Window.
We do the same to preserve compatibility for subclasses. */
/**
* Makes this component visible or invisible.
*
* @param visible <code>true</code> to make this component visible,
* </code>false</code> to make it invisible.
* @specnote Inspection by subclassing shows that Sun's implementation
* calls show(boolean) which then calls show() or hide(). It is
* the show() method that is overriden in subclasses like Window.
* We do the same to preserve compatibility for subclasses.
*/
public void setVisible(boolean b)
{
show (b);
if (peer != null)
peer.setVisible (b);
this.visible = b;
}
/** @deprecated */
/**
* Makes this component visible on the screen.
*
* @deprecated Deprecated in favor of <code>setVisible()</code>.
*/
public void show()
{
if (peer != null)
peer.setVisible(true);
this.visible = true;
setVisible (true);
}
/** @deprecated */
/**
* Makes this component visible or invisible.
*
* @param visible <code>true</code> to make this component visible,
* </code>false</code> to make it invisible.
*
* @deprecated Deprecated in favor of <code>setVisible()</code>.
*/
public void show(boolean b)
{
if (b)
show();
else
hide();
setVisible (b);
}
/** @deprecated */
/**
* Hides this component so that it is no longer shown on the screen.
*
* @deprecated Deprecated in favor of <code>setVisible()</code>.
*/
public void hide()
{
if (peer != null)
peer.setVisible(false);
this.visible = false;
setVisible (false);
}
/**
* Returns this component's foreground color.
*
* @return This component's foreground color.
*/
public Color getForeground()
{
if (foreground != null)
......@@ -295,6 +457,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
return null;
}
/**
* Sets this component's foreground color to the specified color.
*
* @param foreground_color The new foreground color.
*/
public void setForeground(Color c)
{
if (peer != null)
......@@ -302,10 +469,14 @@ public abstract class Component implements ImageObserver, MenuContainer,
this.foreground = c;
}
/** @return the background color of the component. null may be
returned instead of the actual background color, if this
method is called before the component is added to the
component hierarchy. */
/**
* Returns this component's background color.
*
* @return the background color of the component. null may be
* returned instead of the actual background color, if this
* method is called before the component is added to the
* component hierarchy.
*/
public Color getBackground()
{
if (background != null)
......@@ -315,6 +486,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
return null;
}
/**
* Sets this component's background color to the specified color.
*
* @param background_color The new background color
*/
public void setBackground(Color c)
{
if (peer != null)
......@@ -322,6 +498,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
this.background = c;
}
/**
* Returns the font in use for this component.
*
* @return The font for this component.
*/
public Font getFont()
{
if (font != null)
......@@ -331,6 +512,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
return null;
}
/**
* Sets the font for this component to the specified font.
*
* @param font The new font for this component.
*/
public void setFont(Font f)
{
if (peer != null)
......@@ -338,6 +524,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
this.font = f;
}
/**
* Returns the locale for this component. If this component does not
* have a locale, the locale of the parent component is returned. If the
* component has no parent, the system default locale is returned.
*
* @return The locale for this component.
*/
public Locale getLocale() throws IllegalComponentStateException
{
if (locale != null)
......@@ -348,6 +541,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
return parent.getLocale();
}
/**
* Sets the locale for this component to the specified locale.
*
* @param locale The new locale for this component.
*/
public void setLocale(Locale l)
{
this.locale = l;
......@@ -357,6 +555,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
invalidate();
}
/**
* Returns the color model of the device this componet is displayed on.
*
* @return This object's color model.
*/
public ColorModel getColorModel()
{
GraphicsConfiguration config = getGraphicsConfiguration();
......@@ -367,11 +570,23 @@ public abstract class Component implements ImageObserver, MenuContainer,
return getToolkit().getColorModel();
}
/**
* Returns the location of this component's top left corner relative to
* its parent component.
*
* @return The location of this component.
*/
public Point getLocation()
{
return new Point(x, y);
}
/**
* Returns the location of this component's top left corner in screen
* coordinates.
*
* @return The location of this component in screen coordinates.
*/
public Point getLocationOnScreen()
{
if (! isShowing ())
......@@ -381,12 +596,27 @@ public abstract class Component implements ImageObserver, MenuContainer,
return peer.getLocationOnScreen ();
}
/** @deprecated Use getLocation() instead. */
/**
* Returns the location of this component's top left corner relative to
* its parent component.
*
* @return The location of this component.
*
* @deprecated This method is deprecated in favor of
* <code>getLocation()</code>.
*/
public Point location()
{
return getLocation();
}
/**
* Moves this component to the specified location. The coordinates are
* the new upper left corner of this component.
*
* @param x The new X coordinate of this component.
* @param y The new Y coordinate of this component.
*/
public void setLocation (int x, int y)
{
if ((this.x == x) && (this.y == y))
......@@ -400,28 +630,59 @@ public abstract class Component implements ImageObserver, MenuContainer,
peer.setBounds(x, y, width, height);
}
/** @deprecated */
/**
* Moves this component to the specified location. The coordinates are
* the new upper left corner of this component.
*
* @param x The new X coordinate of this component.
* @param y The new Y coordinate of this component.
*
* @deprecated Deprecated in favor for <code>setLocation</code>.
*/
public void move(int x, int y)
{
setLocation(x,y);
}
/**
* Moves this component to the specified location. The coordinates are
* the new upper left corner of this component.
*
* @param p New coordinates for this component.
*/
public void setLocation(Point p)
{
setLocation(p.x, p.y);
}
/**
* Returns the size of this object.
*
* @return The size of this object.
*/
public Dimension getSize()
{
return new Dimension(width, height);
}
/** @deprecated */
/**
* Returns the size of this object.
*
* @return The size of this object.
*
* @deprecated This method is deprecated in favor of <code>getSize</code>.
*/
public Dimension size()
{
return getSize();
}
/**
* Sets the size of this component to the specified width and height.
*
* @param width The new width of this component.
* @param height The new height of this component.
*/
public void setSize(int width, int height)
{
if ((this.width == width) && (this.height == height))
......@@ -435,34 +696,77 @@ public abstract class Component implements ImageObserver, MenuContainer,
peer.setBounds(x, y, width, height);
}
/** @deprecated */
/**
* Sets the size of this component to the specified value.
*
* @param width The new width of the component.
* @param height The new height of the component.
*
* @deprecated This method is deprecated in favor of <code>setSize</code>.
*/
public void resize(int width, int height)
{
setSize(width, height);
}
/**
* Sets the size of this component to the specified value.
*
* @param dim The new size of this component.
*/
public void setSize(Dimension d)
{
setSize(d.width, d.height);
}
/** @deprecated */
/**
* Sets the size of this component to the specified value.
*
* @param dim The new size of this component.
*
* @deprecated This method is deprecated in favor of <code>setSize</code>.
*/
public void resize(Dimension d)
{
setSize(d.width, d.height);
}
/**
* Returns a bounding rectangle for this component. Note that the
* returned rectange is relative to this component's parent, not to
* the screen.
*
* @return The bounding rectangle for this component.
*/
public Rectangle getBounds()
{
return new Rectangle (x, y, width, height);
}
/** @deprecated */
/**
* Returns a bounding rectangle for this component. Note that the
* returned rectange is relative to this component's parent, not to
* the screen.
*
* @return The bounding rectangle for this component.
*
* @deprecated Deprecated in favor of <code>getBounds()</code>.
*/
public Rectangle bounds()
{
return getBounds();
}
/**
* Sets the bounding rectangle for this component to the specified
* values. Note that these coordinates are relative to the parent,
* not to the screen.
*
* @param x The X coordinate of the upper left corner of the rectangle.
* @param y The Y coordinate of the upper left corner of the rectangle.
* @param width The width of the rectangle.
* @param height The height of the rectangle.
*/
public void setBounds(int x, int y, int w, int h)
{
if (this.x == x
......@@ -482,12 +786,31 @@ public abstract class Component implements ImageObserver, MenuContainer,
peer.setBounds(x, y, w, h);
}
/** @deprecated */
/**
* Sets the bounding rectangle for this component to the specified
* values. Note that these coordinates are relative to the parent,
* not to the screen.
*
* @param x The X coordinate of the upper left corner of the rectangle.
* @param y The Y coordinate of the upper left corner of the rectangle.
* @param width The width of the rectangle.
* @param height The height of the rectangle.
*
* @deprecated This method is deprecated in favor of
* <code>setBounds(int, int, int, int)</code>.
*/
public void reshape(int x, int y, int width, int height)
{
setBounds(x, y, width, height);
}
/**
* Sets the bounding rectangle for this component to the specified
* rectangle. Note that these coordinates are relative to the parent,
* not to the screen.
*
* @param bounding_rectangle The new bounding rectangle.
*/
public void setBounds(Rectangle r)
{
setBounds(r.x, r.y, r.width, r.height);
......@@ -558,6 +881,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
return (peer != null) && (peer instanceof LightweightPeer);
}
/**
* Returns the component's preferred size.
*
* @return The component's preferred size.
*/
public Dimension getPreferredSize()
{
if (peer == null)
......@@ -566,12 +894,23 @@ public abstract class Component implements ImageObserver, MenuContainer,
return peer.getPreferredSize();
}
/** @deprecated */
/**
* Returns the component's preferred size.
*
* @return The component's preferred size.
*
* @deprecated Deprecated in favor of <code>getPreferredSize()</code>.
*/
public Dimension preferredSize()
{
return getPreferredSize();
}
/**
* Returns the component's minimum size.
*
* @return The component's minimum size.
*/
public Dimension getMinimumSize()
{
if (peer == null)
......@@ -580,43 +919,82 @@ public abstract class Component implements ImageObserver, MenuContainer,
return peer.getMinimumSize();
}
/** @deprecated */
/**
* Returns the component's minimum size.
*
* @return The component's minimum size.
*
* @deprecated Deprecated in favor of <code>getMinimumSize()</code>
*/
public Dimension minimumSize()
{
return getMinimumSize();
}
/**
* Returns the component's maximum size.
*
* @return The component's maximum size.
*/
public Dimension getMaximumSize()
{
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
}
/**
* Returns the preferred horizontal alignment of this component. The
* value returned will be one of the constants defined in this class.
*
* @return The preferred horizontal alignment of this component.
*/
public float getAlignmentX()
{
return CENTER_ALIGNMENT;
}
/**
* Returns the preferred vertical alignment of this component. The
* value returned will be one of the constants defined in this class.
*
* @return The preferred vertical alignment of this component.
*/
public float getAlignmentY()
{
return CENTER_ALIGNMENT;
}
/**
* Calls the layout manager to re-layout the component. This is called
* during validation of a container in most cases.
*/
public void doLayout()
{
// nothing to do unless we're a container
}
/** @deprecated */
/**
* Calls the layout manager to re-layout the component. This is called
* during validation of a container in most cases.
*
* @deprecated This method is deprecated in favor of <code>doLayout()</code>.
*/
public void layout()
{
doLayout();
}
/**
* Called to ensure that the layout for this component is valid.
*/
public void validate()
{
// nothing to do unless we're a container
valid = true;
}
/**
* Invalidates this component and all of its parent components. This will
* cause them to have their layout redone.
*/
public void invalidate()
{
valid = false;
......@@ -625,6 +1003,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
parent.invalidate ();
}
/**
* Returns a graphics object for this component. Returns <code>null</code>
* if this component is not currently displayed on the screen.
*
* @return A graphics object for this component.
*/
public Graphics getGraphics()
{
if (peer != null)
......@@ -647,6 +1031,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
return null;
}
/**
* Returns the font metrics for the specified font in this component.
*
* @param font The font to retrieve metrics for.
*
* @return The font metrics for the specified font.
*/
public FontMetrics getFontMetrics(Font font)
{
if (peer == null)
......@@ -654,6 +1045,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
return peer.getFontMetrics (font);
}
/**
* Sets the cursor for this component to the specified cursor.
*
* @param cursor The new cursor for this component.
*/
public void setCursor(Cursor cursor)
{
this.cursor = cursor;
......@@ -661,20 +1057,45 @@ public abstract class Component implements ImageObserver, MenuContainer,
peer.setCursor (cursor);
}
/**
* Returns the cursor for this component.
*
* @return The cursor for this component.
*/
public Cursor getCursor()
{
return this.cursor;
}
/**
* Paints this component on the screen. The clipping region in the
* graphics context will indicate the region that requires painting.
*
* @param graphics The graphics context for this paint job.
*/
public void paint(Graphics g)
{
}
/**
* Updates this component. This method fills the component
* with the background color, then sets the foreground color of the
* specified graphics context to the foreground color of this component
* and calls the <code>paint()</code> method.
* // FIXME: What are the coords relative to?
*
* @param graphics The graphics context for this update.
*/
public void update(Graphics g)
{
paint(g);
}
/**
* Paints this entire component, including any sub-components.
*
* @param graphics The graphics context for this paint job.
*/
public void paintAll(Graphics g)
{
if (!visible)
......@@ -685,21 +1106,59 @@ public abstract class Component implements ImageObserver, MenuContainer,
paint(g);
}
/**
* Repaint this entire component. The <code>update()</code> method
* on this component will be called as soon as possible.
* // FIXME: What are the coords relative to?
*/
public void repaint()
{
repaint(0, 0, 0, getWidth(), getHeight());
}
/**
* Repaint this entire component. The <code>update()</code> method
* on this component will be called in approximate the specified number
* of milliseconds.
* // FIXME: What are the coords relative to?
*
* @param tm The number of milliseconds before this component should
* be repainted.
*/
public void repaint(long tm)
{
repaint(tm, 0, 0, getWidth(), getHeight());
}
/**
* Repaints the specified rectangular region within this component.
* This <code>update</code> method on this component will be called as
* soon as possible.
* // FIXME: What are the coords relative to?
*
* @param x The X coordinate of the upper left of the region to repaint
* @param y The Y coordinate of the upper left of the region to repaint
* @param width The width of the region to repaint.
* @param height The height of the region to repaint.
*/
public void repaint(int x, int y, int width, int height)
{
repaint(0, x, y, width, height);
}
/**
* Repaints the specified rectangular region within this component.
* This <code>update</code> method on this component will be called in
* approximately the specified number of milliseconds.
* // FIXME: What are the coords relative to?
*
* @param tm The number of milliseconds before this component should
* be repainted.
* @param x The X coordinate of the upper left of the region to repaint
* @param y The Y coordinate of the upper left of the region to repaint
* @param width The width of the region to repaint.
* @param height The height of the region to repaint.
*/
public void repaint(long tm, int x, int y, int width, int height)
{
// Handle lightweight repainting by forwarding to native parent
......@@ -714,16 +1173,46 @@ public abstract class Component implements ImageObserver, MenuContainer,
peer.repaint(tm, x, y, width, height);
}
/**
* Prints this component. This method is
* provided so that printing can be done in a different manner from
* painting. However, the implementation in this class simply calls
* the <code>paint()</code> method.
*
* @param graphics The graphics context of the print device.
*/
public void print(Graphics g)
{
paint(g);
}
/**
* Prints this component, including all sub-components. This method is
* provided so that printing can be done in a different manner from
* painting. However, the implementation in this class simply calls
* the <code>paintAll()</code> method.
*
* @param graphics The graphics context of the print device.
*/
public void printAll(Graphics g)
{
paintAll(g);
}
/**
* Called when an image has changed so that this component is
* repainted.
*
* @param image The image that has been updated.
* @param flags Flags as specified in <code>ImageObserver</code>.
* @param x The X coordinate
* @param y The Y coordinate
* @param width The width
* @param height The height
*
* @return <code>true</code> if the image has been fully loaded,
* <code>false</code> otherwise.
*/
public boolean imageUpdate (Image img, int infoflags, int x, int y,
int w, int h)
{
......@@ -731,58 +1220,160 @@ public abstract class Component implements ImageObserver, MenuContainer,
return false;
}
/**
* Creates an image from the specified producer.
*
* @param producer The image procedure to create the image from.
*
* @return The resulting image.
*/
public Image createImage(ImageProducer producer)
{
// FIXME
return null;
return peer.createImage(producer);
}
/**
* Creates an image with the specified width and height for use in
* double buffering.
*
* @param width The width of the image.
* @param height The height of the image.
*
* @return The requested image.
*/
public Image createImage(int width, int height)
{
return getGraphicsConfiguration().createCompatibleImage(width, height);
}
/**
* Prepares the specified image for rendering on this component.
*
* @param image The image to prepare for rendering.
* @param observer The image observer to notify of the status of the
* image preparation.
*
* @return <code>true</code> if the image is already fully prepared
* for rendering, <code>false</code> otherwise.
*/
public boolean prepareImage(Image image, ImageObserver observer)
{
// FIXME
return false;
return prepareImage(image, image.getWidth(observer),
image.getHeight(observer), observer);
}
public boolean prepareImage(Image image, int width, int height, ImageObserver observer)
/**
* Prepares the specified image for rendering on this component at the
* specified scaled width and height
*
* @param image The image to prepare for rendering.
* @param width The scaled width of the image.
* @param height The scaled height of the image.
* @param observer The image observer to notify of the status of the
* image preparation.
*
* @return <code>true</code> if the image is already fully prepared
* for rendering, <code>false</code> otherwise.
*/
public boolean prepareImage(Image image, int width, int height,
ImageObserver observer)
{
// FIXME
return false;
return peer.prepareImage(image, width, height, observer);
}
/**
* Returns the status of the loading of the specified image. The value
* returned will be those flags defined in <code>ImageObserver</code>.
*
* @param image The image to check on.
* @param observer The observer to be notified as the image loading
* progresses.
*
* @return The image observer flags indicating the status of the load.
*/
public int checkImage(Image image, ImageObserver observer)
{
// FIXME
return 0;
return checkImage(image, image.getWidth(observer),
image.getHeight(observer), observer);
}
public int checkImage (Image image, int width, int height, ImageObserver observer)
/**
* Returns the status of the loading of the specified image. The value
* returned will be those flags defined in <code>ImageObserver</code>.
*
* @param image The image to check on.
* @param width The scaled image width.
* @param height The scaled image height.
* @param observer The observer to be notified as the image loading
* progresses.
*
* @return The image observer flags indicating the status of the load.
*/
public int checkImage (Image image, int width, int height,
ImageObserver observer)
{
if (peer != null)
return peer.checkImage (image, width, height, observer);
return getToolkit ().checkImage (image, width, height, observer);
}
/**
* Tests whether or not the specified point is contained within this
* component. Coordinates are relative to this component.
*
* @param x The X coordinate of the point to test.
* @param y The Y coordinate of the point to test.
*
* @return <code>true</code> if the point is within this component,
* <code>false</code> otherwise.
*/
public boolean contains (int x, int y)
{
return (x >= 0) && (y >= 0) && (x < width) && (y < height);
}
/** @deprecated */
/**
* Tests whether or not the specified point is contained within this
* component. Coordinates are relative to this component.
*
* @param x The X coordinate of the point to test.
* @param y The Y coordinate of the point to test.
*
* @return <code>true</code> if the point is within this component,
* <code>false</code> otherwise.
*
* @deprecated Deprecated in favor of <code>contains(int, int)</code>.
*/
public boolean inside(int x, int y)
{
return contains(x,y);
}
/**
* Tests whether or not the specified point is contained within this
* component. Coordinates are relative to this component.
*
* @param point The point to test.
*
* @return <code>true</code> if the point is within this component,
* <code>false</code> otherwise.
*/
public boolean contains(Point p)
{
return contains(p.x, p.y);
}
/**
* Returns the component occupying the position (x,y). This will either
* be this component, an immediate child component, or <code>null</code>
* if neither of the first two occupies the specified location.
*
* @param x The X coordinate to search for components at.
* @param y The Y coordinate to search for components at.
*
* @return The component at the specified location, for <code>null</code>
* if there is none.
*/
public Component getComponentAt(int x, int y)
{
if (contains(x,y))
......@@ -790,21 +1381,47 @@ public abstract class Component implements ImageObserver, MenuContainer,
return null;
}
/** @deprecated */
/**
* Returns the component occupying the position (x,y). This will either
* be this component, an immediate child component, or <code>null</code>
* if neither of the first two occupies the specified location.
*
* @param x The X coordinate to search for components at.
* @param y The Y coordinate to search for components at.
*
* @return The component at the specified location, for <code>null</code>
* if there is none.
*
* @deprecated The method is deprecated in favor of
* <code>getComponentAt()</code>.
*/
public Component locate(int x, int y)
{
return getComponentAt(x, y);
}
/**
* Returns the component occupying the specified point This will either
* be this component, an immediate child component, or <code>null</code>
* if neither of the first two occupies the specified location.
*
* @param point The point to search for components at.
*
* @return The component at the specified location, for <code>null</code>
* if there is none.
*/
public Component getComponentAt(Point p)
{
return getComponentAt(p.x, p.y);
}
/** @deprecated */
/**
* AWT 1.0 event dispatcher.
*
* @deprecated Deprecated in favor of <code>dispatchEvent()</code>.
*/
public void deliverEvent(Event e)
{
}
/** Forward AWT events to processEvent() if:
......@@ -812,6 +1429,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
* OR:
* - There is at least one registered listener for this type of event
*
* @param event The event to dispatch
*
* @specnote This method is final, but we need to be able to
* override it in order to handle other event types in our
* subclasses. The solution is to define a second, non-final
......@@ -870,12 +1489,21 @@ public abstract class Component implements ImageObserver, MenuContainer,
processEvent(e);
}
/** @deprecated */
/**
* AWT 1.0 event dispatcher.
*
* @deprecated Deprecated in favor of <code>dispatchEvent()</code>.
*/
public boolean postEvent(Event e)
{
return false;
}
/**
* Adds the specified listener to this component.
*
* @param listener The new listener to add.
*/
public synchronized void addComponentListener(ComponentListener l)
{
componentListener = AWTEventMulticaster.add(componentListener, l);
......@@ -883,11 +1511,21 @@ public abstract class Component implements ImageObserver, MenuContainer,
enableEvents(AWTEvent.COMPONENT_EVENT_MASK);
}
/**
* Removes the specified listener from the component.
*
* @param listener The listener to remove.
*/
public synchronized void removeComponentListener(ComponentListener l)
{
componentListener = AWTEventMulticaster.remove(componentListener, l);
}
/**
* Adds the specified listener to this component.
*
* @param listener The new listener to add.
*/
public synchronized void addFocusListener(FocusListener l)
{
focusListener = AWTEventMulticaster.add(focusListener, l);
......@@ -895,6 +1533,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
enableEvents(AWTEvent.FOCUS_EVENT_MASK);
}
/**
* Removes the specified listener from the component.
*
* @param listener The listener to remove.
*/
public synchronized void removeFocusListener(FocusListener l)
{
focusListener = AWTEventMulticaster.remove(focusListener, l);
......@@ -931,6 +1574,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
AWTEventMulticaster.remove(hierarchyBoundsListener, l);
}
/**
* Adds the specified listener to this component.
*
* @param listener The new listener to add.
*/
public synchronized void addKeyListener(KeyListener l)
{
keyListener = AWTEventMulticaster.add(keyListener, l);
......@@ -938,11 +1586,21 @@ public abstract class Component implements ImageObserver, MenuContainer,
enableEvents(AWTEvent.KEY_EVENT_MASK);
}
/**
* Removes the specified listener from the component.
*
* @param listener The listener to remove.
*/
public synchronized void removeKeyListener(KeyListener l)
{
keyListener = AWTEventMulticaster.remove(keyListener, l);
}
/**
* Adds the specified listener to this component.
*
* @param listener The new listener to add.
*/
public synchronized void addMouseListener(MouseListener l)
{
mouseListener = AWTEventMulticaster.add(mouseListener, l);
......@@ -950,11 +1608,21 @@ public abstract class Component implements ImageObserver, MenuContainer,
enableEvents(AWTEvent.MOUSE_EVENT_MASK);
}
/**
* Removes the specified listener from the component.
*
* @param listener The listener to remove.
*/
public synchronized void removeMouseListener(MouseListener l)
{
mouseListener = AWTEventMulticaster.remove(mouseListener, l);
}
/**
* Adds the specified listener to this component.
*
* @param listener The new listener to add.
*/
public synchronized void addMouseMotionListener(MouseMotionListener l)
{
mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, l);
......@@ -962,6 +1630,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
enableEvents(AWTEvent.MOUSE_EVENT_MASK);
}
/**
* Removes the specified listener from the component.
*
* @param listener The listener to remove.
*/
public synchronized void removeMouseMotionListener(MouseMotionListener l)
{
mouseMotionListener = AWTEventMulticaster.remove(mouseMotionListener, l);
......@@ -1043,6 +1716,17 @@ public abstract class Component implements ImageObserver, MenuContainer,
//
// public InputContext getInputContext()
/**
* Enables the specified events. The events to enable are specified
* by OR-ing together the desired masks from <code>AWTEvent</code>.
* <p>
* Events are enabled by default when a listener is attached to the
* component for that event type. This method can be used by subclasses
* to ensure the delivery of a specified event regardless of whether
* or not a listener is attached.
*
* @param enable_events The desired events to enable.
*/
protected final void enableEvents(long eventsToEnable)
{
eventMask |= eventsToEnable;
......@@ -1060,6 +1744,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
peer.setEventMask (eventMask);
}
/**
* Disables the specified events. The events to disable are specified
* by OR-ing together the desired masks from <code>AWTEvent</code>.
*
* @param disable_events The desired events to disable.
*/
protected final void disableEvents(long eventsToDisable)
{
eventMask &= ~eventsToDisable;
......@@ -1111,7 +1801,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
* +--+
* </pre>
*/
private PaintEvent coalescePaintEvents(PaintEvent queuedEvent,
PaintEvent newEvent)
{
......@@ -1132,11 +1821,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
return newEvent;
}
/** Forward event to the appropriate processXXXEvent method based on the
* event type.
/**
* Processes the specified event. In this class, this method simply
* calls one of the more specific event handlers.
*
* @param event The event to process.
*/
protected void processEvent(AWTEvent e)
{
......@@ -1173,6 +1862,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
}
/**
* Called when a component event is dispatched and component events are
* enabled. This method passes the event along to any listeners
* that are attached.
*
* @param event The <code>ComponentEvent</code> to process.
*/
protected void processComponentEvent(ComponentEvent e)
{
if (componentListener == null)
......@@ -1197,6 +1893,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
}
/**
* Called when a focus event is dispatched and component events are
* enabled. This method passes the event along to any listeners
* that are attached.
*
* @param event The <code>FocusEvent</code> to process.
*/
protected void processFocusEvent(FocusEvent e)
{
if (focusListener == null)
......@@ -1212,6 +1915,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
}
/**
* Called when a key event is dispatched and component events are
* enabled. This method passes the event along to any listeners
* that are attached.
*
* @param event The <code>KeyEvent</code> to process.
*/
protected void processKeyEvent(KeyEvent e)
{
if (keyListener == null)
......@@ -1230,6 +1940,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
}
/**
* Called when a regular mouse event is dispatched and component events are
* enabled. This method passes the event along to any listeners
* that are attached.
*
* @param event The <code>MouseEvent</code> to process.
*/
protected void processMouseEvent(MouseEvent e)
{
if (mouseListener == null)
......@@ -1254,6 +1971,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
}
/**
* Called when a mouse motion event is dispatched and component events are
* enabled. This method passes the event along to any listeners
* that are attached.
*
* @param event The <code>MouseMotionEvent</code> to process.
*/
protected void processMouseMotionEvent(MouseEvent e)
{
if (mouseMotionListener == null)
......@@ -1333,76 +2057,118 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
}
/** @deprecated */
/**
* AWT 1.0 event processor.
*
* @deprecated Deprecated in favor of <code>processEvent</code>.
*/
public boolean handleEvent(Event evt)
{
return false;
}
/** @deprecated */
/**
* AWT 1.0 mouse event.
*
* @deprecated Deprecated in favor of <code>processMouseEvent()</code>.
*/
public boolean mouseDown(Event evt, int x, int y)
{
return false;
}
/** @deprecated */
/**
* AWT 1.0 mouse event.
*
* @deprecated Deprecated in favor of <code>processMouseMotionEvent()</code>.
*/
public boolean mouseDrag(Event evt, int x, int y)
{
return false;
}
/** @deprecated */
/**
* AWT 1.0 mouse event.
*
* @deprecated Deprecated in favor of <code>processMouseEvent()</code>.
*/
public boolean mouseUp(Event evt, int x, int y)
{
return false;
}
/** @deprecated */
/**
* AWT 1.0 mouse event.
*
* @deprecated Deprecated in favor of <code>processMouseMotionEvent()</code>.
*/
public boolean mouseMove(Event evt, int x, int y)
{
return false;
}
/** @deprecated */
/**
* AWT 1.0 mouse event.
*
* @deprecated Deprecated in favor of <code>processMouseEvent()</code>.
*/
public boolean mouseEnter(Event evt, int x, int y)
{
return false;
}
/** @deprecated */
/**
* AWT 1.0 mouse event.
*
* @deprecated Deprecated in favor of <code>processMouseEvent()</code>.
*/
public boolean mouseExit(Event evt, int x, int y)
{
return false;
}
/** @deprecated */
/**
* AWT 1.0 key press event.
*
* @deprecated Deprecated in favor of <code>processKeyEvent</code>.
*/
public boolean keyDown(Event evt, int key)
{
return false;
}
/** @deprecated */
/**
* AWT 1.0 key press event.
*
* @deprecated Deprecated in favor of <code>processKeyEvent</code>.
*/
public boolean keyUp(Event evt, int key)
{
return false;
}
/** @deprecated */
/**
* AWT 1.0 action event processor.
*
* @deprecated Deprecated in favor of the <code>ActionListener</code>
* interface.
*/
public boolean action(Event evt, Object what)
{
return false;
}
/**
* Called to inform this component it has been added to a container.
* A native peer - if any - is created at this time. This method is
* called automatically by the AWT system and should not be called by
* user level code.
*/
public void addNotify()
{
if (peer == null)
peer = getToolkit().createComponent(this);
/* Add notify children using a template method, so that it is
possible to ensure that the new event mask delivered to the
peer. */
addNotifyContainerChildren();
/* Now that all the children has gotten their peers, we should
have the event mask needed for this component and its
lightweight subcomponents. */
......@@ -1415,11 +2181,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
etc. */
}
void addNotifyContainerChildren()
{
// nothing to do unless we're a container
}
/**
* Called to inform this component is has been removed from its
* container. Its native peer - if any - is destroyed at this time.
* This method is called automatically by the AWT system and should
* not be called by user level code.
*/
public void removeNotify()
{
if (peer != null)
......@@ -1439,11 +2206,24 @@ public abstract class Component implements ImageObserver, MenuContainer,
return false;
}
/**
* Tests whether or not this component is in the group that can
* be traversed using the keyboard traversal mechanism (such as the TAB
* key).
*
* @return <code>true</code> if the component is traversed via the TAB
* key, <code>false</code> otherwise.
*/
public boolean isFocusTraversable()
{
return enabled && visible && (peer == null || peer.isFocusTraversable ());
}
/**
* Requests that this component be given focus. The <code>gotFocus()</code>
* method on this event will be called when and if this request was
* successful.
*/
public void requestFocus()
{
// If there's no peer then this component can't get the focus. We
......@@ -1461,6 +2241,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
return null;
}
/**
* Transfers focus to the next component in the focus traversal order.
*/
public void transferFocus()
{
Component next;
......@@ -1472,7 +2255,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
next.requestFocus ();
}
/** @deprecated */
/**
* AWT 1.0 focus event processor.
*
* @deprecated Deprecated in favor of <code>transferFocus()</code>.
*/
public void nextFocus()
{
transferFocus();
......@@ -1484,6 +2271,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
return hasFocus;
}
/**
* Adds the specified popup menu to this component.
*
* @param menu The popup menu to be added.
*/
public synchronized void add(PopupMenu popup)
{
if (popups == null)
......@@ -1491,11 +2283,21 @@ public abstract class Component implements ImageObserver, MenuContainer,
popups.addElement(popup);
}
/**
* Removes the specified popup menu from this component.
*
* @param menu The popup menu to remove.
*/
public synchronized void remove(MenuComponent popup)
{
popups.removeElement(popup);
}
/**
* Returns a debugging string representing this component.
*
* @return A string representing this component.
*/
protected String paramString()
{
StringBuffer param = new StringBuffer();
......@@ -1527,21 +2329,41 @@ public abstract class Component implements ImageObserver, MenuContainer,
return param.toString();
}
/**
* Returns a string representation of this component.
*
* @return A string representation of this component
*/
public String toString()
{
return this.getClass().getName() + "[" + paramString() + "]";
}
/**
* Prints a listing of this component to the standard output.
*/
public void list ()
{
list (System.out, 0);
}
/**
* Prints a listing of this component to the specified print stream.
*
* @param stream The <code>PrintStream</code> to print to.
*/
public void list (PrintStream out)
{
list (out, 0);
}
/**
* Prints a listing of this component to the specified print stream,
* starting at the specified indentation point.
*
* @param stream The <code>PrintStream</code> to print to.
* @param indent The indentation point.
*/
public void list (PrintStream out, int indent)
{
for (int i = 0; i < indent; ++i)
......@@ -1549,11 +2371,23 @@ public abstract class Component implements ImageObserver, MenuContainer,
out.println (toString ());
}
/**
* Prints a listing of this component to the specified print writer.
*
* @param writer The <code>PrintWrinter</code> to print to.
*/
public void list (PrintWriter out)
{
list (out, 0);
}
/**
* Prints a listing of this component to the specified print writer,
* starting at the specified indentation point.
*
* @param writer The <code>PrintWriter</code> to print to.
* @param indent The indentation point.
*/
public void list (PrintWriter out, int indent)
{
for (int i = 0; i < indent; ++i)
......@@ -1612,4 +2446,29 @@ public abstract class Component implements ImageObserver, MenuContainer,
return accessibleContext;
}
*/
/**
* AWT 1.0 focus event processor.
*
* @deprecated Deprecated in favor of <code>processFocusEvent</code>.
public boolean
gotFocus(Event event, Object what)
{
return(true);
}
*/
/**
* AWT 1.0 focus event processor.
*
* @deprecated Deprecated in favor of <code>processFocusEvent</code>.
public boolean
lostFocus(Event event, Object what)
{
return(true);
}
*/
}
/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
/**
* @author Bryce McKinlay <bryce@albatross.co.nz>
*/
/* Status: Incomplete. Needs a Locale lookup table. */
......
/* Copyright (C) 1999, 2000 Free Software Foundation
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of libjava.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt;
......@@ -31,21 +48,46 @@ public class Container extends Component
/* Anything else is non-serializable, and should be declared "transient". */
transient ContainerListener containerListener;
/**
* Default constructor for subclasses.
*/
public Container()
{
}
/**
* Returns the number of components in this container.
*
* @return The number of components in this container.
*/
public int getComponentCount()
{
return ncomponents;
}
/** @deprecated Use getComponentCount() instead. */
/**
* Returns the number of components in this container.
*
* @return The number of components in this container.
*
* @deprecated This method is deprecated in favor of
* <code>getComponentCount()</code>.
*/
public int countComponents()
{
return ncomponents;
}
/**
* Returns the component at the specified index.
*
* @param index The index of the component to retrieve.
*
* @return The requested component.
*
* @exception ArrayIndexOutOfBoundsException If the specified index is not
* valid.
*/
public Component getComponent (int n)
{
if (n < 0 || n >= ncomponents)
......@@ -53,6 +95,11 @@ public class Container extends Component
return component[n];
}
/**
* Returns an array of the components in this container.
*
* @return The components in this container.
*/
public Component[] getComponents()
{
Component[] result = new Component[ncomponents];
......@@ -61,51 +108,130 @@ public class Container extends Component
return result;
}
/**
* Returns the insets for this container, which is the space used for
* borders, the margin, etc.
*
* @return The insets for this container.
*/
public Insets getInsets()
{
if (peer == null)
return new Insets(0, 0, 0, 0);
return ((ContainerPeer) peer).getInsets();
}
/** @deprecated Use getInsets() instead. */
/**
* Returns the insets for this container, which is the space used for
* borders, the margin, etc.
*
* @return The insets for this container.
*
* @deprecated This method is deprecated in favor of
* <code>getInsets()</code>.
*/
public Insets insets()
{
return getInsets();
}
/**
* Adds the specified component to this container at the end of the
* component list.
*
* @param component The component to add to the container.
*
* @return The same component that was added.
*/
public Component add (Component comp)
{
addImpl (comp, null, -1);
return comp;
}
/**
* Adds the specified component to the container at the end of the
* component list. This method should not be used. Instead, use
* <code>add(Component, Object</code>.
*
* @param name FIXME
* @param component The component to be added.
*
* @return The same component that was added.
*/
public Component add (String name, Component comp)
{
addImpl (comp, name, -1);
return comp;
}
/**
* Adds the specified component to this container at the specified index
* in the component list.
*
* @param component The component to be added.
* @param index The index in the component list to insert this child
* at, or -1 to add at the end of the list.
*
* @return The same component that was added.
*
* @param throws ArrayIndexOutOfBounds If the specified index is invalid.
*/
public Component add (Component comp, int index)
{
addImpl (comp, null, index);
return comp;
}
/**
* Adds the specified component to this container at the end of the
* component list. The layout manager will use the specified constraints
* when laying out this component.
*
* @param component The component to be added to this container.
* @param constraints The layout constraints for this component.
*/
public void add (Component comp, Object constraints)
{
addImpl (comp, constraints, -1);
}
/**
* Adds the specified component to this container at the specified index
* in the component list. The layout manager will use the specified
* constraints when layout out this component.
*
* @param component The component to be added.
* @param constraints The layout constraints for this component.
* @param index The index in the component list to insert this child
* at, or -1 to add at the end of the list.
*
* @param throws ArrayIndexOutOfBounds If the specified index is invalid.
*/
public void add (Component comp, Object constraints, int index)
{
addImpl (comp, constraints, index);
}
/**
* This method is called by all the <code>add()</code> methods to perform
* the actual adding of the component. Subclasses who wish to perform
* their own processing when a component is added should override this
* method. Any subclass doing this must call the superclass version of
* this method in order to ensure proper functioning of the container.
*
* @param component The component to be added.
* @param constraints The layout constraints for this component, or
* <code>null</code> if there are no constraints.
* @param index The index in the component list to insert this child
* at, or -1 to add at the end of the list.
*
* @param throws ArrayIndexOutOfBounds If the specified index is invalid.
*/
protected void addImpl (Component comp, Object constraints, int index)
{
if (index > ncomponents
|| (index < 0 && index != -1)
|| comp instanceof Window
|| (comp instanceof Container
&& ((Container) comp).isAncestorOf (this)))
......@@ -151,21 +277,29 @@ public class Container extends Component
// Notify the layout manager.
if (layoutMgr != null)
{
if (constraints != null && layoutMgr instanceof LayoutManager2)
if (layoutMgr instanceof LayoutManager2)
{
LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
lm2.addLayoutComponent (comp, constraints);
}
else
else if (constraints instanceof String)
layoutMgr.addLayoutComponent ((String) constraints, comp);
else
layoutMgr.addLayoutComponent (null, comp);
}
// Post event to notify of adding the container.
ContainerEvent ce = new ContainerEvent (this,
ContainerEvent.COMPONENT_ADDED,
comp);
dispatchEvent (ce);
getToolkit().getSystemEventQueue().postEvent(ce);
}
/**
* Removes the component at the specified index from this container.
*
* @param index The index of the component to remove.
*/
public void remove (int index)
{
Component r = component[index];
......@@ -181,12 +315,18 @@ public class Container extends Component
if (layoutMgr != null)
layoutMgr.removeLayoutComponent (r);
// Post event to notify of adding the container.
ContainerEvent ce = new ContainerEvent (this,
ContainerEvent.COMPONENT_REMOVED,
r);
dispatchEvent (ce);
getToolkit().getSystemEventQueue().postEvent(ce);
}
/**
* Removes the specified component from this container.
*
* @return component The component to remove from this container.
*/
public void remove (Component comp)
{
for (int i = 0; i < ncomponents; ++i)
......@@ -199,51 +339,89 @@ public class Container extends Component
}
}
/**
* Removes all components from this container.
*/
public void removeAll()
{
while (ncomponents > 0)
remove (0);
}
/**
* Returns the current layout manager for this container.
*
* @return The layout manager for this container.
*/
public LayoutManager getLayout()
{
return layoutMgr;
}
/**
* Sets the layout manager for this container to the specified layout
* manager.
*
* @param mgr The new layout manager for this container.
*/
public void setLayout(LayoutManager mgr)
{
layoutMgr = mgr;
invalidate ();
}
/**
* Layout the components in this container.
*/
public void doLayout()
{
if (layoutMgr != null)
layoutMgr.layoutContainer (this);
}
/** @deprecated Use doLayout() instead. */
/**
* Layout the components in this container.
*
* @deprecated This method is deprecated in favor of
* <code>doLayout()</code>.
*/
public void layout()
{
doLayout();
}
/**
* Invalidates this container to indicate that it (and all parent
* containers) need to be laid out.
*/
public void invalidate()
{
super.invalidate ();
}
/**
* Re-lays out the components in this container.
*/
public void validate()
{
// FIXME: use the tree lock?
synchronized (this)
{
if (! isValid ())
{
validateTree ();
}
}
}
/**
* Recursively validates the container tree, recomputing any invalid
* layouts.
*/
protected void validateTree()
{
if (valid) return;
if (valid)
return;
ContainerPeer cPeer = null;
if ((peer != null) && !(peer instanceof LightweightPeer))
......@@ -256,6 +434,8 @@ public class Container extends Component
for (int i = 0; i < ncomponents; ++i)
{
Component comp = component[i];
if (! comp.isValid ())
{
if (comp instanceof Container)
{
((Container) comp).validateTree();
......@@ -265,6 +445,7 @@ public class Container extends Component
component[i].validate();
}
}
}
/* children will call invalidate() when they are layed out. It
is therefore imporant that valid is not set to true
......@@ -281,6 +462,11 @@ public class Container extends Component
// FIXME, should invalidate all children with font == null
}
/**
* Returns the preferred size of this container.
*
* @return The preferred size of this container.
*/
public Dimension getPreferredSize()
{
if (layoutMgr != null)
......@@ -289,12 +475,24 @@ public class Container extends Component
return super.getPreferredSize ();
}
/** @deprecated Use getPreferredSize() instead */
/**
* Returns the preferred size of this container.
*
* @return The preferred size of this container.
*
* @deprecated This method is deprecated in favor of
* <code>getPreferredSize()</code>.
*/
public Dimension preferredSize()
{
return getPreferredSize();
}
/**
* Returns the minimum size of this container.
*
* @return The minimum size of this container.
*/
public Dimension getMinimumSize()
{
if (layoutMgr != null)
......@@ -303,12 +501,24 @@ public class Container extends Component
return super.getMinimumSize ();
}
/** @deprecated Use getMinimumSize() instead */
/**
* Returns the minimum size of this container.
*
* @return The minimum size of this container.
*
* @deprecated This method is deprecated in favor of
* <code>getMinimumSize()</code>.
*/
public Dimension minimumSize()
{
return getMinimumSize();
}
/**
* Returns the maximum size of this container.
*
* @return The maximum size of this container.
*/
public Dimension getMaximumSize()
{
if (layoutMgr != null && layoutMgr instanceof LayoutManager2)
......@@ -320,6 +530,13 @@ public class Container extends Component
return super.getMaximumSize ();
}
/**
* Returns the preferred alignment along the X axis. This is a value
* between 0 and 1 where 0 represents alignment flush left and
* 1 means alignment flush right, and 0.5 means centered.
*
* @return The preferred alignment along the X axis.
*/
public float getAlignmentX()
{
if (layoutMgr instanceof LayoutManager2)
......@@ -328,9 +545,16 @@ public class Container extends Component
return lm2.getLayoutAlignmentX (this);
}
else
return CENTER_ALIGNMENT;
return super.getAlignmentX();
}
/**
* Returns the preferred alignment along the Y axis. This is a value
* between 0 and 1 where 0 represents alignment flush top and
* 1 means alignment flush bottom, and 0.5 means centered.
*
* @return The preferred alignment along the Y axis.
*/
public float getAlignmentY()
{
if (layoutMgr instanceof LayoutManager2)
......@@ -339,9 +563,18 @@ public class Container extends Component
return lm2.getLayoutAlignmentY (this);
}
else
return CENTER_ALIGNMENT;
return super.getAlignmentY();
}
/**
* Paints this container. The implementation of this method in this
* class forwards to any lightweight components in this container. If
* this method is subclassed, this method should still be invoked as
* a superclass method so that lightweight components are properly
* drawn.
*
* @param graphics The graphics context for this paint job.
*/
public void paint(Graphics g)
{
if (!isShowing())
......@@ -408,23 +641,51 @@ public class Container extends Component
visitor.visit(comp, gfx2);
}
/**
* Updates this container. The implementation of this method in this
* class forwards to any lightweight components in this container. If
* this method is subclassed, this method should still be invoked as
* a superclass method so that lightweight components are properly
* drawn.
*
* @param graphics The graphics context for this update.
*/
public void update(Graphics g)
{
super.update(g);
}
/**
* Prints this container. The implementation of this method in this
* class forwards to any lightweight components in this container. If
* this method is subclassed, this method should still be invoked as
* a superclass method so that lightweight components are properly
* drawn.
*
* @param graphics The graphics context for this print job.
*/
public void print(Graphics g)
{
super.print(g);
visitChildren(g, GfxPrintVisitor.INSTANCE, true);
}
/**
* Paints all of the components in this container.
*
* @param graphics The graphics context for this paint job.
*/
public void paintComponents(Graphics g)
{
super.paint(g);
visitChildren(g, GfxPaintAllVisitor.INSTANCE, true);
}
/**
* Prints all of the components in this container.
*
* @param graphics The graphics context for this print job.
*/
public void printComponents(Graphics g)
{
super.paint(g);
......@@ -438,15 +699,28 @@ public class Container extends Component
&& (containerListener != null
|| (eventMask & AWTEvent.CONTAINER_EVENT_MASK) != 0))
processEvent(e);
else super.dispatchEventImpl(e);
else
super.dispatchEventImpl(e);
}
public void addContainerListener(ContainerListener l)
/**
* Adds the specified container listener to this object's list of
* container listeners.
*
* @param listener The listener to add.
*/
public synchronized void addContainerListener(ContainerListener l)
{
containerListener = AWTEventMulticaster.add (containerListener, l);
}
public void removeContainerListener(ContainerListener l)
/**
* Removes the specified container listener from this object's list of
* container listeners.
*
* @param listener The listener to remove.
*/
public synchronized void removeContainerListener(ContainerListener l)
{
containerListener = AWTEventMulticaster.remove(containerListener, l);
}
......@@ -459,6 +733,14 @@ public class Container extends Component
else return super.getListeners(listenerType);
}
/**
* Processes the specified event. This method calls
* <code>processContainerEvent()</code> if this method is a
* <code>ContainerEvent</code>, otherwise it calls the superclass
* method.
*
* @param event The event to be processed.
*/
protected void processEvent(AWTEvent e)
{
if (e instanceof ContainerEvent)
......@@ -466,6 +748,12 @@ public class Container extends Component
else super.processEvent(e);
}
/**
* Called when a container event occurs if container events are enabled.
* This method calls any registered listeners.
*
* @param event The event that occurred.
*/
protected void processContainerEvent(ContainerEvent e)
{
if (containerListener == null)
......@@ -482,11 +770,32 @@ public class Container extends Component
}
}
/** @deprecated */
/**
* AWT 1.0 event processor.
*
* @param event The event that occurred.
*
* @deprecated This method is deprecated in favor of
* <code>dispatchEvent()</code>.
*/
public void deliverEvent(Event e)
{
}
/**
* Returns the component located at the specified point. This is done
* by checking whether or not a child component claims to contain this
* point. The first child component that does is returned. If no
* child component claims the point, the container itself is returned,
* unless the point does not exist within this container, in which
* case <code>null</code> is returned.
*
* @param x The X coordinate of the point.
* @param y The Y coordinate of the point.
*
* @return The component containing the specified point, or
* <code>null</code> if there is no such point.
*/
public Component getComponentAt (int x, int y)
{
if (! contains (x, y))
......@@ -505,12 +814,40 @@ public class Container extends Component
return this;
}
/** @deprecated Use getComponentAt() instead */
/**
* Returns the component located at the specified point. This is done
* by checking whether or not a child component claims to contain this
* point. The first child component that does is returned. If no
* child component claims the point, the container itself is returned,
* unless the point does not exist within this container, in which
* case <code>null</code> is returned.
*
* @param point The point to return the component at.
*
* @return The component containing the specified point, or <code>null</code>
* if there is no such point.
*
* @deprecated This method is deprecated in favor of
* <code>getComponentAt(int, int)</code>.
*/
public Component locate(int x, int y)
{
return getComponentAt(x, y);
}
/**
* Returns the component located at the specified point. This is done
* by checking whether or not a child component claims to contain this
* point. The first child component that does is returned. If no
* child component claims the point, the container itself is returned,
* unless the point does not exist within this container, in which
* case <code>null</code> is returned.
*
* @param point The point to return the component at.
*
* @return The component containing the specified point, or <code>null</code>
* if there is no such point.
*/
public Component getComponentAt(Point p)
{
return getComponentAt(p.x, p.y);
......@@ -550,12 +887,21 @@ public class Container extends Component
return findComponentAt(p.x, p.y);
}
/**
* Called when this container is added to another container to inform it
* to create its peer. Peers for any child components will also be
* created.
*/
public void addNotify ()
{
if (peer == null)
{
addNotifyContainerChildren ();
super.addNotify();
}
}
void addNotifyContainerChildren()
private void addNotifyContainerChildren()
{
for (int i = ncomponents; --i >= 0; )
{
......@@ -565,6 +911,11 @@ public class Container extends Component
}
}
/**
* Called when this container is removed from its parent container to
* inform it to destroy its peer. This causes the peers of all child
* component to be destroyed as well.
*/
public void removeNotify()
{
for (int i = 0; i < ncomponents; ++i)
......@@ -572,6 +923,15 @@ public class Container extends Component
super.removeNotify();
}
/**
* Tests whether or not the specified component is contained within
* this components subtree.
*
* @param component The component to test.
*
* @return <code>true</code> if this container is an ancestor of the
* specified component, <code>false</code>.
*/
public boolean isAncestorOf (Component comp)
{
for (;;)
......@@ -584,6 +944,12 @@ public class Container extends Component
}
}
/**
* Returns a string representing the state of this container for
* debugging purposes.
*
* @return A string representing the state of this container.
*/
protected String paramString()
{
String param = super.paramString();
......@@ -593,6 +959,13 @@ public class Container extends Component
return param;
}
/**
* Writes a listing of this container to the specified stream starting
* at the specified indentation point.
*
* @param stream The <code>PrintStream</code> to write to.
* @param indent The indentation point.
*/
public void list (PrintStream out, int indent)
{
super.list (out, indent);
......@@ -600,6 +973,13 @@ public class Container extends Component
component[i].list (out, indent + 2);
}
/**
* Writes a listing of this container to the specified stream starting
* at the specified indentation point.
*
* @param stream The <code>PrintWriter</code> to write to.
* @param indent The indentation point.
*/
public void list(PrintWriter out, int indent)
{
super.list (out, indent);
......
/* Copyright (C) 1999, 2000 Free Software Foundation
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of libjava.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
package java.awt;
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
/** @author Bryce McKinlay */
......
/* Copyright (C) 2000, 2001 Free Software Foundation
/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt;
......@@ -18,8 +36,14 @@ import java.lang.reflect.InvocationTargetException;
* Status: Believed complete, but untested. Check FIXME's.
*/
/** @author Bryce McKinlay */
/**
* This class manages a queue of <code>AWTEvent</code> objects that
* are posted to it. The AWT system uses only one event queue for all
* events.
*
* @author Bryce McKinlay
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class EventQueue
{
private static final int INITIAL_QUEUE_DEPTH = 8;
......@@ -33,10 +57,22 @@ public class EventQueue
private EventDispatchThread dispatchThread = new EventDispatchThread(this);
/**
* Initializes a new instance of <code>EventQueue</code>.
*/
public EventQueue()
{
}
/**
* Returns the next event in the queue. This method will block until
* an event is available or until the thread is interrupted.
*
* @return The next event in the queue.
*
* @exception InterruptedException If this thread is interrupted while
* waiting for an event to be posted to the queue.
*/
public synchronized AWTEvent getNextEvent()
throws InterruptedException
{
......@@ -53,7 +89,13 @@ public class EventQueue
return res;
}
/** @specnote Does not block. Returns null if there are no events on the
/**
* Returns the next event in the queue without removing it from the queue.
* This method will block until an event is available or until the thread
* is interrupted.
*
* @return The next event in the queue.
* @specnote Does not block. Returns null if there are no events on the
* queue.
*/
public synchronized AWTEvent peekEvent()
......@@ -66,7 +108,17 @@ public class EventQueue
else return null;
}
/** @specnote Does not block. Returns null if there are no matching events
/**
* Returns the next event in the queue that has the specified id
* without removing it from the queue.
* This method will block until an event is available or until the thread
* is interrupted.
*
* @param id The event id to return.
*
* @return The next event in the queue.
*
* @specnote Does not block. Returns null if there are no matching events
* on the queue.
*/
public synchronized AWTEvent peekEvent(int id)
......@@ -84,6 +136,11 @@ public class EventQueue
return null;
}
/**
* Posts a new event to the queue.
*
* @param event The event to post to the queue.
*/
public synchronized void postEvent(AWTEvent evt)
{
if (next != null)
......
// FlowLayout.java - Grid-based layout engine
/* Copyright (C) 2000, 2001 Free Software Foundation
/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt;
......@@ -17,6 +35,9 @@ import java.io.Serializable;
* without horizontal clipping, a new row is started. This class
* supports horizontal and vertical gaps. These are used for spacing
* between components.
*
* @author Tom Tromey <tromey@redhat.com>
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class FlowLayout implements LayoutManager, Serializable
{
......@@ -34,6 +55,9 @@ public class FlowLayout implements LayoutManager, Serializable
* orientation. */
public static final int TRAILING = 4;
// Serialization constant
private static final long serialVersionUID = -7262534875583282631L;
/** Add a new component to the layout. This particular implementation
* does nothing.
*/
......@@ -42,42 +66,60 @@ public class FlowLayout implements LayoutManager, Serializable
// Nothing.
}
/** Return the alignment. */
/**
* Returns the current justification value for this object.
*
* @return The current justification value for this object.
*/
public int getAlignment ()
{
return align;
}
/** Return the horizontal gap. */
/**
* Returns the horizontal gap between components.
*
* @return The horizontal gap between components.
*/
public int getHgap ()
{
return hgap;
}
/** Return the vertical gap. */
/**
* Returns the vertical gap between lines of components.
*
* @return The vertical gap between lines of components.
*/
public int getVgap ()
{
return vgap;
}
/** Create a new FlowLayout with center alignment.
* Both gaps are set to 5.
/**
* Initializes a new instance of <code>FlowLayout</code> with a center
* justification and a default horizontal and vertical gap of 5.
*/
public FlowLayout ()
{
this (CENTER, 5, 5);
}
/** Create a new FlowLayout with the alignment.
* columns. Both gaps are set to 5.
* @param align Alignment
/**
* Initializes a new instance of <code>FlowLayout</code> with the specified
* justification and a default horizontal and vertical gap of 5.
*
* @param align The justification setting, which should be one of the
* contants in this class.
*/
public FlowLayout (int align)
{
this (align, 5, 5);
}
/** Create a new FlowLayout with the specified alignment and gaps.
/**
* Initializes a new instance of <code>FlowLayout</code> with the specified
* justification and gap values
* @param align Alignment
* @param hgap The horizontal gap
* @param vgap The vertical gap
......@@ -118,13 +160,12 @@ public class FlowLayout implements LayoutManager, Serializable
boolean found_one = false;
for (j = i; j < num && ! found_one; ++j)
{
// FIXME: this is very inefficient.
Dimension c = comps[i].getPreferredSize ();
// Skip invisible items.
if (! comps[i].visible)
continue;
Dimension c = comps[i].getPreferredSize ();
int next_w = new_w + hgap + c.width;
if (next_w <= d.width || ! found_one)
{
......@@ -157,10 +198,9 @@ public class FlowLayout implements LayoutManager, Serializable
for (int k = i; i < j; ++k)
{
// FIXME: this is very inefficient.
Dimension c = comps[i].getPreferredSize ();
if (comps[i].visible)
{
Dimension c = comps[i].getPreferredSize ();
comps[i].setLocation (x, y);
x += c.width + vgap;
}
......@@ -172,16 +212,22 @@ public class FlowLayout implements LayoutManager, Serializable
}
}
/** Get the minimum layout size of the container.
/**
* Returns the minimum layout size for the specified container using
* this layout.
* @param cont The parent container
* @return The minimum layout size.
*/
public Dimension minimumLayoutSize (Container cont)
{
return getSize (cont, true);
}
/** Get the preferred layout size of the container.
/**
* Returns the preferred layout size for the specified container using
* this layout.
* @param cont The parent container
* @return The preferred layout size.
*/
public Dimension preferredLayoutSize (Container cont)
{
......@@ -197,19 +243,24 @@ public class FlowLayout implements LayoutManager, Serializable
// Nothing.
}
/** Set the alignment.
* @param align The alignment
/**
* Sets the justification value for this object to the specified value.
*
* @param align The new justification value for this object, which must
* be one of the constants in this class.
*/
public void setAlignment (int align)
{
if (align != LEFT && align != RIGHT && align != CENTER
&& align != LEADING && align != TRAILING)
throw new IllegalArgumentException ("invalid align: " + align);
throw new IllegalArgumentException ("invalid alignment: " + align);
this.align = align;
}
/** Set the horizontal gap
* @param hgap The horizontal gap
/**
* Sets the horizontal gap between components to the specified value.
*
* @param hgap The new horizontal gap between components.
*/
public void setHgap (int hgap)
{
......@@ -218,8 +269,10 @@ public class FlowLayout implements LayoutManager, Serializable
this.hgap = hgap;
}
/** Set the vertical gap.
* @param vgap The vertical gap
/**
* Sets the vertical gap between lines of components to the specified value.
*
* @param vgap The new vertical gap.
*/
public void setVgap (int vgap)
{
......@@ -228,7 +281,9 @@ public class FlowLayout implements LayoutManager, Serializable
this.vgap = vgap;
}
/** Return String description of this object. */
/** Return String description of this object.
* @return A string representation of this object.
*/
public String toString ()
{
return ("[" + getClass ().getName () + ",hgap=" + hgap + ",vgap=" + vgap
......@@ -270,9 +325,19 @@ public class FlowLayout implements LayoutManager, Serializable
return new Dimension (w, h);
}
// Alignment.
/**
* @serial The justification alignment of the lines of components, which
* will be one of the constants defined in this class.
*/
private int align;
// The gaps.
/**
* @serial The horizontal gap between components.
*/
private int hgap;
/**
* @serial The vertical gap between lines of components.
*/
private int vgap;
}
/* Copyright (C) 1999, 2000 Free Software Foundation
/* Frame.java -- AWT toplevel window
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of libjava.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
package java.awt;
import java.awt.peer.FramePeer;
/* A very incomplete placeholder. */
import java.awt.peer.FramePeer;
import java.awt.peer.WindowPeer;
import java.awt.peer.ContainerPeer;
import java.awt.peer.ComponentPeer;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;
public class Frame extends Window implements MenuContainer
/**
* This class is a top-level window with a title bar and window
* decorations.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class Frame extends Window implements MenuContainer, Serializable
{
public static final int NORMAL = 0;
public static final int ICONIFIED = 1;
MenuBar menuBar = null;
String title;
/*
* Static Variables
*/
private transient Image iconImage;
private transient boolean isResizable = true;
private transient int state = NORMAL;
/**
* Constant for a cross-hair cursor.
* @deprecated Use <code>Cursor.CROSSHAIR_CURSOR</code> instead.
*/
public static final int CROSSHAIR_CURSOR = Cursor.CROSSHAIR_CURSOR;
public Frame ()
{
super();
}
/**
* Constant for a cursor over a text field.
* @deprecated Use <code>Cursor.TEXT_CURSOR</code> instead.
*/
public static final int TEXT_CURSOR = Cursor.TEXT_CURSOR;
public Frame(GraphicsConfiguration gc)
{
super(gc);
}
/**
* Constant for a cursor to display while waiting for an action to complete.
* @deprecated Use <code>Cursor.WAIT_CURSOR</code>.
*/
public static final int WAIT_CURSOR = Cursor.WAIT_CURSOR;
public Frame (String title)
{
/**
* Cursor used over SW corner of window decorations.
* @deprecated Use <code>Cursor.SW_RESIZE_CURSOR</code> instead.
*/
public static final int SW_RESIZE_CURSOR = Cursor.SW_RESIZE_CURSOR;
/**
* Cursor used over SE corner of window decorations.
* @deprecated Use <code>Cursor.SE_RESIZE_CURSOR</code> instead.
*/
public static final int SE_RESIZE_CURSOR = Cursor.SE_RESIZE_CURSOR;
/**
* Cursor used over NW corner of window decorations.
* @deprecated Use <code>Cursor.NW_RESIZE_CURSOR</code> instead.
*/
public static final int NW_RESIZE_CURSOR = Cursor.NW_RESIZE_CURSOR;
/**
* Cursor used over NE corner of window decorations.
* @deprecated Use <code>Cursor.NE_RESIZE_CURSOR</code> instead.
*/
public static final int NE_RESIZE_CURSOR = Cursor.NE_RESIZE_CURSOR;
/**
* Cursor used over N edge of window decorations.
* @deprecated Use <code>Cursor.N_RESIZE_CURSOR</code> instead.
*/
public static final int N_RESIZE_CURSOR = Cursor.N_RESIZE_CURSOR;
/**
* Cursor used over S edge of window decorations.
* @deprecated Use <code>Cursor.S_RESIZE_CURSOR</code> instead.
*/
public static final int S_RESIZE_CURSOR = Cursor.S_RESIZE_CURSOR;
/**
* Cursor used over E edge of window decorations.
* @deprecated Use <code>Cursor.E_RESIZE_CURSOR</code> instead.
*/
public static final int E_RESIZE_CURSOR = Cursor.E_RESIZE_CURSOR;
/**
* Cursor used over W edge of window decorations.
* @deprecated Use <code>Cursor.W_RESIZE_CURSOR</code> instead.
*/
public static final int W_RESIZE_CURSOR = Cursor.W_RESIZE_CURSOR;
/**
* Constant for a hand cursor.
* @deprecated Use <code>Cursor.HAND_CURSOR</code> instead.
*/
public static final int HAND_CURSOR = Cursor.HAND_CURSOR;
/**
* Constant for a cursor used during window move operations.
* @deprecated Use <code>Cursor.MOVE_CURSOR</code> instead.
*/
public static final int MOVE_CURSOR = Cursor.MOVE_CURSOR;
// Serialization version constant
private static final long serialVersionUID = 2673458971256075116L;
/*************************************************************************/
/*
* Instance Variables
*/
/**
* @serial The version of the class data being serialized
* // FIXME: what is this value?
*/
private int frameSerializedDataVersion;
/**
* @serial Image used as the icon when this frame is minimized.
*/
private Image icon;
/**
* @serial Constant used by the JDK Motif peer set. Not used in
* this implementation.
*/
private boolean mbManagement;
/**
* @serial The menu bar for this frame.
*/
//private MenuBar menuBar = new MenuBar();
private MenuBar menuBar;
/**
* @serial A list of other top-level windows owned by this window.
*/
Vector ownedWindows = new Vector();
/**
* @serial Indicates whether or not this frame is resizable.
*/
private boolean resizable = true;
/**
* @serial The state of this frame.
* // FIXME: What are the values here?
*/
private int state;
/**
* @serial The title of the frame.
*/
private String title = "";
/*************************************************************************/
/*
* Constructors
*/
/**
* Initializes a new instance of <code>Frame</code> that is not visible
* and has no title.
*/
public
Frame()
{
this("");
}
/*************************************************************************/
/**
* Initializes a new instance of <code>Frame</code> that is not visible
* and has the specified title.
*
* @param title The title of this frame.
*/
public
Frame(String title)
{
super();
setTitle(title);
}
System.err.println("returned");
this.title = title;
System.err.println("end");
}
public Frame(String title, GraphicsConfiguration gc)
{
public
Frame(GraphicsConfiguration gc)
{
super(gc);
}
public
Frame(String title, GraphicsConfiguration gc)
{
super(gc);
setTitle(title);
}
}
public String getTitle()
{
return (title != null) ? title : "";
}
/*************************************************************************/
public void setTitle (String title)
{
/*
* Instance Methods
*/
/**
* Returns this frame's title string.
*
* @return This frame's title string.
*/
public String
getTitle()
{
return(title);
}
/*************************************************************************/
/*
* Sets this frame's title to the specified value.
*
* @param title The new frame title.
*/
public synchronized void
setTitle(String title)
{
this.title = title;
if (peer != null)
((FramePeer)peer).setTitle(title);
}
((FramePeer) peer).setTitle(title);
}
public Image getIconImage()
{
return iconImage;
}
/*************************************************************************/
public void setIconImage(Image image)
{
iconImage = image;
/**
* Returns this frame's icon.
*
* @return This frame's icon, or <code>null</code> if this frame does not
* have an icon.
*/
public Image
getIconImage()
{
return(icon);
}
/*************************************************************************/
/**
* Sets this frame's icon to the specified value.
*
* @icon The new icon for this frame.
*/
public synchronized void
setIconImage(Image icon)
{
this.icon = icon;
if (peer != null)
((FramePeer) peer).setIconImage(iconImage);
}
((FramePeer) peer).setIconImage(icon);
}
protected void finalize() throws Throwable
{
//frames.remove(this);
/* FIXME: This won't work. Finalize will never be called if frames
has a reference to the object. We need weak references to
implement this correctly. */
/*************************************************************************/
super.finalize();
}
/**
* Returns this frame's menu bar.
*
* @return This frame's menu bar, or <code>null</code> if this frame
* does not have a menu bar.
*/
public MenuBar
getMenuBar()
{
return(menuBar);
}
public synchronized void setMenuBar (MenuBar menuBar)
{
if (this.menuBar != menuBar)
{
//this.menuBar.removeNotify();
this.menuBar = menuBar;
//this.menuBar.addNotify();
}
/*************************************************************************/
/**
* Sets this frame's menu bar.
*
* @param menuBar The new menu bar for this frame.
*/
public synchronized void
setMenuBar(MenuBar menuBar)
{
this.menuBar = menuBar;
if (peer != null)
((FramePeer) peer).setMenuBar(menuBar);
}
}
public boolean isResizable()
{
return isResizable;
}
/*************************************************************************/
public void setResizable(boolean resizable)
{
isResizable = resizable;
/**
* Tests whether or not this frame is resizable. This will be
* <code>true</code> by default.
*
* @return <code>true</code> if this frame is resizable, <code>false</code>
* otherwise.
*/
public boolean
isResizable()
{
return(resizable);
}
/*************************************************************************/
/**
* Sets the resizability of this frame to the specified value.
*
* @param resizable <code>true</code> to make the frame resizable,
* <code>false</code> to make it non-resizable.
*/
public synchronized void
setResizable(boolean resizable)
{
this.resizable = resizable;
if (peer != null)
((FramePeer) peer).setResizable(isResizable);
}
((FramePeer) peer).setResizable(resizable);
}
public int getState()
{
/* FIXME: State might have changed in the peer... Must check. */
/*************************************************************************/
return state;
}
/**
* Returns the cursor type of the cursor for this window. This will
* be one of the constants in this class.
*
* @return The cursor type for this frame.
*
* @deprecated Use <code>Component.getCursor()</code> instead.
*/
public int
getCursorType()
{
return(getCursor().getType());
}
/*************************************************************************/
public synchronized void addNotify ()
{
/**
* Sets the cursor for this window to the specified type. The specified
* type should be one of the constants in this class.
*
* @param type The cursor type.
*
* @deprecated. Use <code>Component.setCursor(Cursor)</code> instead.
*/
public void
setCursor(int type)
{
setCursor(new Cursor(type));
}
/*************************************************************************/
/**
* Removes the specified component from this frame's menu.
*
* @param menu The menu component to remove.
*/
public void
remove(MenuComponent menu)
{
menuBar.remove(menu);
}
/*************************************************************************/
/**
* Notifies this frame that it should create its native peer.
*/
public void
addNotify()
{
if (peer == null)
peer = getToolkit ().createFrame (this);
super.addNotify();
}
}
public boolean postEvent(Event evt) { return false; } // FIXME
/*************************************************************************/
public void remove(MenuComponent m)
{
if (m == menuBar)
/**
* Destroys any resources associated with this frame. This includes
* all components in the frame and all owned toplevel windows.
*/
public void
dispose()
{
Enumeration e = ownedWindows.elements();
while(e.hasMoreElements())
{
setMenuBar(null);
return;
Window w = (Window)e.nextElement();
w.dispose();
}
super.remove(m);
}
super.dispose();
}
public void removeNotify()
{
//if ((peer != null) && (menuBar != null)) menuBar.removeNotify();
super.removeNotify();
}
/*************************************************************************/
public static Frame[] getFrames()
{
/**
* Returns a debugging string describing this window.
*
* @return A debugging string describing this window.
*/
protected String
paramString()
{
return(getClass().getName());
}
public int
getState()
{
/* FIXME: State might have changed in the peer... Must check. */
return state;
}
public static Frame[]
getFrames()
{
//Frame[] array = new Frames[frames.size()];
//return frames.toArray(array);
// see finalize() comment
String msg = "FIXME: can't be implemented without weak references";
throw new UnsupportedOperationException(msg);
}
}
} // class Frame
/* Copyright (C) 2000 Free Software Foundation
/* Graphics.java -- Abstract Java drawing class
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of libgcj.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt;
import java.awt.image.ImageObserver;
/**
* This is the abstract superclass of classes for drawing to graphics
* devices such as the screen or printers.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy <warrenl@cygnus.com>
* @date March 15, 2000.
*/
public abstract class Graphics
{
/*
* Instance Variables
*/
/*************************************************************************/
/*
* Constructors
*/
/**
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Almost complete
* Default constructor for subclasses.
*/
protected
Graphics()
{
}
public abstract class Graphics
/*************************************************************************/
/*
* Instance Methods
*/
/**
* Returns a copy of this <code>Graphics</code> object.
*
* @return A copy of this object.
*/
public abstract Graphics
create();
/*************************************************************************/
/**
* Returns a copy of this <code>Graphics</code> object. The origin point
* will be translated to the point (x, y) and the cliping rectangle set
* to the intersection of the clipping rectangle in this object and the
* rectangle specified by the parameters to this method.
*
* @param x The new X coordinate of the clipping region rect.
* @param y The new Y coordinate of the clipping region rect.
* @param width The width of the clipping region intersect rectangle.
* @param height The height of the clipping region intersect rectangle.
*
* @return A copy of this object, modified as specified.
*/
public Graphics
create(int x, int y, int width, int height)
{
protected Graphics() {}
Graphics g = create();
public abstract Graphics create();
g.translate(x, y);
// FIXME: I'm not sure if this will work. Are the old clip rect bounds
// translated above?
g.clipRect(0, 0, width, height);
public Graphics create(int x, int y, int width, int height)
{
Graphics gfx = create();
gfx.translate(x, y);
gfx.setClip(0, y, width, height);
return gfx;
}
return(g);
}
/*************************************************************************/
/**
* Translates this context so that its new origin point is the point
* (x, y).
*
* @param x The new X coordinate of the origin.
* @param y The new Y coordinate of the origin.
*/
public abstract void
translate(int x, int y);
public abstract void translate(int x, int y);
/*************************************************************************/
public abstract Color getColor();
/**
* Returns the current color for this object.
*
* @return The color for this object.
*/
public abstract Color
getColor();
/*************************************************************************/
/**
* Sets the current color for this object.
*
* @param color The new color.
*/
public abstract void
setColor(Color color);
public abstract void setColor(Color color);
/*************************************************************************/
public abstract void setPaintMode();
/**
* Sets this context into "paint" mode, where the target pixels are
* completely overwritten when drawn on.
*/
public abstract void
setPaintMode();
public abstract void setXORMode(Color altColor);
/*************************************************************************/
public abstract Font getFont();
/**
* Sets this context info "XOR" mode, where the targe pixles are
* XOR-ed when drawn on.
*
* @param color The color to XOR against.
*/
public abstract void
setXORMode(Color color);
public abstract void setFont(Font font);
/*************************************************************************/
public FontMetrics getFontMetrics()
{
return getFontMetrics(getFont());
}
/**
* Returns the current font for this graphics context.
*
* @return The current font.
*/
public abstract Font
getFont();
public abstract FontMetrics getFontMetrics(Font font);
/*************************************************************************/
public abstract Rectangle getClipBounds();
/**
* Sets the font for this graphics context to the specified value.
*
* @param font The new font.
*/
public abstract void
setFont(Font font);
public abstract void clipRect(int x, int y, int width, int height);
/*************************************************************************/
public abstract void setClip(int x, int y, int width, int height);
/**
* Returns the font metrics for the current font.
*
* @return The font metrics for the current font.
*/
public FontMetrics
getFontMetrics()
{
return(getFontMetrics(getFont()));
}
public abstract Shape getClip();
/*************************************************************************/
public abstract void setClip(Shape clip);
/**
* Returns the font metrics for the specified font.
*
* @param font The font to return metrics for.
*
* @return The requested font metrics.
*/
public abstract FontMetrics
getFontMetrics(Font font);
public abstract void copyArea(int x, int y, int width, int height,
int dx, int dy);
/*************************************************************************/
public abstract void drawLine(int x1, int y1, int x2, int y2);
/**
* Returns the bounding rectangle of the clipping region for this
* graphics context.
*
* @return The bounding rectangle for the clipping region.
*/
public abstract Rectangle
getClipBounds();
public abstract void fillRect(int x, int y, int width, int height);
/*************************************************************************/
public void drawRect(int x, int y, int width, int height)
{
/**
* Returns the bounding rectangle of the clipping region for this
* graphics context.
*
* @return The bounding rectangle for the clipping region.
*
* @deprecated This method is deprecated in favor of
* <code>getClipBounds()</code>.
*/
public Rectangle
getClipRect()
{
return(getClipBounds());
}
/*************************************************************************/
/**
* Sets the clipping region to the intersection of the current clipping
* region and the rectangle determined by the specified parameters.
*
* @param x The X coordinate of the upper left corner of the intersect rect.
* @param Y The Y coordinate of the upper left corner of the intersect rect.
* @param width The width of the intersect rect.
* @param height The height of the intersect rect.
*/
public abstract void
clipRect(int x, int y, int width, int height);
/*************************************************************************/
/**
* Sets the clipping region to the rectangle determined by the specified
* parameters.
*
* @param x The X coordinate of the upper left corner of the rect.
* @param y The Y coordinate of the upper left corner of the rect.
* @param width The width of the rect.
* @param height The height of the rect.
*/
public abstract void
setClip(int x, int y, int width, int height);
/*************************************************************************/
/**
* Returns the current clipping region as a <code>Shape</code> object.
*
* @return The clipping region as a <code>Shape</code>.
*/
public abstract Shape
getClip();
/*************************************************************************/
/**
* Sets the clipping region to the specified <code>Shape</code>.
*
* @param shape The new clipping region.
*/
public abstract void
setClip(Shape clip);
/*************************************************************************/
/**
* Copies the specified rectangle to the specified offset location.
*
* @param x The X coordinate of the upper left corner of the copy rect.
* @param y The Y coordinate of the upper left corner of the copy rect.
* @param width The width of the copy rect.
* @param height The height of the copy rect.
* @param dx The offset from the X value to start drawing.
* @param dy The offset from the Y value to start drawing.
*/
public abstract void
copyArea(int x, int y, int width, int height, int dx, int dy);
/*************************************************************************/
/**
* Draws a line between the two specified points.
*
* @param x1 The X coordinate of the first point.
* @param y1 The Y coordinate of the first point.
* @param x2 The X coordinate of the second point.
* @param y2 The Y coordinate of the second point.
*/
public abstract void
drawLine(int x1, int y1, int x2, int y2);
/*************************************************************************/
/**
* Fills the area bounded by the specified rectangle.
*
* @param x The X coordinate of the upper left corner of the fill rect.
* @param y The Y coordinate of the upper left corner of the fill rect.
* @param width The width of the fill rect.
* @param height The height of the fill rect.
*/
public abstract void
fillRect(int x, int y, int width, int height);
/*************************************************************************/
/**
* Draws the outline of the specified rectangle.
*
* @param x The X coordinate of the upper left corner of the draw rect.
* @param y The Y coordinate of the upper left corner of the draw rect.
* @param width The width of the draw rect.
* @param height The height of the draw rect.
*/
public void
drawRect(int x, int y, int width, int height)
{
int x1 = x;
int y1 = y;
int x2 = x + width;
......@@ -83,19 +334,56 @@ public abstract class Graphics
drawLine(x2, y1, x2, y2);
drawLine(x2, y2, x1, y2);
drawLine(x1, y2, x1, y1);
}
}
public abstract void clearRect(int x, int y, int width, int height);
/*************************************************************************/
public abstract void drawRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight);
/**
* Clears the specified rectangle.
*
* @param x The X coordinate of the upper left corner of the clear rect.
* @param y The Y coordinate of the upper left corner of the clear rect.
* @param width The width of the clear rect.
* @param height The height of the clear rect.
*/
public abstract void
clearRect(int x, int y, int width, int height);
public abstract void fillRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight);
/*************************************************************************/
public void draw3DRect(int x, int y, int width, int height,
boolean raised)
{
/**
* Draws the outline of the specified rectangle with rounded cornders.
*
* @param x The X coordinate of the upper left corner of the draw rect.
* @param y The Y coordinate of the upper left corner of the draw rect.
* @param width The width of the draw rect.
* @param height The height of the draw rect.
* @param arcWidth The width of the corner arcs.
* @param arcHeigth The height of the corner arcs.
*/
public abstract void
drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
/*************************************************************************/
/**
* Fills the specified rectangle with rounded cornders.
*
* @param x The X coordinate of the upper left corner of the fill rect.
* @param y The Y coordinate of the upper left corner of the fill rect.
* @param width The width of the fill rect.
* @param height The height of the fill rect.
* @param arcWidth The width of the corner arcs.
* @param arcHeigth The height of the corner arcs.
*/
public abstract void
fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
/*************************************************************************/
public void
draw3DRect(int x, int y, int width, int height, boolean raised)
{
Color color = getColor();
Color tl = color.brighter();
Color br = color.darker();
......@@ -119,108 +407,376 @@ public abstract class Graphics
drawLine(x2, y1, x2, y2);
drawLine(x2, y1, x1, y2);
setColor(color);
}
}
public void fill3DRect(int x, int y, int width, int height,
boolean raised)
{
/**
* Fills the specified rectangle with a 3D effect
*
* @param x The X coordinate of the upper left corner of the fill rect.
* @param y The Y coordinate of the upper left corner of the fill rect.
* @param width The width of the fill rect.
* @param height The height of the fill rect.
* @param raised <code>true</code> if the rectangle appears raised,
* <code>false</code> if it should appear etched.
*/
public void
fill3DRect(int x, int y, int width, int height, boolean raised)
{
fillRect(x, y, width, height);
draw3DRect(x, y, width-1, height-1, raised);
}
}
/*************************************************************************/
/**
* Draws the outline of the specified rectangle with a 3D effect
*
* @param x The X coordinate of the upper left corner of the draw rect.
* @param y The Y coordinate of the upper left corner of the draw rect.
* @param width The width of the draw rect.
* @param height The height of the draw rect.
* @param raised <code>true</code> if the rectangle appears raised,
* <code>false</code> if it should appear etched.
*/
public void
drawRoundRect(int x, int y, int width, int height, boolean raised)
{
// FIXME: ???
}
public abstract void drawOval(int x, int y, int width, int height);
/*************************************************************************/
public abstract void fillOval(int x, int y, int width, int height);
/**
* Draws an oval that just fits within the specified rectangle.
*
* @param x The X coordinate of the upper left corner of the rect.
* @param y The Y coordinate of the upper left corner of the rect.
* @param width The width of the rect.
* @param height The height of the rect.
*/
public abstract void
drawOval(int x, int y, int width, int height);
public abstract void drawArc(int x, int y, int width, int height,
int startAngle, int arcAngle);
/*************************************************************************/
/**
* Fills an oval that just fits within the specified rectangle.
*
* @param x The X coordinate of the upper left corner of the rect.
* @param y The Y coordinate of the upper left corner of the rect.
* @param width The width of the rect.
* @param height The height of the rect.
*/
public abstract void
fillOval(int x, int y, int width, int height);
public abstract void fillArc(int x, int y, int width, int height,
int startAngle, int arcAngle);
/*************************************************************************/
public abstract void drawPolyline(int[] xPoints, int[] yPoints,
int nPoints);
/**
* Draws an arc using the specified bounding rectangle and the specified
* angle parameter. The arc is centered at the center of the rectangle.
* The arc starts at the arcAngle position and extend for arcAngle
* degrees. The degree origin is at the 3 o'clock position.
*
* @param x The X coordinate of the upper left corner of the rect.
* @param y The Y coordinate of the upper left corner of the rect.
* @param width The width of the rect.
* @param height The height of the rect.
* @param arcStart The beginning angle of the arc.
* @param arcAngle The extent of the arc.
*/
public abstract void
drawArc(int x, int y, int width, int height, int startAngle, int arcAngle);
public abstract void drawPolygon(int[] xPoints, int[] yPoints,
int nPoints);
/*************************************************************************/
//public void drawPolygon(Polygon p);
/**
* Fills the arc define by the specified bounding rectangle and the specified
* angle parameter. The arc is centered at the center of the rectangle.
* The arc starts at the arcAngle position and extend for arcAngle
* degrees. The degree origin is at the 3 o'clock position.
*
* @param x The X coordinate of the upper left corner of the rect.
* @param y The Y coordinate of the upper left corner of the rect.
* @param width The width of the rect.
* @param height The height of the rect.
* @param arcStart The beginning angle of the arc.
* @param arcAngle The extent of the arc.
*/
public abstract void
fillArc(int x, int y, int width, int height, int startAngle, int arcAngle);
public abstract void fillPolygon(int[] xPoints, int[] yPoints,
int nPoints);
/*************************************************************************/
//public void fillPolygon(Polygon p);
/**
* Draws a series of interconnected lines determined by the arrays
* of corresponding x and y coordinates.
*
* @param xPoints The X coordinate array.
* @param yPoints The Y coordinate array.
* @param npoints The number of points to draw.
*/
public abstract void
drawPolyline(int xPoints[], int yPoints[], int npoints);
public abstract void drawString(String str, int x, int y);
/*************************************************************************/
/*
public abstract void drawString(AttributedCharacterIterator iterator,
int x, int y)
/**
* Draws a series of interconnected lines determined by the arrays
* of corresponding x and y coordinates. The figure is closed if necessary
* by connecting the first and last points.
*
* @param xPoints The X coordinate array.
* @param yPoints The Y coordinate array.
* @param npoints The number of points to draw.
*/
public abstract void
drawPolygon(int xPoints[], int yPoints[], int npoints);
public void drawChars(char[] data, int offset, int length,
int x, int y)
{
String str = new String(data, offset, length);
drawString(str, x, y);
}
/*************************************************************************/
/**
* Draws the specified polygon.
*
* @param polygon The polygon to draw.
*/
public void
drawPolygon(Polygon polygon)
{
drawPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);
}
/*************************************************************************/
/**
* Fills the polygon determined by the arrays
* of corresponding x and y coordinates.
*
* @param xPoints The X coordinate array.
* @param yPoints The Y coordinate array.
* @param npoints The number of points to draw.
*/
public abstract void
fillPolygon(int xPoints[], int yPoints[], int npoints);
/*************************************************************************/
/**
* Fills the specified polygon
*
* @param polygon The polygon to fill.
*/
public void
fillPolygon(Polygon polygon)
{
fillPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);
}
public void drawBytes(byte[] data, int offset, int length,
/*************************************************************************/
/**
* Draws the specified string starting at the specified point.
*
* @param string The string to draw.
* @param x The X coordinate of the point to draw at.
* @param y The Y coordinate of the point to draw at.
*/
public abstract void
drawString(String string, int x, int y);
/*************************************************************************/
/**
* Draws the specified characters starting at the specified point.
*
* @param data The array of characters to draw.
* @param offset The offset into the array to start drawing characters from.
* @param length The number of characters to draw.
* @param x The X coordinate of the point to draw at.
* @param y The Y coordinate of the point to draw at.
*/
public void
drawChars(char data[], int offset, int length, int x, int y)
{
drawString(new String(data, offset, length), x, y);
}
/*************************************************************************/
/**
* Draws the specified bytes as text starting at the specified point.
*
* @param data The array of bytes to draw.
* @param offset The offset into the array to start drawing bytes from.
* @param length The number of bytes to draw.
* @param x The X coordinate of the point to draw at.
* @param y The Y coordinate of the point to draw at.
*/
public void
drawChars(byte data[], int offset, int length, int x, int y)
{
drawString(new String(data, offset, length), x, y);
}
/*
public abstract void drawString(AttributedCharacterIterator iterator,
int x, int y)
{
*/
public void
drawBytes(byte[] data, int offset, int length, int x, int y)
{
String str = new String(data, offset, length);
drawString(str, x, y);
}
}
public abstract boolean drawImage(Image img, int x, int y,
ImageObserver observer);
/*************************************************************************/
public abstract boolean drawImage(Image img, int x, int y,
int width, int height,
ImageObserver observer);
/**
* Draws all of the image that is available and returns. If the image
* is not completely loaded, <code>false</code> is returned and
* the specified iamge observer is notified as more data becomes
* available.
*
* @param image The image to draw.
* @param x The X coordinate of the point to draw at.
* @param y The Y coordinate of the point to draw at.
* @param observer The image observer to notify as data becomes available.
*
* @return <code>true</code> if all the image data is available,
* <code>false</code> otherwise.
*/
public abstract boolean
drawImage(Image image, int x, int y, ImageObserver observer);
public abstract boolean drawImage(Image img, int x, int y, Color bgcolor,
ImageObserver observer);
/*************************************************************************/
public abstract boolean drawImage(Image img, int x, int y,
int width, int height, Color bgcolor,
/**
* Draws all of the image that is available and returns. The image
* is scaled to fit in the specified rectangle. If the image
* is not completely loaded, <code>false</code> is returned and
* the specified iamge observer is notified as more data becomes
* available.
*
* @param image The image to draw.
* @param x The X coordinate of the point to draw at.
* @param y The Y coordinate of the point to draw at.
* @param width The width of the rectangle to draw in.
* @param height The height of the rectangle to draw in.
* @param observer The image observer to notify as data becomes available.
*
* @return <code>true</code> if all the image data is available,
* <code>false</code> otherwise.
*/
public abstract boolean
drawImage(Image image, int x, int y, int width, int height,
ImageObserver observer);
public abstract boolean drawImage(Image img,
int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
/*************************************************************************/
/**
* Draws all of the image that is available and returns. If the image
* is not completely loaded, <code>false</code> is returned and
* the specified iamge observer is notified as more data becomes
* available.
*
* @param image The image to draw.
* @param x The X coordinate of the point to draw at.
* @param y The Y coordinate of the point to draw at.
* @param bgcolor The background color to use for the image.
* @param observer The image observer to notify as data becomes available.
*
* @return <code>true</code> if all the image data is available,
* <code>false</code> otherwise.
*/
public abstract boolean
drawImage(Image image, int x, int y, Color bgcolor, ImageObserver observer);
/*************************************************************************/
/**
* Draws all of the image that is available and returns. The image
* is scaled to fit in the specified rectangle. If the image
* is not completely loaded, <code>false</code> is returned and
* the specified iamge observer is notified as more data becomes
* available.
*
* @param image The image to draw.
* @param x The X coordinate of the point to draw at.
* @param y The Y coordinate of the point to draw at.
* @param width The width of the rectangle to draw in.
* @param height The height of the rectangle to draw in.
* @param bgcolor The background color to use for the image.
* @param observer The image observer to notify as data becomes available.
*
* @return <code>true</code> if all the image data is available,
* <code>false</code> otherwise.
*/
public abstract boolean
drawImage(Image image, int x, int y, int width, int height, Color bgcolor,
ImageObserver observer);
public abstract boolean drawImage(Image img,
int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
Color bgcolor, ImageObserver observer);
/*************************************************************************/
public abstract void dispose();
/**
* FIXME: Write Javadocs for this when you understand it.
*/
public abstract boolean
drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
int sx2, int sy2, ImageObserver observer);
public void finalize()
{
/*************************************************************************/
/**
* FIXME: Write Javadocs for this when you understand it.
*/
public abstract boolean
drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
int sx2, int sy2, Color bgcolor, ImageObserver observer);
/*************************************************************************/
/**
* Free any resources held by this graphics context immediately instead
* of waiting for the object to be garbage collected and finalized.
*/
public abstract void
dispose();
/*************************************************************************/
/**
* Frees the resources held by this graphics context when it is
* garbage collected.
*/
public void
finalize()
{
dispose();
}
}
public String toString()
{
return super.toString(); // FIXME
}
/*************************************************************************/
/** @deprecated */
public Rectangle getClipRect()
{
return getClipBounds(null);
}
/**
* Returns a string representation of this object.
*
* @param A string representation of this object.
*/
public String
toString()
{
return(super.toString());
}
public boolean hitClip(int x, int y, int width, int height)
{
public boolean
hitClip(int x, int y, int width, int height)
{
throw new UnsupportedOperationException("not implemented yet");
}
}
public Rectangle getClipBounds(Rectangle r)
{
public Rectangle
getClipBounds(Rectangle r)
{
Rectangle clipBounds = getClipBounds();
if (r == null)
......@@ -231,5 +787,7 @@ public abstract class Graphics
r.width = clipBounds.width;
r.height = clipBounds.height;
return r;
}
}
} // class Graphics
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt;
......
/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
/* Status: Complete, but commented out until we have the required
GraphicsDevice. */
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt;
......
/* Copyright (C) 1999, 2000, 2001 Free Software Foundation
/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libjava.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
package java.awt;
......@@ -13,14 +31,42 @@ import java.io.Serializable;
/* Status: Mostly complete. Some of the Java2D stuff is commented out. */
/**
* This class represents a rectangle and all the interesting things you
* might want to do with it. Note that the coordinate system uses
* the origin (0,0) as the top left of the screen, with the x and y
* values increasing as they move to the right and down respectively.
*
* @author Warren Levy <warrenl@cygnus.com>
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class Rectangle extends Rectangle2D
implements Cloneable, Shape, Serializable
{
/**
* The X coordinate of the top-left corner of the rectangle.
*/
public int x;
/**
* The Y coordinate of the top-left corner of the rectangle;
*/
public int y;
/**
* The width of the rectangle
*/
public int width;
/**
* The height of the rectangle
*/
public int height;
/**
* Initializes a new instance of <code>Rectangle</code> with a top
* left corner at (0,0) and a width and height of 0.
*/
public Rectangle()
{
x = 0;
......@@ -29,6 +75,12 @@ public class Rectangle extends Rectangle2D
height = 0;
}
/**
* Initializes a new instance of <code>Rectangle</code> from the
* coordinates of the specified rectangle.
*
* @param rect The rectangle to copy from.
*/
public Rectangle(Rectangle r)
{
x = r.x;
......@@ -37,6 +89,15 @@ public class Rectangle extends Rectangle2D
height = r.height;
}
/**
* Initializes a new instance of <code>Rectangle</code> from the specified
* inputs.
*
* @param x The X coordinate of the top left corner of the rectangle.
* @param y The Y coordinate of the top left corner of the rectangle.
* @param width The width of the rectangle.
* @param height The height of the rectangle.
*/
public Rectangle(int x, int y, int width, int height)
{
this.x = x;
......@@ -45,6 +106,14 @@ public class Rectangle extends Rectangle2D
this.height = height;
}
/**
* Initializes a new instance of <code>Rectangle</code> with the specified
* width and height. The upper left corner of the rectangle will be at
* the origin (0,0).
*
* @param width The width of the rectangle.
* @param height the height of the rectange.
*/
public Rectangle(int width, int height)
{
x = 0;
......@@ -53,6 +122,14 @@ public class Rectangle extends Rectangle2D
this.height = height;
}
/**
* Initializes a new instance of <code>Rectangle</code> with a top-left
* corner represented by the specified point and the width and height
* represented by the specified dimension.
*
* @param point The upper left corner of the rectangle.
* @param dim The width and height of the rectangle.
*/
public Rectangle(Point p, Dimension d)
{
x = p.x;
......@@ -61,6 +138,12 @@ public class Rectangle extends Rectangle2D
height = d.height;
}
/**
* Initializes a new instance of <code>Rectangle</code> with a top left
* corner at the specified point and a width and height of zero.
*
* @param poin The upper left corner of the rectangle.
*/
public Rectangle(Point p)
{
x = p.x;
......@@ -69,6 +152,13 @@ public class Rectangle extends Rectangle2D
height = 0;
}
/**
* Initializes a new instance of <code>Rectangle</code> with an
* upper left corner at the origin (0,0) and a width and height represented
* by the specified dimension.
*
* @param dim The width and height of the rectangle.
*/
public Rectangle(Dimension d)
{
x = 0;
......@@ -77,11 +167,24 @@ public class Rectangle extends Rectangle2D
height = d.height;
}
/**
* Returns the bounding rectangle for this rectangle, which is simply
* this rectange itself.
*
* @return This rectangle.
*/
public Rectangle getBounds ()
{
return (Rectangle) this.clone();
}
/**
* Modifies this rectangle so that it represents the smallest rectangle
* that contains both the existing rectangle and the specified point.
*
* @param x The X coordinate of the point to add to this rectangle.
* @param y The Y coordinate of the point to add to this rectangle.
*/
public void add(int newx, int newy)
{
int x = this.x > newx ? newx : this.x;
......@@ -92,11 +195,23 @@ public class Rectangle extends Rectangle2D
this.y = y;
}
/**
* Modifies this rectangle so that it represents the smallest rectangle
* that contains both the existing rectangle and the specified point.
*
* @param point The point to add to this rectangle.
*/
public void add(Point pt)
{
add (pt.x, pt.y);
}
/**
* Modifies this rectangle so that it represents the smallest rectangle
* that contains both the existing rectangle and the specified rectangle.
*
* @param rect The rectangle to add to this rectangle.
*/
public void add(Rectangle r)
{
int x = this.x > r.x ? r.x : this.x;
......@@ -109,6 +224,15 @@ public class Rectangle extends Rectangle2D
this.y = y;
}
/**
* Tests whether or not the specified point is inside this rectangle.
*
* @param x The X coordinate of the point to test.
* @param y The Y coordinate of the point to test.
*
* @return <code>true</code> if the point is inside the rectangle,
* <code>false</code> otherwise.
*/
public boolean contains(int x, int y)
{
return (x >= this.x && x <= this.x + this.width
......@@ -121,6 +245,14 @@ public class Rectangle extends Rectangle2D
&& y >= this.y && y + h <= this.y + this.height);
}
/**
* Tests whether or not the specified point is inside this rectangle.
*
* @param point The point to test.
*
* @return <code>true</code> if the point is inside the rectangle,
* <code>false</code> otherwise.
*/
public boolean contains(Point p)
{
return contains(p.x, p.y);
......@@ -131,6 +263,22 @@ public class Rectangle extends Rectangle2D
return contains(r.x, r.y, r.width, r.height);
}
/**
* Tests this rectangle for equality against the specified object. This
* will be true if an only if the specified object:
* <p>
* <ul>
* <li>Is not <code>null</code>.
* <li>Is an instance of <code>Rectangle</code>.
* <li>Has X and Y coordinates identical to this rectangle.
* <li>Has a width and height identical to this rectangle.
* </ul>
*
* @param obj The object to test against for equality.
*
* @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 Rectangle)
......@@ -149,11 +297,22 @@ public class Rectangle extends Rectangle2D
return (double) this.height;
}
/**
* Returns the location of this rectangle, which is the coordinates of
* its upper left corner.
*
* @return The point where this rectangle is located.
*/
public Point getLocation()
{
return new Point(x,y);
}
/**
* Returns the size of this rectangle.
*
* @return The size of this rectangle.
*/
public Dimension getSize()
{
return new Dimension(width, height);
......@@ -174,19 +333,47 @@ public class Rectangle extends Rectangle2D
return (double) y;
}
/**
* Expands the rectangle by the specified amount. The horizontal
* and vertical expansion values are applied both to the X,Y coordinate
* of this rectangle, and its width and height. Thus the width and
* height will increase by 2h and 2v accordingly.
*
* @param h The horizontal expansion value.
* @param v The vertical expansion value.
*/
public void grow(int h, int v)
{
width += h;
height += v;
}
/** @deprecated Use contains() instead. */
/**
* Tests whether or not the specified point is inside this rectangle.
*
* @param x The X coordinate of the point to test.
* @param y The Y coordinate of the point to test.
*
* @return <code>true</code> if the point is inside the rectangle,
* <code>false</code> otherwise.
*
* @deprecated This method is deprecated in favor of
* <code>contains(int, int)</code>.
*/
public boolean inside(int x, int y)
{
return contains(x, y);
}
/** @specnote If there is no intersection, an empty rectangle at 0,0
/**
* Determines the rectange which is formed by the intersection of this
* rectangle with the specified rectangle.
*
* @param rect The rectange to calculate the intersection with.
*
* @return The rectangle bounding the intersection.
*
* @specnote If there is no intersection, an empty rectangle at 0,0
* is returned.
*/
public Rectangle intersection(Rectangle r)
......@@ -203,7 +390,15 @@ public class Rectangle extends Rectangle2D
return new Rectangle(0, 0, 0, 0);
}
/** @specnote If the intersection is at an edge or corner only (an empty
/**
* Tests whether or not the specified rectangle intersects this rectangle.
*
* @param rect The rectangle to test against.
*
* @return <code>true</code> if the specified rectangle intersects this
* one, <code>false</code> otherwise.
*
* @specnote If the intersection is at an edge or corner only (an empty
* intersection with a non-zero location), false is returned.
*/
public boolean intersects(Rectangle r)
......@@ -215,12 +410,29 @@ public class Rectangle extends Rectangle2D
return (neww > 0 && newh > 0);
}
/**
* Tests whether or not this rectangle is empty. An empty rectangle
* has a width or height of zero.
*
* @return <code>true</code> if the rectangle is empty, <code>false</code>
* otherwise.
*/
public boolean isEmpty()
{
return !(width > 0 && height > 0);
}
/** @deprecated Use setLocation() instead. */
/**
* Moves the location of this rectangle by setting its upper left
* corner to the specified coordinates.
* // FIXME: Is this true?
*
* @param x The new X coordinate for this rectangle.
* @param y The new Y coordinate for this rectangle.
*
* @deprecated This method is deprecated in favor of
* <code>setLocation(int, int)</code>.
*/
public void move(int x, int y)
{
setLocation(x, y);
......@@ -232,18 +444,44 @@ public class Rectangle extends Rectangle2D
return 0;
}
/** @deprecated Use setBounds() instead. */
/**
* Updates this rectangle to have the specified dimensions.
*
* @param x The new X coordinate of the upper left hand corner.
* @param y The new Y coordinate of the upper left hand corner.
* @param width The new width of this rectangle.
* @param height The new height of this rectangle.
*
* @deprecated This method is deprecated in favor of
* <code>setBounds(int, int, int, int)</code>.
*/
public void reshape(int x, int y, int width, int height)
{
setBounds(x, y, width, height);
}
/** @deprecated Use setSize() instead. */
/**
* Sets the size of this rectangle based on the specified dimensions.
*
* @param width The new width of the rectangle.
* @param height The new height of the rectangle.
*
* @deprecated This method is deprecated in favor of
* <code>setSize(int, int)</code>.
*/
public void resize(int width, int height)
{
setSize(width, height);
}
/**
* Updates this rectangle to have the specified dimensions.
*
* @param x The new X coordinate of the upper left hand corner.
* @param y The new Y coordinate of the upper left hand corner.
* @param width The new width of this rectangle.
* @param height The new height of this rectangle.
*/
public void setBounds(int x, int y, int width, int height)
{
this.x = x;
......@@ -252,6 +490,12 @@ public class Rectangle extends Rectangle2D
this.height = height;
}
/**
* Updates this rectangle to match the dimensions of the specified
* rectangle.
*
* @param rect The rectangle to update from.
*/
public void setBounds(Rectangle r)
{
this.x = r.x;
......@@ -260,12 +504,27 @@ public class Rectangle extends Rectangle2D
this.height = r.height;
}
/**
* Moves the location of this rectangle by setting its upper left
* corner to the specified coordinates.
* // FIXME: Is this true?
*
* @param x The new X coordinate for this rectangle.
* @param y The new Y coordinate for this rectangle.
*/
public void setLocation(int x, int y)
{
this.x = x;
this.y = y;
}
/**
* Moves the location of this rectangle by setting its upper left
* corner to the specified point.
* // FIXME: Is this true?
*
* @param point The point to move the rectange to.
*/
public void setLocation(Point p)
{
this.x = p.x;
......@@ -280,12 +539,23 @@ public class Rectangle extends Rectangle2D
this.height = (int) height;
}
/**
* Sets the size of this rectangle based on the specified dimensions.
*
* @param dim The new dimensions of the rectangle.
*/
public void setSize(Dimension d)
{
this.width = d.width;
this.height = d.height;
}
/**
* Sets the size of this rectangle based on the specified dimensions.
*
* @param width The new width of the rectangle.
* @param height The new height of the rectangle.
*/
public void setSize(int width, int height)
{
this.width = width;
......@@ -298,6 +568,14 @@ public class Rectangle extends Rectangle2D
y += y;
}
/**
* Returns the smallest rectangle that contains both this rectangle
* and the specified rectangle.
*
* @param rect The rectangle to compute the union with.
*
* @return The smallest rectangle containing both rectangles.
*/
public Rectangle union(Rectangle r)
{
int newx = x > r.x ? r.x : x;
......@@ -333,9 +611,24 @@ public class Rectangle extends Rectangle2D
return new Rectangle (x, y, width, height);
}
/**
* Returns a string representation of this rectangle.
*
* @return A string representation of this rectangle.
*/
public String toString()
{
return getClass().getName() + "[x=" + x + ",y=" + y + ",width=" + width +
",height=" + height + "]";
}
/**
* Returns a hash value for this object.
*
* @return A hash value for this object.
*/
public int hashCode()
{
return x * y * width * height * 37;
}
}
/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt;
......
......@@ -14,7 +14,7 @@ import java.beans.*;
import java.awt.image.*;
import java.awt.datatransfer.Clipboard;
import java.util.Hashtable;
import gnu.gcj.awt.GLightweightPeer;
import gnu.java.awt.GLightweightPeer;
/* A very incomplete placeholder. */
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt;
......
/* Copyright (C) 1999, 2000 Free Software Foundation
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of libgcj.
Copyright (C) 1999 Free Software Foundation, Inc.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt;
import java.awt.event.WindowEvent;
......@@ -15,8 +34,12 @@ import java.util.EventListener;
import java.util.Locale;
import java.util.ResourceBundle;
/* Status: partially implemented. */
/**
* This class represents a top-level window with no decorations.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy <warrenl@cygnus.com>
*/
public class Window extends Container
{
// Serialized fields, from Sun's serialization spec.
......@@ -46,6 +69,12 @@ public class Window extends Container
graphicsConfiguration = gc;
}
/**
* Initializes a new instance of <code>Window</code> with the specified
* parent. The window will initially be invisible.
*
* @param parent The owning <code>Frame</code> of this window.
*/
public Window(Frame owner)
{
this((Window) owner);
......@@ -99,6 +128,9 @@ public class Window extends Container
super.finalize();
}
/**
* Creates the native peer for this window.
*/
public void addNotify()
{
if (peer == null)
......@@ -106,8 +138,12 @@ public class Window extends Container
super.addNotify ();
}
/** @specnote pack() doesn't appear to be called internally by show(), so
we duplicate some of the functionality. */
/**
* Relays out this window's child components at their preferred size.
*
* @specnote pack() doesn't appear to be called internally by show(), so
* we duplicate some of the functionality.
*/
public void pack()
{
if (parent != null
......@@ -121,31 +157,16 @@ public class Window extends Container
validate();
}
/**
* Makes this window visible and brings it to the front.
*/
public void show ()
{
if (peer == null)
addNotify();
validate ();
if (isVisible())
{
this.toFront();
return;
}
if (parent != null
&& !parent.isDisplayable())
parent.addNotify();
if (peer == null)
addNotify ();
validate ();
super.show ();
// FIXME: Is this call necessary or do we assume the peer takes care of
// it?
// this.toFront();
super.show();
toFront();
}
public void hide()
......@@ -154,6 +175,9 @@ public class Window extends Container
super.hide();
}
/**
* Called to free any resource associated with this window.
*/
public void dispose()
{
hide();
......@@ -167,6 +191,10 @@ public class Window extends Container
this.removeNotify();
}
/**
* Sends this window to the back so that all other windows display in
* front of it.
*/
public void toBack ()
{
if (peer != null)
......@@ -176,6 +204,10 @@ public class Window extends Container
}
}
/**
* Brings this window to the front so that it displays in front of
* any other windows.
*/
public void toFront ()
{
if (peer != null)
......@@ -185,13 +217,25 @@ public class Window extends Container
}
}
/** @specnote Unlike Component.getToolkit, this implementation always
returns the value of Toolkit.getDefaultToolkit(). */
/**
* Returns the toolkit used to create this window.
*
* @return The toolkit used to create this window.
*
* @specnote Unlike Component.getToolkit, this implementation always
* returns the value of Toolkit.getDefaultToolkit().
*/
public Toolkit getToolkit()
{
return Toolkit.getDefaultToolkit ();
}
/**
* Returns the warning string that will be displayed if this window is
* popped up by an unsecure applet or application.
*
* @return The unsecure window warning message.
*/
public final String getWarningString()
{
boolean secure = true;
......@@ -210,6 +254,11 @@ public class Window extends Container
return null;
}
/**
* Returns the locale that this window is configured for.
*
* @return The locale this window is configured for.
*/
public Locale getLocale ()
{
return locale == null ? Locale.getDefault () : locale;
......@@ -223,9 +272,13 @@ public class Window extends Container
}
*/
/**
* Sets the cursor for this window to the specifiec cursor.
*
* @param cursor The new cursor for this window.
*/
public void setCursor(Cursor cursor)
{
// FIXME: why different from Component.setCursor() ?
super.setCursor(cursor);
}
......@@ -242,11 +295,23 @@ public class Window extends Container
return null;
}
/**
* Adds the specified listener to the list of <code>WindowListeners</code>
* that will receive events for this window.
*
* @param listener The <code>WindowListener</code> to add.
*/
public synchronized void addWindowListener (WindowListener listener)
{
windowListener = AWTEventMulticaster.add (windowListener, listener);
}
/**
* Removes the specified listener from the list of
* <code>WindowListeners</code> that will receive events for this window.
*
* @param listener The <code>WindowListener</code> to remove.
*/
public synchronized void removeWindowListener (WindowListener listener)
{
windowListener = AWTEventMulticaster.remove (windowListener, listener);
......@@ -272,6 +337,14 @@ public class Window extends Container
super.dispatchEventImpl(e);
}
/**
* Processes the specified event for this window. If the event is an
* instance of <code>WindowEvent</code>, then
* <code>processWindowEvent()</code> is called to process the event,
* otherwise the superclass version of this method is invoked.
*
* @param event The event to process.
*/
protected void processEvent (AWTEvent evt)
{
if (evt instanceof WindowEvent)
......@@ -280,6 +353,14 @@ public class Window extends Container
super.processEvent (evt);
}
/**
* Dispatches this event to any listeners that are listening for
* <code>WindowEvents</code> on this window. This method only gets
* invoked if it is enabled via <code>enableEvents()</code> or if
* a listener has been added.
*
* @param event The event to process.
*/
protected void processWindowEvent (WindowEvent evt)
{
if (windowListener != null)
......@@ -311,22 +392,40 @@ public class Window extends Container
}
}
/**
* Returns the child window that has focus if this window is active.
* This method returns <code>null</code> if this window is not active
* or no children have focus.
*
* @return The component that has focus, or <code>null</code> if no
* component has focus.
*/
public Component getFocusOwner()
{
// FIXME
return null;
}
/**
* Post a Java 1.0 event to the event queue.
*
* @param event The event to post.
*/
public boolean postEvent(Event e)
{
// FIXME
return false;
}
/**
* Tests whether or not this window is visible on the screen.
*
* @return <code>true</code> if this window is visible, <code>false</code>
* otherwise.
*/
public boolean isShowing()
{
// FIXME: Also check if window is within the boundary of the screen?
return isVisible();
return super.isShowing();
}
/** @since 1.2 */
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.color;
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.color;
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.color;
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.event;
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.event;
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.event;
import java.awt.*;
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.event;
......
/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libjava.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.geom;
import java.awt.*;
......
/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libjava.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.geom;
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libjava.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.geom;
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libjava.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.geom;
......
/* Copyright (C) 2000, 2001 Free Software Foundation
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
This file is part of libjava.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.geom;
......@@ -24,8 +41,16 @@ public abstract class Line2D implements Shape, Cloneable
public Object clone ()
{
try
{
return super.clone ();
}
catch (CloneNotSupportedException _)
{
// Can't happen.
return null;
}
}
public boolean contains (double x, double y)
{
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libjava.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.geom;
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libjava.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.geom;
......
/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libjava.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.geom;
......
/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libjava.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.geom;
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libjava.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.geom;
import java.awt.*;
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libjava.
This software is copyrighted work licensed under the terms of the
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.geom;
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt.image;
......@@ -12,7 +30,7 @@ import java.awt.*;
import java.awt.color.*;
import java.util.*;
import gnu.gcj.awt.ComponentDataBlitOp;
import gnu.java.awt.ComponentDataBlitOp;
/**
* A buffered image always starts at coordinates (0, 0).
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt.image;
import java.awt.Point;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
import gnu.gcj.awt.Buffers;
import gnu.java.awt.Buffers;
/**
* A color model operates with colors in several formats:
......@@ -47,8 +65,8 @@ import gnu.gcj.awt.Buffers;
* </ul>
*
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
* @author C. Brian Jones (cbj@gnu.org)
*/
public abstract class ColorModel implements Transparency
{
protected int pixel_bits;
......@@ -74,6 +92,12 @@ public abstract class ColorModel implements Transparency
return array;
}
/**
* Constructs the default color model. The default color model
* can be obtained by calling <code>getRGBdefault</code> of this
* class.
* @param b the number of bits wide used for bit size of pixel values
*/
public ColorModel(int bits)
{
this(bits * 4, // total bits, sRGB, four channels
......@@ -98,6 +122,10 @@ public abstract class ColorModel implements Transparency
this.transferType = transferType;
}
/**
* Returns the default color model which in Sun's case is an instance
* of <code>DirectColorModel</code>.
*/
public static ColorModel getRGBdefault()
{
return new DirectColorModel(8, 0xff0000, 0xff00, 0xff, 0xff000000);
......@@ -113,6 +141,9 @@ public abstract class ColorModel implements Transparency
return isAlphaPremultiplied;
}
/**
* Get get number of bits wide used for the bit size of pixel values
*/
public int getPixelSize()
{
return pixel_bits;
......@@ -525,7 +556,8 @@ public abstract class ColorModel implements Transparency
return sm.getTransferType() == transferType;
}
public void finalize() {
public void finalize()
{
}
/**
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.image;
import java.awt.color.*;
import java.awt.Point;
import gnu.gcj.awt.Buffers;
import gnu.java.awt.Buffers;
public class ComponentColorModel extends ColorModel
{
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.image;
import gnu.gcj.awt.Buffers;
import gnu.java.awt.Buffers;
/* FIXME: This class does not yet support data type TYPE_SHORT */
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.image;
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.image;
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.image;
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.image;
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.awt.image;
import java.awt.Point;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
import gnu.gcj.awt.Buffers;
import gnu.java.awt.Buffers;
/**
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
* @author C. Brian Jones (cbj@gnu.org)
* @author Mark Benvenuto (mcb54@columbia.edu)
*/
public class DirectColorModel extends PackedColorModel
{
/**
* For the color model created with this constructor the pixels
* will have fully opaque alpha components with a value of 255.
* Each mask should describe a fully contiguous set of bits in the
* most likely order of alpha, red, green, blue from the most significant
* byte to the least significant byte.
*
* @param bits the number of bits wide used for bit size of pixel values
* @param rmask the bits describing the red component of a pixel
* @param gmask the bits describing the green component of a pixel
* @param bmask the bits describing the blue component of a pixel
* @param amask the bits describing the alpha component of a pixel
*/
public DirectColorModel(int pixelBits, int rmask, int gmask, int bmask)
{
this(ColorSpace.getInstance(ColorSpace.CS_sRGB), pixelBits,
......@@ -27,6 +60,18 @@ public class DirectColorModel extends PackedColorModel
);
}
/**
* For the color model created with this constructor the pixels
* will have fully opaque alpha components with a value of 255.
* Each mask should describe a fully contiguous set of bits in the
* most likely order of red, green, blue from the most significant
* byte to the least significant byte.
*
* @param bits the number of bits wide used for bit size of pixel values
* @param rmask the bits describing the red component of a pixel
* @param gmask the bits describing the green component of a pixel
* @param bmask the bits describing the blue component of a pixel
*/
public DirectColorModel(int pixelBits,
int rmask, int gmask, int bmask, int amask)
{
......@@ -68,24 +113,41 @@ public class DirectColorModel extends PackedColorModel
return hasAlpha() ? getMask(3) : 0;
}
/**
* Get the red component of the given pixel.
* <br>
*/
public final int getRed(int pixel)
{
return extractAndNormalizeSample(pixel, 0);
}
/**
* Get the green component of the given pixel.
* <br>
*/
public final int getGreen(int pixel)
{
return extractAndNormalizeSample(pixel, 1);
}
/**
* Get the blue component of the given pixel.
* <br>
*/
public final int getBlue(int pixel)
{
return extractAndNormalizeSample(pixel, 2);
}
/**
* Get the alpha component of the given pixel.
* <br>
*/
public final int getAlpha(int pixel)
{
if (!hasAlpha()) return 0;
if (!hasAlpha())
return 0;
return extractAndScaleSample(pixel, 3);
}
......@@ -107,11 +169,18 @@ public class DirectColorModel extends PackedColorModel
(field >>> (-to8BitShift));
}
/* FIXME: The Sun docs show that this method is overridden, but I don't
see any way to improve on the superclass implementation. */
/**
* Get the RGB color value of the given pixel using the default
* RGB color model.
* <br>
*
* @param pixel a pixel value
*/
public final int getRGB(int pixel)
{
/* FIXME: The Sun docs show that this method is overridden, but I
don't see any way to improve on the superclass
implementation. */
return super.getRGB(pixel);
}
......
......@@ -10,7 +10,7 @@ package java.awt.image;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
import gnu.gcj.awt.Buffers;
import gnu.java.awt.Buffers;
/**
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.image;
import java.awt.Point;
import java.awt.color.ColorSpace;
import gnu.gcj.awt.BitMaskExtent;
import gnu.java.awt.BitMaskExtent;
/**
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.image;
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.image;
......
/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.image;
......
/* Copyright (C) 2000 Free Software Foundation
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.image;
import gnu.gcj.awt.BitMaskExtent;
import gnu.gcj.awt.Buffers;
import gnu.java.awt.BitMaskExtent;
import gnu.java.awt.Buffers;
/**
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
......
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.awt.image;
......
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