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
This commit is contained in:
Tom Tromey 2002-01-16 04:21:35 +00:00 committed by Tom Tromey
parent c342f12677
commit 3bd483f2a1
65 changed files with 5808 additions and 1273 deletions

View File

@ -1,3 +1,125 @@
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.

View File

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

View File

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

View File

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

View File

@ -1,51 +0,0 @@
/* Copyright (C) 2000 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.awt;
/**
* Simple transparent utility class that can be used to perform bit
* mask extent calculations.
*/
public final class BitMaskExtent
{
/** The number of the least significant bit of the bit mask extent. */
public byte leastSignificantBit;
/** The number of bits in the bit mask extent. */
public byte bitWidth;
/**
* Set the bit mask. This will calculate and set the leastSignificantBit
* and bitWidth fields.
*
* @see #leastSignificantBit
* @see #bitWidth
*/
public void setMask(long mask)
{
leastSignificantBit = 0;
bitWidth = 0;
if (mask == 0) return;
long shiftMask = mask;
for (; (shiftMask&1) == 0; shiftMask >>>=1) leastSignificantBit++;
for (; (shiftMask&1) != 0; shiftMask >>>=1) bitWidth++;
if (shiftMask != 0)
throw new IllegalArgumentException("mask must be continuous");
}
/**
* Calculate the bit mask based on the values of the
* leastSignificantBit and bitWidth fields.
*/
public long toMask()
{
return ((1<<bitWidth)-1) << leastSignificantBit;
}
}

View File

@ -0,0 +1,68 @@
/* 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 gnu.java.awt;
/**
* Simple transparent utility class that can be used to perform bit
* mask extent calculations.
*/
public final class BitMaskExtent
{
/** The number of the least significant bit of the bit mask extent. */
public byte leastSignificantBit;
/** The number of bits in the bit mask extent. */
public byte bitWidth;
/**
* Set the bit mask. This will calculate and set the leastSignificantBit
* and bitWidth fields.
*
* @see #leastSignificantBit
* @see #bitWidth
*/
public void setMask(long mask)
{
leastSignificantBit = 0;
bitWidth = 0;
if (mask == 0) return;
long shiftMask = mask;
for (; (shiftMask&1) == 0; shiftMask >>>=1) leastSignificantBit++;
for (; (shiftMask&1) != 0; shiftMask >>>=1) bitWidth++;
if (shiftMask != 0)
throw new IllegalArgumentException("mask must be continuous");
}
/**
* Calculate the bit mask based on the values of the
* leastSignificantBit and bitWidth fields.
*/
public long toMask()
{
return ((1<<bitWidth)-1) << leastSignificantBit;
}
}

View File

@ -1,12 +1,29 @@
/* 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.*;

View File

@ -1,12 +1,29 @@
/* 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.*;

View File

@ -1,12 +1,29 @@
/* 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;
}
}

View File

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

View File

@ -1,10 +1,28 @@
/* 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,41 +120,82 @@ 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??
super(event.target);
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;

View File

@ -1,10 +1,28 @@
/* 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.
*
* @author Bryce McKinlay
*/
* 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)
@ -50,7 +121,15 @@ public class AWTEventMulticaster implements ComponentListener,
return a;
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;
@ -88,108 +177,236 @@ public class AWTEventMulticaster implements ComponentListener,
if (newb != b)
return new AWTEventMulticaster (a, newb);
}
// oldl was not found.
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);
}
public static HierarchyBoundsListener add(HierarchyBoundsListener a,
HierarchyBoundsListener b)
{
return (HierarchyBoundsListener) addInternal(a, b);
}
public static HierarchyListener add(HierarchyListener a, HierarchyListener b)
{
return (HierarchyListener) addInternal(a, b);
}
public static InputMethodListener add(InputMethodListener a,
InputMethodListener b)
{
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,251 +430,500 @@ 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);
((WindowListener) b).windowOpened(e);
}
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");
}
}

View File

@ -1,174 +1,481 @@
/* 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
*/
// FIXME: check serialization of fields
int hgap;
int vgap;
Component north, south, east, west, center;
/**
* Constant indicating the top of the container
*/
public static final String NORTH = "North";
public BorderLayout ()
{
this (0, 0);
}
/**
* Constant indicating the bottom of the container
*/
public static final String SOUTH = "South";
public BorderLayout (int hgap, int vgap)
{
this.hgap = hgap;
this.vgap = vgap;
}
/**
* Constant indicating the right side of the container
*/
public static final String EAST = "East";
public int getHgap()
{
return hgap;
}
/**
* Constant indicating the left side of the container
*/
public static final String WEST = "West";
public void setHgap(int hgap)
{
this.hgap = hgap;
}
/**
* Constant indicating the center of the container
*/
public static final String CENTER = "Center";
public int getVgap()
{
return vgap;
}
/**
* Constant indicating the position just after the last line of the
* layout.
*/
public static final String AFTER_LAST_LINE = "Last";
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);
}
/**
* Constant indicating the position just after the end of the line.
*/
public static final String AFTER_LINE_ENDS = "After";
public void removeLayoutComponent(Component comp)
{
if (center == comp)
{
center = null;
}
else if (north == comp)
{
north = null;
}
else if (south == comp)
{
south = null;
}
else if (east == comp)
{
east = null;
}
else if (west == comp)
{
west = null;
}
}
/**
* Constant indicating the position just before the first line of the
* layout.
*/
public static final String BEFORE_FIRST_LINE = "First";
public Dimension minimumLayoutSize(Container target)
{
return calcSize(getMinimumSize(center),
getMinimumSize(north),
getMinimumSize(south),
getMinimumSize(east),
getMinimumSize(west),
target);
}
/**
* Constant indicating the position at the beginning of the line.
*/
public static final String BEFORE_LINE_BEGINS = "Before";
public Dimension preferredLayoutSize(Container target)
{
return calcSize(getPreferredSize(center),
getPreferredSize(north),
getPreferredSize(south),
getPreferredSize(east),
getPreferredSize(west),
target);
}
/**
* Completely disregards the requested maximum sizes of the
* components, and states that the container has no upper size
* limit.
*
* @return a dimension of width and height Integer.MAX_VALUE.
*/
public Dimension maximumLayoutSize(Container target)
{
return (Dimension) DIM_MAX.clone();
}
// Serialization constant
private static final long serialVersionUID = -8658291919501921765L;
public float getLayoutAlignmentX(Container parent)
{
return Component.CENTER_ALIGNMENT;
}
/*************************************************************************/
public float getLayoutAlignmentY(Container parent)
{
return Component.CENTER_ALIGNMENT;
}
public void invalidateLayout(Container target)
{
// TODO... implement caching?
}
/*
* 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;
}
/*************************************************************************/
/*
* 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;
}
/*************************************************************************/
/**
* 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;
}
/*************************************************************************/
/**
* 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);
}
/*************************************************************************/
/**
* 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;
if (south == component)
south = null;
if (east == component)
east = null;
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;
}
/*************************************************************************/
/**
* 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);
}
/*************************************************************************/
/**
* Returns the preferred size of the specified container using this layout.
*
* @param target The container to calculate the preferred size for.
*
* @return The preferred size of the container
*/
public Dimension
preferredLayoutSize(Container target)
{
return calcSize(target, PREF);
}
/*************************************************************************/
/**
* 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());
}
/*************************************************************************/
/**
* 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)
{
if (left_to_right)
my_west = firstItem;
else
my_east = firstItem;
}
if (lastItem != null)
{
if (left_to_right)
my_east = lastItem;
else
my_west = lastItem;
}
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();
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 t = target.getSize();
/*
<-> hgap <-> hgap
+----------------------------+ }
@ -190,65 +497,119 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
i.left i.right
*/
int x1 = i.left;
int x2 = x1 + w.width + hgap;
int x3 = t.width - i.right - e.width;
int ww = t.width - i.right - i.left;
int x1 = i.left;
int x2 = x1 + w.width + hgap;
int x3 = t.width - i.right - e.width;
int ww = t.width - i.right - i.left;
int y1 = i.top;
int y2 = y1 + n.height + vgap;
int y3 = t.height - i.bottom - s.height;
int hh = y3-y2-vgap;
int y1 = i.top;
int y2 = y1 + n.height + vgap;
int y3 = t.height - i.bottom - s.height;
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 + "]";
}
// Support:
static final Dimension DIM_0 = new Dimension(0, 0);
static final Dimension DIM_MAX = new Dimension(Integer.MAX_VALUE,
Integer.MAX_VALUE);
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)
{
if (comp == null)
return DIM_0;
return comp.getMinimumSize();
}
Dimension getPreferredSize(Component comp)
{
if (comp == null)
return DIM_0;
return comp.getPreferredSize();
}
Dimension calcSize(Dimension c, Dimension n, Dimension s,
Dimension e, Dimension w, Container target)
{
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
);
}
setBounds(center, x2, y2, x3-x2-hgap, hh);
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);
}
/*************************************************************************/
/**
* 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 + "]";
}
private void
setBounds(Component comp, int x, int y, int w, int h)
{
if (comp == null)
return;
comp.setBounds(x, y, w, h);
}
// 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 new Dimension(0, 0);
if (what == MIN)
return comp.getMinimumSize();
else if (what == MAX)
return comp.getMaximumSize();
return comp.getPreferredSize();
}
// 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 (left_to_right)
my_west = firstItem;
else
my_east = firstItem;
}
if (lastItem != null)
{
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

View File

@ -1,6 +1,6 @@
// 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;
}
comps[i].setBounds (hgap + ins.left, vgap + ins.top,
width - 2 * hgap - ins.left - ins.right,
height - 2 * vgap - ins.top - ins.bottom);
}
}
@ -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
{

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,31 @@
/* Copyright (C) 2000, 2001 Free Software Foundation
/* Copyright (C) 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. */
/**
* @author Bryce McKinlay <bryce@albatross.co.nz>
*/
/* Status: Incomplete. Needs a Locale lookup table. */

View File

@ -1,10 +1,27 @@
/* 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 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()
{
if (! isValid ())
// FIXME: use the tree lock?
synchronized (this)
{
validateTree ();
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,16 +434,19 @@ public class Container extends Component
for (int i = 0; i < ncomponents; ++i)
{
Component comp = component[i];
if (comp instanceof Container)
if (! comp.isValid ())
{
((Container) comp).validateTree();
}
else
{
component[i].validate();
if (comp instanceof Container)
{
((Container) comp).validateTree();
}
else
{
component[i].validate();
}
}
}
/* children will call invalidate() when they are layed out. It
is therefore imporant that valid is not set to true
before after the children has been layed out. */
@ -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)
@ -288,13 +474,25 @@ public class Container extends Component
else
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)
@ -302,13 +500,25 @@ public class Container extends Component
else
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())
@ -365,7 +598,7 @@ public class Container extends Component
* be visited.
*/
private void visitChildren(Graphics gfx, GfxVisitor visitor,
boolean lightweightOnly)
boolean lightweightOnly)
{
// FIXME: do locking
@ -408,29 +641,57 @@ 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);
visitChildren(g, GfxPrintAllVisitor.INSTANCE, true);
}
void dispatchEventImpl(AWTEvent e)
{
if ((e.id <= ContainerEvent.CONTAINER_LAST
@ -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);
}
@ -458,35 +732,70 @@ public class Container extends Component
return getListenersImpl(listenerType, containerListener);
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)
processContainerEvent((ContainerEvent) e);
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)
return;
switch (e.id)
{
case ContainerEvent.COMPONENT_ADDED:
containerListener.componentAdded(e);
case ContainerEvent.COMPONENT_ADDED:
containerListener.componentAdded(e);
break;
case ContainerEvent.COMPONENT_REMOVED:
containerListener.componentRemoved(e);
case ContainerEvent.COMPONENT_REMOVED:
containerListener.componentRemoved(e);
break;
}
}
/** @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 ()
{
super.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();
@ -592,7 +958,14 @@ 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);

View File

@ -1,10 +1,28 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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. */
/** @author Bryce McKinlay */

View File

@ -1,10 +1,28 @@
/* 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,13 +36,19 @@ 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;
private AWTEvent[] queue = new AWTEvent[INITIAL_QUEUE_DEPTH];
private int next_in = 0; // Index where next event will be added to queue
private int next_out = 0; // Index of next event to be removed from queue
@ -33,40 +57,68 @@ 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
{
if (next != null)
return next.getNextEvent();
while (next_in == next_out)
wait();
AWTEvent res = queue[next_out];
if (++next_out == queue.length)
next_out = 0;
return res;
}
/** @specnote Does not block. Returns null if there are no events on the
/**
* 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()
{
if (next != null)
return next.peekEvent();
if (next_in != next_out)
return queue[next_out];
else return null;
}
/** @specnote Does not block. Returns null if there are no matching events
/**
* 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)
@ -83,7 +135,12 @@ 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)
@ -92,7 +149,7 @@ public class EventQueue
return;
}
// FIXME: Security checks?
/* Check for any events already on the queue with the same source
and ID. */
int i = next_out;
@ -123,24 +180,24 @@ public class EventQueue
queue[next_in] = evt;
if (++next_in == queue.length)
next_in = 0;
if (next_in == next_out)
{
/* Queue is full. Extend it. */
AWTEvent[] oldQueue = queue;
queue = new AWTEvent[queue.length * 2];
int len = oldQueue.length - next_out;
System.arraycopy(oldQueue, next_out, queue, 0, len);
if (next_out != 0)
System.arraycopy(oldQueue, 0, queue, len, next_out);
next_out = 0;
next_in = oldQueue.length;
}
notify();
}
/** @since JDK1.2 */
public static void invokeAndWait(Runnable runnable)
throws InterruptedException, InvocationTargetException
@ -149,7 +206,7 @@ public class EventQueue
Thread current = Thread.currentThread();
if (current == eq.dispatchThread)
throw new Error("Can't call invokeAndWait from event dispatch thread");
InvocationEvent ie =
new InvocationEvent(eq, runnable, current, true);
@ -160,11 +217,11 @@ public class EventQueue
}
Exception exception;
if ((exception = ie.getException()) != null)
throw new InvocationTargetException(exception);
}
/** @since JDK1.2 */
public static void invokeLater(Runnable runnable)
{
@ -175,13 +232,13 @@ public class EventQueue
eq.postEvent(ie);
}
public static boolean isDispatchThread()
{
EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
return (Thread.currentThread() == eq.dispatchThread);
}
/** Allows a custom EventQueue implementation to replace this one.
* All pending events are transferred to the new queue. Calls to postEvent,
* getNextEvent, and peekEvent are forwarded to the pushed queue until it
@ -201,21 +258,21 @@ public class EventQueue
next = newEventQueue;
newEventQueue.prev = this;
}
/** Transfer any pending events from this queue back to the parent queue that
* was previously push()ed. Event dispatch from this queue is suspended. */
protected void pop() throws EmptyStackException
{
if (prev == null)
throw new EmptyStackException();
// Don't synchronize both this and prev at the same time, or deadlock could
// occur.
synchronized (prev)
{
prev.next = null;
}
synchronized (this)
{
int i = next_out;
@ -228,7 +285,7 @@ public class EventQueue
}
}
}
protected void dispatchEvent(AWTEvent evt)
{
if (evt instanceof ActiveEvent)

View File

@ -1,12 +1,30 @@
// 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;
}

View File

@ -1,150 +1,459 @@
/* 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;
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;
/* A very incomplete placeholder. */
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)
{
super();
setTitle(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;
public Frame(String title, GraphicsConfiguration gc)
{
super(gc);
setTitle(title);
}
/**
* 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;
public String getTitle()
{
return (title != null) ? title : "";
}
/**
* 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();
System.err.println("returned");
this.title = title;
System.err.println("end");
}
public
Frame(GraphicsConfiguration gc)
{
super(gc);
}
public
Frame(String title, GraphicsConfiguration gc)
{
super(gc);
setTitle(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);
}
/*************************************************************************/
/**
* 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(icon);
}
/*************************************************************************/
/**
* 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);
}
/*************************************************************************/
/**
* 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);
}
/*************************************************************************/
/**
* 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(resizable);
}
/*************************************************************************/
/**
* 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());
}
/*************************************************************************/
/**
* 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();
}
/*************************************************************************/
/**
* 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())
{
Window w = (Window)e.nextElement();
w.dispose();
}
super.dispose();
}
/*************************************************************************/
/**
* 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. */
public void setTitle (String title)
{
this.title = title;
if (peer != null)
((FramePeer)peer).setTitle(title);
}
return state;
}
public Image getIconImage()
{
return iconImage;
}
public void setIconImage(Image image)
{
iconImage = image;
if (peer != null)
((FramePeer) peer).setIconImage(iconImage);
}
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();
}
public synchronized void setMenuBar (MenuBar menuBar)
{
if (this.menuBar != menuBar)
{
//this.menuBar.removeNotify();
this.menuBar = menuBar;
//this.menuBar.addNotify();
}
if (peer != null)
((FramePeer) peer).setMenuBar(menuBar);
}
public boolean isResizable()
{
return isResizable;
}
public void setResizable(boolean resizable)
{
isResizable = resizable;
if (peer != null)
((FramePeer) peer).setResizable(isResizable);
}
public int getState()
{
/* FIXME: State might have changed in the peer... Must check. */
return state;
}
public synchronized 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)
{
setMenuBar(null);
return;
}
super.remove(m);
}
public void removeNotify()
{
//if ((peer != null) && (menuBar != null)) menuBar.removeNotify();
super.removeNotify();
}
public static Frame[] getFrames()
{
//Frame[] array = new Frames[frames.size()];
//return frames.toArray(array);
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);
}
String msg = "FIXME: can't be implemented without weak references";
throw new UnsupportedOperationException(msg);
}
} // class Frame

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* Copyright (C) 2000, 2001 Free Software Foundation
/* Copyright (C) 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. */
/* Status: Complete, but commented out until we have the required
GraphicsDevice. */

View File

@ -1,10 +1,28 @@
/* 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;

View File

@ -1,10 +1,28 @@
/* 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,21 +333,49 @@ 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
* is returned.
*/
/**
* 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)
{
int newx = x < r.x ? r.x : x;
@ -203,9 +390,17 @@ 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
* intersection with a non-zero location), false is returned.
*/
/**
* 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)
{
int neww = (x + width < r.x + r.width ?
@ -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;
}
}

View File

@ -1,10 +1,27 @@
/* Copyright (C) 2000, 2001 Free Software Foundation
/* Copyright (C) 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;

View File

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

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,29 @@
/* 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 */

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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;
import java.awt.*;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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;
import java.awt.*;

View File

@ -1,10 +1,27 @@
/* 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.geom;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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,7 +41,15 @@ public abstract class Line2D implements Shape, Cloneable
public Object clone ()
{
return super.clone ();
try
{
return super.clone ();
}
catch (CloneNotSupportedException _)
{
// Can't happen.
return null;
}
}
public boolean contains (double x, double y)

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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.geom;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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;
import java.awt.*;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,28 @@
/* 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).

View File

@ -1,17 +1,35 @@
/* 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()
{
}
/**

View File

@ -1,16 +1,33 @@
/* 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
{

View File

@ -1,14 +1,31 @@
/* 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 */

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,23 +1,56 @@
/* 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);
}
@ -106,15 +168,22 @@ public class DirectColorModel extends PackedColorModel
(field << to8BitShift) :
(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);
}
public int getRed(Object inData)
{
return getRed(getPixelFromArray(inData));

View File

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

View File

@ -1,16 +1,33 @@
/* 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>

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* 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;

View File

@ -1,10 +1,27 @@
/* Copyright (C) 2000, 2001 Free Software Foundation
/* Copyright (C) 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.image;

View File

@ -1,15 +1,32 @@
/* 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>

View File

@ -1,10 +1,27 @@
/* 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;