From: Bryce McKinlay Date: Wed, 12 Jul 2000 03:32:07 +0000 (+0000) Subject: Big AWT patch. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7a136d3ef16cf20fcd5314036508e31870b4849;p=platform%2Fupstream%2Fgcc.git Big AWT patch. From-SVN: r34976 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 779aef4..e99ca61 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,82 @@ +2000-07-12 Bryce McKinlay + + AWT Stuff: + * java/util/ResourceBundle.java (getLocale): stub. + * Makefile.am: Added new AWT classes. + * Makefile.in: Rebuilt. + * java/awt/AWTEvent.java: Add EVENT_MASK constants, isConsumed, + constructors. Fix toString() and paramString(). + * java/awt/AWTEventMulticaster.java: New class. Implemented. + * java/awt/CheckboxGroup.java: New class. + * java/awt/ColorModel.java: New class. + * java/awt/Component.java: Added stubs for most methods. Implemented + event dispatch. + * java/awt/Container.java: ditto. + * java/awt/ComponentOrientation.java: New class. Partly implemented. + * java/awt/Cursor.java: ditto. + * java/awt/Event.java: Fix paramString(). + * java/awt/EventQueue.java: New class. Implemented. + * java/awt/Font.java: Added additional stub methods. Implemented + toString(). + * java/awt/FontMetrics.java: New class. Stubbed. + * java/awt/GraphicsConfiguration.java: New class. Complete, except for + Java2D parts. + * java/awt/Insets.java: New class. Implemented. + * java/awt/Menu.java: Add new methods. Partially implemented. + * java/awt/MenuItem.java: Add new methods and fields. Partially + implemented. + * java/awt/MenuShortcut.java: New class. Implemented. + * java/awt/Panel.java: New class. Placeholder. + * java/awt/PopupMenu.java: New class. Stubbed. + * java/awt/Rectangle.java: New class. Implemented. + * java/awt/Toolkit.java: Added getSystemEventQueue() stub. + * java/awt/event/ActionEvent.java: Implement paramString(). + * java/awt/event/AdjustmentEvent.java: Implement paramString(). + * java/awt/event/ComponentEvent.java: Implement paramString(). + * java/awt/event/ContainerEvent.java: Implement paramString(). + * java/awt/event/FocusEvent.java: Implement paramString(). + * java/awt/event/HierarchyBoundsAdapter.java: New class. + * java/awt/event/HierarchyBoundsListener.java: New class. + * java/awt/event/HierarchyEvent.java: New class. + * java/awt/event/HierarchyListener.java: New class. + * java/awt/event/InputMethodEvent.java: Implement paramString(). + * java/awt/event/InvocationEvent.java: Implement paramString(). Throw + exception if !catchExceptions. + * java/awt/event/ItemEvent.java: Implement paramString(). + * java/awt/event/KeyEvent.java: Implement paramString(). + * java/awt/event/MouseEvent.java: Implement paramString(). + * java/awt/event/PaintEvent.java: Implement paramString(). + * java/awt/event/TextEvent.java: Implement paramString(). + * java/awt/event/WindowEvent.java: Implement paramString(). + + AWT Peer interfaces: + * java/awt/peer/ButtonPeer.java: New file. + * java/awt/peer/ListPeer.java: New file. + * java/awt/peer/CanvasPeer.java: New file. + * java/awt/peer/MenuBarPeer.java: New file. + * java/awt/peer/CheckboxMenuItemPeer.java: New file. + * java/awt/peer/MenuComponentPeer.java: New file. + * java/awt/peer/CheckboxPeer.java: New file. + * java/awt/peer/MenuItemPeer.java: New file. + * java/awt/peer/ChoicePeer.java: New file. + * java/awt/peer/MenuPeer.java: New file. + * java/awt/peer/ComponentPeer.java: Implemented. + * java/awt/peer/PanelPeer.java: New file. + * java/awt/peer/ContainerPeer.java: Implemented. + * java/awt/peer/PopupMenuPeer.java: New file. + * java/awt/peer/DialogPeer.java: New file. + * java/awt/peer/ScrollPanePeer.java: New file. + * java/awt/peer/FileDialogPeer.java: New file. + * java/awt/peer/ScrollbarPeer.java: New file. + * java/awt/peer/FontPeer.java: New file. + * java/awt/peer/TextAreaPeer.java: New file. + * java/awt/peer/FramePeer.java: Implemented. + * java/awt/peer/TextComponentPeer.java: New file. + * java/awt/peer/LabelPeer.java: New file. + * java/awt/peer/TextFieldPeer.java: New file. + * java/awt/peer/LightweightPeer.java: New file. + * java/awt/peer/WindowPeer.java: Implemented. + 2000-07-06 Tom Tromey * java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): @@ -32,7 +111,7 @@ 2000-06-28 Bryce McKinlay - * ThreadGroup.java: Added synchronized flag to many methods. + * java/lang/ThreadGroup.java: Added synchronized flag to many methods. (destroyed_flag): Removed. (isDestroyed, removeGroup, removeThread): Test for parent == null. (activeCount): Added spec note. diff --git a/libjava/Makefile.am b/libjava/Makefile.am index 01f7604..e48a35b 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -489,8 +489,12 @@ awt_java_source_files = \ java/awt/event/ActionEvent.java \ java/awt/event/ActionListener.java \ java/awt/event/ComponentEvent.java \ -java/awt/event/KeyAdapter.java \ +java/awt/event/HierarchyBoundsAdapter.java \ +java/awt/event/HierarchyBoundsListener.java \ +java/awt/event/HierarchyEvent.java \ +java/awt/event/HierarchyListener.java \ java/awt/event/InputEvent.java \ +java/awt/event/KeyAdapter.java \ java/awt/event/KeyEvent.java \ java/awt/event/KeyListener.java \ java/awt/event/TextEvent.java \ @@ -520,14 +524,25 @@ java/awt/event/ItemEvent.java \ java/awt/event/InvocationEvent.java \ java/awt/event/PaintEvent.java \ java/awt/event/ContainerEvent.java \ +java/awt/AWTError.java \ java/awt/AWTEvent.java \ +java/awt/AWTEventMulticaster.java \ java/awt/BorderLayout.java \ +java/awt/CheckboxGroup.java \ +java/awt/ColorModel.java \ java/awt/Component.java \ +java/awt/ComponentOrientation.java \ java/awt/Container.java \ +java/awt/Cursor.java \ java/awt/Dimension.java \ java/awt/Event.java \ +java/awt/EventDispatchThread.java \ +java/awt/EventQueue.java \ java/awt/Font.java \ +java/awt/FontMetrics.java \ java/awt/Frame.java \ +java/awt/GraphicsConfiguration.java \ +java/awt/Insets.java \ java/awt/LayoutManager.java \ java/awt/LayoutManager2.java \ java/awt/Menu.java \ @@ -535,18 +550,45 @@ java/awt/MenuBar.java \ java/awt/MenuComponent.java \ java/awt/MenuContainer.java \ java/awt/MenuItem.java \ +java/awt/MenuShortcut.java \ +java/awt/Panel.java \ java/awt/Point.java \ -java/awt/AWTError.java \ +java/awt/PopupMenu.java \ java/awt/Shape.java \ java/awt/TextArea.java \ java/awt/TextComponent.java \ java/awt/Toolkit.java \ java/awt/Window.java \ +java/awt/image/ImageConsumer.java \ +java/awt/image/ImageObserver.java \ +java/awt/image/ImageProducer.java \ java/awt/geom/Dimension2D.java \ java/awt/geom/Point2D.java \ +java/awt/peer/ButtonPeer.java \ +java/awt/peer/CanvasPeer.java \ +java/awt/peer/CheckboxMenuItemPeer.java \ +java/awt/peer/CheckboxPeer.java \ +java/awt/peer/ChoicePeer.java \ java/awt/peer/ComponentPeer.java \ java/awt/peer/ContainerPeer.java \ +java/awt/peer/DialogPeer.java \ +java/awt/peer/FileDialogPeer.java \ +java/awt/peer/FontPeer.java \ java/awt/peer/FramePeer.java \ +java/awt/peer/LabelPeer.java \ +java/awt/peer/LightweightPeer.java \ +java/awt/peer/ListPeer.java \ +java/awt/peer/MenuBarPeer.java \ +java/awt/peer/MenuComponentPeer.java \ +java/awt/peer/MenuItemPeer.java \ +java/awt/peer/MenuPeer.java \ +java/awt/peer/PanelPeer.java \ +java/awt/peer/PopupMenuPeer.java \ +java/awt/peer/ScrollPanePeer.java \ +java/awt/peer/ScrollbarPeer.java \ +java/awt/peer/TextAreaPeer.java \ +java/awt/peer/TextComponentPeer.java \ +java/awt/peer/TextFieldPeer.java \ java/awt/peer/WindowPeer.java \ java/awt/Adjustable.java \ java/awt/Color.java \ diff --git a/libjava/Makefile.in b/libjava/Makefile.in index d7b7dc5..3657a60 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -265,8 +265,12 @@ awt_java_source_files = \ java/awt/event/ActionEvent.java \ java/awt/event/ActionListener.java \ java/awt/event/ComponentEvent.java \ -java/awt/event/KeyAdapter.java \ +java/awt/event/HierarchyBoundsAdapter.java \ +java/awt/event/HierarchyBoundsListener.java \ +java/awt/event/HierarchyEvent.java \ +java/awt/event/HierarchyListener.java \ java/awt/event/InputEvent.java \ +java/awt/event/KeyAdapter.java \ java/awt/event/KeyEvent.java \ java/awt/event/KeyListener.java \ java/awt/event/TextEvent.java \ @@ -296,14 +300,25 @@ java/awt/event/ItemEvent.java \ java/awt/event/InvocationEvent.java \ java/awt/event/PaintEvent.java \ java/awt/event/ContainerEvent.java \ +java/awt/AWTError.java \ java/awt/AWTEvent.java \ +java/awt/AWTEventMulticaster.java \ java/awt/BorderLayout.java \ +java/awt/CheckboxGroup.java \ +java/awt/ColorModel.java \ java/awt/Component.java \ +java/awt/ComponentOrientation.java \ java/awt/Container.java \ +java/awt/Cursor.java \ java/awt/Dimension.java \ java/awt/Event.java \ +java/awt/EventDispatchThread.java \ +java/awt/EventQueue.java \ java/awt/Font.java \ +java/awt/FontMetrics.java \ java/awt/Frame.java \ +java/awt/GraphicsConfiguration.java \ +java/awt/Insets.java \ java/awt/LayoutManager.java \ java/awt/LayoutManager2.java \ java/awt/Menu.java \ @@ -311,18 +326,45 @@ java/awt/MenuBar.java \ java/awt/MenuComponent.java \ java/awt/MenuContainer.java \ java/awt/MenuItem.java \ +java/awt/MenuShortcut.java \ +java/awt/Panel.java \ java/awt/Point.java \ -java/awt/AWTError.java \ +java/awt/PopupMenu.java \ java/awt/Shape.java \ java/awt/TextArea.java \ java/awt/TextComponent.java \ java/awt/Toolkit.java \ java/awt/Window.java \ +java/awt/image/ImageConsumer.java \ +java/awt/image/ImageObserver.java \ +java/awt/image/ImageProducer.java \ java/awt/geom/Dimension2D.java \ java/awt/geom/Point2D.java \ +java/awt/peer/ButtonPeer.java \ +java/awt/peer/CanvasPeer.java \ +java/awt/peer/CheckboxMenuItemPeer.java \ +java/awt/peer/CheckboxPeer.java \ +java/awt/peer/ChoicePeer.java \ java/awt/peer/ComponentPeer.java \ java/awt/peer/ContainerPeer.java \ +java/awt/peer/DialogPeer.java \ +java/awt/peer/FileDialogPeer.java \ +java/awt/peer/FontPeer.java \ java/awt/peer/FramePeer.java \ +java/awt/peer/LabelPeer.java \ +java/awt/peer/LightweightPeer.java \ +java/awt/peer/ListPeer.java \ +java/awt/peer/MenuBarPeer.java \ +java/awt/peer/MenuComponentPeer.java \ +java/awt/peer/MenuItemPeer.java \ +java/awt/peer/MenuPeer.java \ +java/awt/peer/PanelPeer.java \ +java/awt/peer/PopupMenuPeer.java \ +java/awt/peer/ScrollPanePeer.java \ +java/awt/peer/ScrollbarPeer.java \ +java/awt/peer/TextAreaPeer.java \ +java/awt/peer/TextComponentPeer.java \ +java/awt/peer/TextFieldPeer.java \ java/awt/peer/WindowPeer.java \ java/awt/Adjustable.java \ java/awt/Color.java \ @@ -904,14 +946,13 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ DATA = $(data_DATA) $(toolexeclib_DATA) DIST_COMMON = README COPYING ChangeLog Makefile.am Makefile.in NEWS \ -THANKS acconfig.h acinclude.m4 aclocal.m4 configure configure.in \ -include/config.h.in include/stamp-h.in libgcj-test.spec.in \ -libgcj.spec.in +THANKS acinclude.m4 aclocal.m4 configure configure.in \ +libgcj-test.spec.in libgcj.spec.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best DIST_SUBDIRS = @DIRLTDL@ testsuite gcj include @DIRLTDL@ gcj include DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ @@ -971,19 +1012,26 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ .deps/gnu/java/security/provider/SHA.P \ .deps/gnu/java/security/provider/SHA1PRNG.P .deps/interpret.P \ .deps/java/awt/AWTError.P .deps/java/awt/AWTEvent.P \ -.deps/java/awt/AWTException.P .deps/java/awt/ActiveEvent.P \ -.deps/java/awt/Adjustable.P .deps/java/awt/BorderLayout.P \ -.deps/java/awt/Color.P .deps/java/awt/Component.P \ -.deps/java/awt/Container.P .deps/java/awt/Dimension.P \ -.deps/java/awt/Event.P .deps/java/awt/Font.P .deps/java/awt/Frame.P \ -.deps/java/awt/Graphics.P \ +.deps/java/awt/AWTEventMulticaster.P .deps/java/awt/AWTException.P \ +.deps/java/awt/ActiveEvent.P .deps/java/awt/Adjustable.P \ +.deps/java/awt/BorderLayout.P .deps/java/awt/CheckboxGroup.P \ +.deps/java/awt/Color.P .deps/java/awt/ColorModel.P \ +.deps/java/awt/Component.P .deps/java/awt/ComponentOrientation.P \ +.deps/java/awt/Container.P .deps/java/awt/Cursor.P \ +.deps/java/awt/Dimension.P .deps/java/awt/Event.P \ +.deps/java/awt/EventDispatchThread.P .deps/java/awt/EventQueue.P \ +.deps/java/awt/Font.P .deps/java/awt/FontMetrics.P \ +.deps/java/awt/Frame.P .deps/java/awt/Graphics.P \ +.deps/java/awt/GraphicsConfiguration.P \ .deps/java/awt/IllegalComponentStateException.P .deps/java/awt/Image.P \ -.deps/java/awt/ItemSelectable.P .deps/java/awt/LayoutManager.P \ -.deps/java/awt/LayoutManager2.P .deps/java/awt/Menu.P \ -.deps/java/awt/MenuBar.P .deps/java/awt/MenuComponent.P \ -.deps/java/awt/MenuContainer.P .deps/java/awt/MenuItem.P \ +.deps/java/awt/Insets.P .deps/java/awt/ItemSelectable.P \ +.deps/java/awt/LayoutManager.P .deps/java/awt/LayoutManager2.P \ +.deps/java/awt/Menu.P .deps/java/awt/MenuBar.P \ +.deps/java/awt/MenuComponent.P .deps/java/awt/MenuContainer.P \ +.deps/java/awt/MenuItem.P .deps/java/awt/MenuShortcut.P \ .deps/java/awt/Paint.P .deps/java/awt/PaintContext.P \ -.deps/java/awt/Point.P .deps/java/awt/Rectangle.P \ +.deps/java/awt/Panel.P .deps/java/awt/Point.P \ +.deps/java/awt/PopupMenu.P .deps/java/awt/Rectangle.P \ .deps/java/awt/Shape.P .deps/java/awt/TextArea.P \ .deps/java/awt/TextComponent.P .deps/java/awt/Toolkit.P \ .deps/java/awt/Transparency.P .deps/java/awt/Window.P \ @@ -999,7 +1047,12 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ .deps/java/awt/event/ContainerEvent.P \ .deps/java/awt/event/ContainerListener.P \ .deps/java/awt/event/FocusAdapter.P .deps/java/awt/event/FocusEvent.P \ -.deps/java/awt/event/FocusListener.P .deps/java/awt/event/InputEvent.P \ +.deps/java/awt/event/FocusListener.P \ +.deps/java/awt/event/HierarchyBoundsAdapter.P \ +.deps/java/awt/event/HierarchyBoundsListener.P \ +.deps/java/awt/event/HierarchyEvent.P \ +.deps/java/awt/event/HierarchyListener.P \ +.deps/java/awt/event/InputEvent.P \ .deps/java/awt/event/InputMethodEvent.P \ .deps/java/awt/event/InputMethodListener.P \ .deps/java/awt/event/InvocationEvent.P .deps/java/awt/event/ItemEvent.P \ @@ -1013,12 +1066,27 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ .deps/java/awt/event/TextListener.P \ .deps/java/awt/event/WindowAdapter.P .deps/java/awt/event/WindowEvent.P \ .deps/java/awt/event/WindowListener.P .deps/java/awt/geom/Dimension2D.P \ -.deps/java/awt/geom/Point2D.P .deps/java/awt/peer/ComponentPeer.P \ -.deps/java/awt/peer/ContainerPeer.P .deps/java/awt/peer/FramePeer.P \ -.deps/java/awt/peer/WindowPeer.P .deps/java/beans/BeanDescriptor.P \ -.deps/java/beans/BeanInfo.P .deps/java/beans/Beans.P \ -.deps/java/beans/Customizer.P .deps/java/beans/DesignMode.P \ -.deps/java/beans/EventSetDescriptor.P \ +.deps/java/awt/geom/Point2D.P .deps/java/awt/image/ImageConsumer.P \ +.deps/java/awt/image/ImageObserver.P \ +.deps/java/awt/image/ImageProducer.P .deps/java/awt/peer/ButtonPeer.P \ +.deps/java/awt/peer/CanvasPeer.P \ +.deps/java/awt/peer/CheckboxMenuItemPeer.P \ +.deps/java/awt/peer/CheckboxPeer.P .deps/java/awt/peer/ChoicePeer.P \ +.deps/java/awt/peer/ComponentPeer.P .deps/java/awt/peer/ContainerPeer.P \ +.deps/java/awt/peer/DialogPeer.P .deps/java/awt/peer/FileDialogPeer.P \ +.deps/java/awt/peer/FontPeer.P .deps/java/awt/peer/FramePeer.P \ +.deps/java/awt/peer/LabelPeer.P .deps/java/awt/peer/LightweightPeer.P \ +.deps/java/awt/peer/ListPeer.P .deps/java/awt/peer/MenuBarPeer.P \ +.deps/java/awt/peer/MenuComponentPeer.P \ +.deps/java/awt/peer/MenuItemPeer.P .deps/java/awt/peer/MenuPeer.P \ +.deps/java/awt/peer/PanelPeer.P .deps/java/awt/peer/PopupMenuPeer.P \ +.deps/java/awt/peer/ScrollPanePeer.P \ +.deps/java/awt/peer/ScrollbarPeer.P .deps/java/awt/peer/TextAreaPeer.P \ +.deps/java/awt/peer/TextComponentPeer.P \ +.deps/java/awt/peer/TextFieldPeer.P .deps/java/awt/peer/WindowPeer.P \ +.deps/java/beans/BeanDescriptor.P .deps/java/beans/BeanInfo.P \ +.deps/java/beans/Beans.P .deps/java/beans/Customizer.P \ +.deps/java/beans/DesignMode.P .deps/java/beans/EventSetDescriptor.P \ .deps/java/beans/FeatureDescriptor.P \ .deps/java/beans/IndexedPropertyDescriptor.P \ .deps/java/beans/IntrospectionException.P \ @@ -1296,34 +1364,6 @@ config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) - -include/config.h: include/stamp-h - @if test ! -f $@; then \ - rm -f include/stamp-h; \ - $(MAKE) include/stamp-h; \ - else :; fi -include/stamp-h: $(srcdir)/include/config.h.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES= CONFIG_HEADERS=include/config.h \ - $(SHELL) ./config.status - @echo timestamp > include/stamp-h 2> /dev/null -$(srcdir)/include/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/include/stamp-h.in - @if test ! -f $@; then \ - rm -f $(srcdir)/include/stamp-h.in; \ - $(MAKE) $(srcdir)/include/stamp-h.in; \ - else :; fi -$(srcdir)/include/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h - cd $(top_srcdir) && $(AUTOHEADER) - @echo timestamp > $(srcdir)/include/stamp-h.in 2> /dev/null - -mostlyclean-hdr: - -clean-hdr: - -distclean-hdr: - -rm -f include/config.h - -maintainer-clean-hdr: libgcj.spec: $(top_builddir)/config.status libgcj.spec.in cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status libgcj-test.spec: $(top_builddir)/config.status libgcj-test.spec.in @@ -1786,33 +1826,31 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: -mostlyclean-am: mostlyclean-hdr mostlyclean-toolexeclibLIBRARIES \ - mostlyclean-compile mostlyclean-libtool \ - mostlyclean-toolexeclibLTLIBRARIES \ +mostlyclean-am: mostlyclean-toolexeclibLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-toolexeclibLTLIBRARIES \ mostlyclean-binPROGRAMS mostlyclean-noinstPROGRAMS \ mostlyclean-tags mostlyclean-depend mostlyclean-generic mostlyclean: mostlyclean-recursive -clean-am: clean-hdr clean-toolexeclibLIBRARIES clean-compile \ - clean-libtool clean-toolexeclibLTLIBRARIES \ - clean-binPROGRAMS clean-noinstPROGRAMS clean-tags \ - clean-depend clean-generic mostlyclean-am clean-local +clean-am: clean-toolexeclibLIBRARIES clean-compile clean-libtool \ + clean-toolexeclibLTLIBRARIES clean-binPROGRAMS \ + clean-noinstPROGRAMS clean-tags clean-depend \ + clean-generic mostlyclean-am clean-local clean: clean-recursive -distclean-am: distclean-hdr distclean-toolexeclibLIBRARIES \ - distclean-compile distclean-libtool \ - distclean-toolexeclibLTLIBRARIES distclean-binPROGRAMS \ - distclean-noinstPROGRAMS distclean-tags \ - distclean-depend distclean-generic clean-am +distclean-am: distclean-toolexeclibLIBRARIES distclean-compile \ + distclean-libtool distclean-toolexeclibLTLIBRARIES \ + distclean-binPROGRAMS distclean-noinstPROGRAMS \ + distclean-tags distclean-depend distclean-generic \ + clean-am -rm -f libtool distclean: distclean-recursive -rm -f config.status -maintainer-clean-am: maintainer-clean-hdr \ - maintainer-clean-toolexeclibLIBRARIES \ +maintainer-clean-am: maintainer-clean-toolexeclibLIBRARIES \ maintainer-clean-compile maintainer-clean-libtool \ maintainer-clean-toolexeclibLTLIBRARIES \ maintainer-clean-binPROGRAMS \ @@ -1825,8 +1863,7 @@ maintainer-clean-am: maintainer-clean-hdr \ maintainer-clean: maintainer-clean-recursive -rm -f config.status -.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ -mostlyclean-toolexeclibLIBRARIES distclean-toolexeclibLIBRARIES \ +.PHONY: mostlyclean-toolexeclibLIBRARIES distclean-toolexeclibLIBRARIES \ clean-toolexeclibLIBRARIES maintainer-clean-toolexeclibLIBRARIES \ uninstall-toolexeclibLIBRARIES install-toolexeclibLIBRARIES \ mostlyclean-compile distclean-compile clean-compile \ diff --git a/libjava/java/awt/AWTEvent.java b/libjava/java/awt/AWTEvent.java index bc9ea49..bb09f0c 100644 --- a/libjava/java/awt/AWTEvent.java +++ b/libjava/java/awt/AWTEvent.java @@ -1,20 +1,65 @@ /* Copyright (C) 1999, 2000 Free Software Foundation - This file is part of libjava. + This file is part of libgcj. This software is copyrighted work licensed under the terms of the -Libjava License. Please consult the file "LIBJAVA_LICENSE" for +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details. */ package java.awt; -/* A very incomplete placeholder. */ +/* Written using on-line Java 2 Platform Standard Edition v1.3 API + * Specification, as well as "The Java Class Libraries", 2nd edition + * (Addison-Wesley, 1998). + * Status: Believed complete and correct, except for the java.awt.Event + * compatibility constructor. + */ + +/** + * AWTEvent is the root event class for all AWT events in the JDK 1.1 event + * model. It supercedes the Event class from JDK 1.0. + */ public abstract class AWTEvent extends java.util.EventObject { protected boolean consumed; protected int id; + /* Event selection masks */ + public static final long COMPONENT_EVENT_MASK = 1 << 0, + CONTAINER_EVENT_MASK = 1 << 1, + FOCUS_EVENT_MASK = 1 << 2, + KEY_EVENT_MASK = 1 << 3, + MOUSE_EVENT_MASK = 1 << 4, + MOUSE_MOTION_EVENT_MASK = 1 << 5, + WINDOW_EVENT_MASK = 1 << 6, + ACTION_EVENT_MASK = 1 << 7, + ADJUSTMENT_EVENT_MASK = 1 << 8, + ITEM_EVENT_MASK = 1 << 9, + TEXT_EVENT_MASK = 1 << 10, + INPUT_METHOD_EVENT_MASK = 1 << 11; + + /* Additional event selection masks from JDK 1.3 javadocs */ + public static final long PAINT_EVENT_MASK = 1 << 13, + INVOCATION_EVENT_MASK = 1 << 14, + HIERARCHY_EVENT_MASK = 1 << 15, + HIERARCHY_BOUNDS_EVENT_MASK = 1 << 16; + + public static final int RESERVED_ID_MAX = 0x7cf; + + public AWTEvent(Event event) + { + // FIXME?? + super(event.target); + this.id = event.id; + } + + public AWTEvent(Object source, int id) + { + super(source); + this.id = id; + } + public int getID() { return id; @@ -22,17 +67,21 @@ public abstract class AWTEvent extends java.util.EventObject public String paramString () { - return toString (); + return ""; } public String toString () { - return getClass().getName() + "[" + id + "]"; + return getClass().getName() + "[" + paramString() + "] on " + source; } - - public AWTEvent (Object source, int id) + + protected void consume() { - super(source); - this.id = id; + consumed = true; + } + + protected boolean isConsumed() + { + return consumed; } } diff --git a/libjava/java/awt/AWTEventMulticaster.java b/libjava/java/awt/AWTEventMulticaster.java new file mode 100644 index 0000000..560ebbe --- /dev/null +++ b/libjava/java/awt/AWTEventMulticaster.java @@ -0,0 +1,463 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt; + +import java.awt.event.*; +import java.util.EventListener; +import java.io.ObjectOutputStream; + +/* Written using on-line Java 2 Platform Standard Edition v1.3 API + * Specification, as well as "The Java Class Libraries", 2nd edition + * (Addison-Wesley, 1998). + * Status: Believed complete and correct to J2SE 1.3, except for + * serialization support methods, save() and saveInternal(), which are + * stubbed. + */ + +/** + * Convienience class for thread-safe multicasting of AWT events, + * without synchronization. + * + * @author Bryce McKinlay + */ + +public class AWTEventMulticaster implements ComponentListener, + ContainerListener, FocusListener, KeyListener, MouseListener, + MouseMotionListener, WindowListener, ActionListener, ItemListener, + AdjustmentListener, TextListener, InputMethodListener, HierarchyListener, + HierarchyBoundsListener +{ + protected final EventListener a, b; + + protected AWTEventMulticaster(EventListener a, + EventListener b) + { + this.a = a; + this.b = b; + } + + protected static EventListener addInternal(EventListener a, EventListener b) + { + if (a == null) + return b; + else if (b == null) + return a; + else return new AWTEventMulticaster(a, b); + } + + protected static EventListener removeInternal(EventListener l, + EventListener oldl) + { + if (l == oldl) + return null; + else if (l instanceof AWTEventMulticaster) + { + AWTEventMulticaster mc = (AWTEventMulticaster) l; + return mc.remove(oldl); + } + return l; + } + + /* Remove oldl from this multicaster. */ + protected EventListener remove(EventListener oldl) + { + // If oldl is an immediate child, return the other child. + if (a == oldl) + return b; + if (b == oldl) + return a; + + // If a and/or b are Multicaster's, search them recursivly. + if (a instanceof AWTEventMulticaster) + { + AWTEventMulticaster mc = (AWTEventMulticaster) a; + EventListener newa = mc.remove(oldl); + if (newa != a) + return new AWTEventMulticaster (newa, b); + } + if (b instanceof AWTEventMulticaster) + { + AWTEventMulticaster mc = (AWTEventMulticaster) a; + EventListener newb = mc.remove(oldl); + if (newb != b) + return new AWTEventMulticaster (a, newb); + } + + // oldl was not found. + return this; + } + + public static ActionListener add(ActionListener a, ActionListener b) + { + return (ActionListener) addInternal(a, b); + } + + public static AdjustmentListener add(AdjustmentListener a, + AdjustmentListener b) + { + return (AdjustmentListener) addInternal(a, b); + } + + public static ComponentListener add(ComponentListener a, ComponentListener b) + { + return (ComponentListener) addInternal(a, b); + } + + public static ContainerListener add(ContainerListener a, ContainerListener b) + { + return (ContainerListener) addInternal(a, b); + } + + 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); + } + + public static ItemListener add(ItemListener a, ItemListener b) + { + return (ItemListener) addInternal(a, b); + } + + public static KeyListener add(KeyListener a, KeyListener b) + { + return (KeyListener) addInternal(a, b); + } + + public static MouseListener add(MouseListener a, MouseListener b) + { + return (MouseListener) addInternal(a, b); + } + + public static MouseMotionListener add(MouseMotionListener a, + MouseMotionListener b) + { + return (MouseMotionListener) addInternal(a, b); + } + + public static TextListener add(TextListener a, TextListener b) + { + return (TextListener) addInternal(a, b); + } + + public static WindowListener add(WindowListener a, WindowListener b) + { + return (WindowListener) addInternal(a, b); + } + + public static ActionListener remove(ActionListener l, ActionListener oldl) + { + return (ActionListener) removeInternal(l, oldl); + } + + public static AdjustmentListener remove(AdjustmentListener l, + AdjustmentListener oldl) + { + return (AdjustmentListener) removeInternal(l, oldl); + } + + public static ComponentListener remove(ComponentListener l, + ComponentListener oldl) + { + return (ComponentListener) removeInternal(l, oldl); + } + + public static ContainerListener remove(ContainerListener l, + ContainerListener oldl) + { + return (ContainerListener) removeInternal(l, oldl); + } + + public static FocusListener remove(FocusListener l, FocusListener oldl) + { + return (FocusListener) removeInternal(l, oldl); + } + + public static HierarchyBoundsListener remove(HierarchyBoundsListener l, + HierarchyBoundsListener oldl) + { + return (HierarchyBoundsListener) removeInternal(l, oldl); + } + + public static HierarchyListener remove(HierarchyListener l, + HierarchyListener oldl) + { + return (HierarchyListener) removeInternal(l, oldl); + } + + public static InputMethodListener remove(InputMethodListener l, + InputMethodListener oldl) + { + return (InputMethodListener) removeInternal(l, oldl); + } + + public static ItemListener remove(ItemListener l, ItemListener oldl) + { + return (ItemListener) removeInternal(l, oldl); + } + + public static KeyListener remove(KeyListener l, KeyListener oldl) + { + return (KeyListener) removeInternal(l, oldl); + } + + public static MouseListener remove(MouseListener l, MouseListener oldl) + { + return (MouseListener) removeInternal(l, oldl); + } + + public static MouseMotionListener remove(MouseMotionListener l, + MouseMotionListener oldl) + { + return (MouseMotionListener) removeInternal(l, oldl); + } + + public static TextListener remove(TextListener l, TextListener oldl) + { + return (TextListener) removeInternal(l, oldl); + } + + public static WindowListener remove(WindowListener l, WindowListener oldl) + { + return (WindowListener) removeInternal(l, oldl); + } + + public void actionPerformed(ActionEvent e) + { + ((ActionListener) a).actionPerformed(e); + ((ActionListener) b).actionPerformed(e); + } + + public void adjustmentValueChanged(AdjustmentEvent e) + { + ((AdjustmentListener) a).adjustmentValueChanged(e); + ((AdjustmentListener) b).adjustmentValueChanged(e); + } + + public void componentHidden(ComponentEvent e) + { + ((ComponentListener) a).componentHidden(e); + ((ComponentListener) b).componentHidden(e); + } + + public void componentMoved(ComponentEvent e) + { + ((ComponentListener) a).componentMoved(e); + ((ComponentListener) b).componentMoved(e); + } + + public void componentResized(ComponentEvent e) + { + ((ComponentListener) a).componentResized(e); + ((ComponentListener) b).componentResized(e); + } + + public void componentShown(ComponentEvent e) + { + ((ComponentListener) a).componentShown(e); + ((ComponentListener) b).componentShown(e); + } + + public void componentAdded(ContainerEvent e) + { + ((ContainerListener) a).componentAdded(e); + ((ContainerListener) b).componentAdded(e); + } + + public void componentRemoved(ContainerEvent e) + { + ((ContainerListener) a).componentRemoved(e); + ((ContainerListener) b).componentRemoved(e); + } + + public void focusGained(FocusEvent e) + { + ((FocusListener) a).focusGained(e); + ((FocusListener) b).focusGained(e); + } + + public void focusLost(FocusEvent e) + { + ((FocusListener) a).focusLost(e); + ((FocusListener) b).focusLost(e); + } + + + public void ancestorMoved(HierarchyEvent e) + { + ((HierarchyBoundsListener) a).ancestorMoved(e); + ((HierarchyBoundsListener) b).ancestorMoved(e); + } + + public void ancestorResized(HierarchyEvent e) + { + ((HierarchyBoundsListener) a).ancestorResized(e); + ((HierarchyBoundsListener) b).ancestorResized(e); + } + + public void hierarchyChanged(HierarchyEvent e) + { + ((HierarchyListener) a).hierarchyChanged(e); + ((HierarchyListener) b).hierarchyChanged(e); + } + + public void caretPositionChanged(InputMethodEvent e) + { + ((InputMethodListener) a).caretPositionChanged(e); + ((InputMethodListener) b).caretPositionChanged(e); + } + + public void inputMethodTextChanged(InputMethodEvent e) + { + ((InputMethodListener) a).inputMethodTextChanged(e); + ((InputMethodListener) b).inputMethodTextChanged(e); + } + + public void itemStateChanged(ItemEvent e) + { + ((ItemListener) a).itemStateChanged(e); + ((ItemListener) b).itemStateChanged(e); + } + + public void keyPressed(KeyEvent e) + { + ((KeyListener) a).keyPressed(e); + ((KeyListener) b).keyPressed(e); + } + + public void keyReleased(KeyEvent e) + { + ((KeyListener) a).keyReleased(e); + ((KeyListener) b).keyReleased(e); + } + + public void keyTyped(KeyEvent e) + { + ((KeyListener) a).keyTyped(e); + ((KeyListener) b).keyTyped(e); + } + + public void mouseClicked(MouseEvent e) + { + ((MouseListener) a).mouseClicked(e); + ((MouseListener) b).mouseClicked(e); + } + + + public void mouseEntered(MouseEvent e) + { + ((MouseListener) a).mouseEntered(e); + ((MouseListener) b).mouseEntered(e); + } + + public void mouseExited(MouseEvent e) + { + ((MouseListener) a).mouseExited(e); + ((MouseListener) b).mouseExited(e); + } + + public void mousePressed(MouseEvent e) + { + ((MouseListener) a).mousePressed(e); + ((MouseListener) b).mousePressed(e); + } + + public void mouseReleased(MouseEvent e) + { + ((MouseListener) a).mouseReleased(e); + ((MouseListener) b).mouseReleased(e); + } + + public void mouseDragged(MouseEvent e) + { + ((MouseMotionListener) a).mouseDragged(e); + ((MouseMotionListener) b).mouseDragged(e); + } + + public void mouseMoved(MouseEvent e) + { + ((MouseMotionListener) a).mouseMoved(e); + ((MouseMotionListener) b).mouseMoved(e); + } + + public void textValueChanged(TextEvent e) + { + ((TextListener) a).textValueChanged(e); + ((TextListener) b).textValueChanged(e); + } + + public void windowActivated(WindowEvent e) + { + ((WindowListener) a).windowActivated(e); + ((WindowListener) b).windowActivated(e); + } + + public void windowClosed(WindowEvent e) + { + ((WindowListener) a).windowClosed(e); + ((WindowListener) b).windowClosed(e); + } + + public void windowClosing(WindowEvent e) + { + ((WindowListener) a).windowClosing(e); + ((WindowListener) b).windowClosing(e); + } + + public void windowDeactivated(WindowEvent e) + { + ((WindowListener) a).windowDeactivated(e); + ((WindowListener) b).windowDeactivated(e); + } + + public void windowDeiconified(WindowEvent e) + { + ((WindowListener) a).windowDeiconified(e); + ((WindowListener) b).windowDeiconified(e); + } + + public void windowIconified(WindowEvent e) + { + ((WindowListener) a).windowIconified(e); + ((WindowListener) b).windowIconified(e); + } + + public void windowOpened(WindowEvent e) + { + ((WindowListener) a).windowOpened(e); + ((WindowListener) b).windowOpened(e); + } + + protected static void save(ObjectOutputStream s, String k, EventListener l) + { + // FIXME + } + + protected void saveInternal(ObjectOutputStream s, String k) + { + // FIXME + } + +} diff --git a/libjava/java/awt/CheckboxGroup.java b/libjava/java/awt/CheckboxGroup.java new file mode 100644 index 0000000..0acd7b5 --- /dev/null +++ b/libjava/java/awt/CheckboxGroup.java @@ -0,0 +1,18 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt; + +/* Status: Empty placeholder. */ + +public class CheckboxGroup +{ + // Fields from the serialization spec. Decalare others "transient". + boolean state; + int checkboxMenuItemSerializedDataVersion; +} diff --git a/libjava/java/awt/ColorModel.java b/libjava/java/awt/ColorModel.java new file mode 100644 index 0000000..0e58df1 --- /dev/null +++ b/libjava/java/awt/ColorModel.java @@ -0,0 +1,20 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt; + +/* Status: Just a placeholder. */ + +public class ColorModel implements Transparency +{ + public int getTransparency() + { + // FIXME + return 0; + } +} diff --git a/libjava/java/awt/Component.java b/libjava/java/awt/Component.java index d842910..d578826 100644 --- a/libjava/java/awt/Component.java +++ b/libjava/java/awt/Component.java @@ -1,108 +1,1339 @@ /* Copyright (C) 1999, 2000 Free Software Foundation - This file is part of libjava. + This file is part of libgcj. This software is copyrighted work licensed under the terms of the -Libjava License. Please consult the file "LIBJAVA_LICENSE" for +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details. */ package java.awt; import java.awt.event.*; -//import java.awt.peer.ComponentPeer; +import java.awt.image.*; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.lang.reflect.*; +import java.util.EventListener; +import java.util.Locale; +import java.util.ResourceBundle; +import java.util.Vector; +import java.awt.peer.ComponentPeer; +import java.beans.PropertyChangeSupport; +import java.beans.PropertyChangeListener; +// import javax.accessibility.AccessibleContext; -/* A very incomplete placeholder. */ +/* Status: Incomplete. The event dispatch mechanism is implemented. All + other methods defined in the J2SE 1.3 API javadoc exist, but are mostly + incomplete or only stubs; except for methods relating to the Drag and Drop, + Input Method, and Accessibility frameworks: These methods are present but + commented out. */ -public abstract class Component implements MenuContainer +public abstract class Component implements ImageObserver, MenuContainer, + java.io.Serializable { - Container parent; - java.awt.peer.ComponentPeer peer; - int x, y, width, height; - public Container getParent () { return parent; } + /* Constants for use with getAlignmentX()/getAlignmentY(). */ + public static final float BOTTOM_ALIGNMENT = 1.0f, + CENTER_ALIGNMENT = 0.5f, + LEFT_ALIGNMENT = 0.0f, + RIGHT_ALIGNMENT = 1.0f, + TOP_ALIGNMENT = 0.0f; + /* Serialized fields from the serialization spec. */ + // FIXME: Default values? + int x; + int y; + int width; + int height; + Color foreground; + Color background; + Font font; + Font peerFont; + Cursor cursor; + Locale locale; + boolean visible; + boolean enabled; + boolean valid; + boolean hasFocus; + //DropTarget dropTarget; + Vector popups; + String name; + boolean nameExplicitlySet; + Dimension minSize; + Dimension prefSize; + boolean newEventsOnly; + long eventMask; + PropertyChangeSupport changeSupport; + boolean isPacked; + int componentSerializedDataVersion; + /* AccessibleContext accessibleContext; */ + + /* Anything else is non-serializable, and should be declared "transient". */ + transient Container parent; + transient java.awt.peer.ComponentPeer peer; + + transient ComponentListener componentListener; + transient FocusListener focusListener; + transient KeyListener keyListener; + transient MouseListener mouseListener; + transient MouseMotionListener mouseMotionListener; + transient InputMethodListener inputMethodListener; + transient HierarchyListener hierarchyListener; + transient HierarchyBoundsListener hierarchyBoundsListener; + + protected Component() + { + } + + public String getName() + { + if (name == null && !nameExplicitlySet) + name = generateName(); + return name; + } + + public void setName(String name) + { + nameExplicitlySet = true; + this.name = name; + } + + /** Subclasses should override this to return unique component names like + * "menuitem0". + */ + String generateName() + { + // Component is abstract. + return null; + } + + public Container getParent() + { + return parent; + } + + /** @deprecated */ + public java.awt.peer.ComponentPeer getPeer() + { + return peer; + } + + // FIXME: java.awt.dnd classes not yet implemented + /* + public void setDropTarget(DropTarget dt) + { + this.dropTarget = dt; + } + + public DropTarget getDropTarget() + { + return dropTarget; + } + */ + + /** @since 1.3 */ + public GraphicsConfiguration getGraphicsConfiguration() + { + // FIXME + return null; + } + + public final Object getTreeLock() + { + // FIXME + return null; + } + + public Toolkit getToolkit() + { + // FIXME + return null; + } + + public boolean isValid() + { + // FIXME + return false; + } + + /** @since 1.2 */ + public boolean isDisplayable() + { + // FIXME + return false; + } + + public boolean isVisible() + { + return visible; + } + + public boolean isShowing() + { + // FIXME + return false; + } + + public boolean isEnabled() + { + return enabled; + } + + public void setEnabled(boolean b) + { + this.enabled = b; + } + + /** @deprecated */ + public void enable() + { + setEnabled(true); + } + + /** @deprecated */ + public void enable(boolean b) + { + setEnabled(b); + } + /** @deprecated */ - public java.awt.peer.ComponentPeer getPeer () { return peer; } + public void disable() + { + setEnabled(false); + } + + public boolean isDoubleBuffered() + { + return false; + } + + /** @since 1.2 */ + public void enableInputMethods(boolean enable) + { + // FIXME + } + + public void setVisible(boolean b) + { + visible = true; + // FIXME + } + + /** @deprecated */ + public void show() + { + setVisible(true); + } + + /** @deprecated */ + public void show(boolean b) + { + setVisible(b); + } + + /** @deprecated */ + public void hide() + { + setVisible(false); + } + + public Color getForeground() + { + return this.foreground; + } + + public void setForeground(Color c) + { + this.foreground = c; + } + + public Color getBackground() + { + return this.background; + } + + public void setBackground(Color c) + { + this.background = c; + } + + public Font getFont() + { + return this.font; + } + + public void setFont(Font f) + { + this.font = f; + } - public void setVisible (boolean b) - { /* FIXME */ } + public Locale getLocale() throws IllegalComponentStateException + { + if (locale != null) + return locale; + if (parent == null) + throw new IllegalComponentStateException + ("Component has no parent: Can not determine Locale"); + return parent.getLocale(); + } + + public void setLocale(Locale l) + { + this.locale = l; + } + + public ColorModel getColorModel() + { + // FIXME + return null; + } - public void setSize (Dimension d) - { setSize(d.width, d.height); } + public Point getLocation() + { + return new Point(x, y); + } - public void setSize (int width, int height) + public Point getLocationOnScreen() { - this.width = width; this.height = height; - if (peer != null) - peer.setBounds(x, y, width, height); + // FIXME + return null; + } + + /** @deprecated Use getLocation() instead. */ + public Point location() + { + return getLocation(); } public void setLocation (int x, int y) { - this.x = x; this.y = y; + this.x = x; + this.y = y; if (peer != null) peer.setBounds(x, y, width, height); } - public void setLocation (Point pt) - { setLocation(pt.x, pt.y); } - - public void setBounds (int x, int y, int w, int h) + /** @deprecated */ + public void move(int x, int y) + { + setLocation(x,y); + } + + public void setLocation(Point p) + { + setLocation(p.x, p.y); + } + + public Dimension getSize() + { + return new Dimension(width, height); + } + + /** @deprecated */ + public Dimension size() + { + return getSize(); + } + + public void setSize(int width, int height) { - this.x = x; this.y = y; - this.width = w; this.height = h; + this.width = width; + this.height = height; if (peer != null) - peer.setBounds(x, y, w, h); + peer.setBounds(x, y, width, height); + } + + /** @deprecated */ + public void resize(int width, int height) + { + setSize(width, height); + } + + public void setSize(Dimension d) + { + setSize(d.width, d.height); } - public void setBounds (Rectangle rect) - { setBounds(rect.x, rect.y, rect.width, rect.height); } - - public Rectangle getBounds () + /** @deprecated */ + public void resize(Dimension d) { - return new Rectangle(x, y, width, height); + setSize(d.width, d.height); } - public Point getLocation () + public Rectangle getBounds() { - return new Point(x, y); + return new Rectangle (x, y, width, height); } - public int getX () + /** @deprecated */ + public Rectangle bounds() + { + return getBounds(); + } + + public void setBounds(int x, int y, int w, int h) + { + this.x = x; + this.y = y; + this.width = w; + this.height = h; + if (peer != null) + peer.setBounds(x, y, w, h); + } + + /** @deprecated */ + public void reshape(int x, int y, int width, int height) + { + setBounds(x, y, width, height); + } + + public void setBounds(Rectangle r) + { + setBounds(r.x, r.y, r.width, r.height); + } + + /** @since 1.2 */ + public int getX() { return x; } - - public int getY () + + /** @since 1.2 */ + public int getY() { return y; } - - public Dimension getSize () + + /** @since 1.2 */ + public int getWidth() { - return new Dimension(width, height); + return width; } - - public Dimension getMinimumSize () + + /** @since 1.2 */ + public int getHeight() + { + return height; + } + + public Rectangle getBounds(Rectangle r) + { + r.x = this.x; + r.y = this.y; + r.width = this.width; + r.height = this.height; + return r; + } + + public Dimension getSize(Dimension d) + { + d.width = this.width; + d.height = this.height; + return d; + } + + public Point getLocation(Point p) + { + p.x = x; + p.y = y; + return p; + } + + /** @since 1.2 */ + public boolean isOpaque() + { + return false; + } + + /** @since 1.2 */ + public boolean isLightweight() + { + // FIXME + return false; + } + + public Dimension getPreferredSize() { + // FIXME? if (peer == null) return new Dimension(width, height); else - return peer.getMinimumSize(); + return peer.getPreferredSize(); } - public Dimension getPreferredSize () + /** @deprecated */ + public Dimension preferredSize() { + return getPreferredSize(); + } + + public Dimension getMinimumSize() + { + // FIXME? if (peer == null) return new Dimension(width, height); else - return peer.getPreferredSize(); + return peer.getMinimumSize(); } - public synchronized void addKeyListener (KeyListener listener) - { /* FIXME */ } + /** @deprecated */ + public Dimension minimumSize() + { + return getMinimumSize(); + } + + public Dimension getMaximumSize() + { + // FIXME + return null; + } + + public float getAlignmentX() + { + // FIXME + return 0; + } + + public float getAlignmentY() + { + // FIXME + return 0; + } + + public void doLayout() + { + // FIXME + } + + /** @deprecated */ + public void layout() + { + doLayout(); + } + + public void validate() + { + // FIXME + } + + public void invalidate() + { + // FIXME + } + + public Graphics getGraphics() + { + // FIXME + return null; + } + + public FontMetrics getFontMetrics(Font font) + { + // FIXME + return null; + } + + public void setCursor(Cursor cursor) + { + this.cursor = cursor; + } + + public Cursor getCursor() + { + return this.cursor; + } + + public void paint(Graphics g) + { + } + + public void update(Graphics g) + { + // FIXME + } + + public void paintAll(Graphics g) + { + } + + public void repaint() + { + // FIXME + } + + public void repaint(long tm) + { + // FIXME + } + + public void repaint(int x, int y, int width, int height) + { + // FIXME + } + + public void repaint(long tm, int x, int y, int width, int height) + { + // FIXME + } + + public void print(Graphics g) + { + // FIXME + } + + public void printAll(Graphics g) + { + // FIXME + } + + public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h) + { + // FIXME + return false; + } + + public Image createImage(ImageProducer producer) + { + // FIXME + return null; + } + + public Image createImage(int width, int height) + { + // FIXME + return null; + } + + public boolean prepareImage(Image image, ImageObserver observer) + { + // FIXME + return false; + } + + public boolean prepareImage(Image image, int width, int height, ImageObserver observer) + { + // FIXME + return false; + } - public boolean isFocusTraversable () - { /* FIXME */ return false; } + public int checkImage(Image image, ImageObserver observer) + { + // FIXME + return false; + } + + public int checkImage(Image image, int width, int height, ImageObserver observer) + { + // FIXME + return 0; + } + + public boolean contains(int x, int y) + { + return (x >= 0) && (y >= 0) && (x < width) && (y < height); + } + + /** @deprecated */ + public boolean inside(int x, int y) + { + return contains(x,y); + } + + public boolean contains(Point p) + { + return contains(p.x, p.y); + } + + public Component getComponentAt(int x, int y) + { + if (contains(x,y)) + return this; + return null; + } + + /** @deprecated */ + public Component locate(int x, int y) + { + return getComponentAt(x, y); + } + + public Component getComponentAt(Point p) + { + return getComponentAt(p.x, p.y); + } + + /** @deprecated */ + public void deliverEvent(Event e) + { + + } + + /** Forward AWT events to processEvent() if: + * - Events have been enabled for this type of event via enableEvents(), + * OR: + * - There is at least one registered listener for this type of event + * + * @specnote This method is final, but we need to be able to + * override it in order to handle other event types in our + * subclasses. The solution is to define a second, non-final + * method - dispatchEventImpl() - to actually do the work. + * Investigations with Thread.dumpStack() on the dispatch thread + * in JDK 1.3 show Sun's implementation is doing the same + * thing. + */ + public final void dispatchEvent(AWTEvent e) + { + dispatchEventImpl(e); + } + /* This code needs to be split up and put in to dispatchEventImpl() in the + appropriate Component subclasses: + + else if ((e.id <= WindowEvent.WINDOW_LAST + && e.id >= WindowEvent.WINDOW_FIRST) + && (windowListener != null + || eventMask & AWTEvent.WINDOW_EVENT_MASK != 0)) + processEvent(e); + else if ((e.id <= AdjustmentEvent.ADJUSTMENT_LAST + && e.id >= AdjustmentEvent.ADJUSTMENT_FIRST) + && (adjustmentListener != null + || eventMask & AWTEvent.ADJUSTMENT_EVENT_MASK != 0)) + processEvent(e); + else if ((e.id <= ItemEvent.ITEM_LAST + && e.id >= ItemEvent.ITEM_FIRST) + && (itemListener != null + || eventMask & AWTEvent.ITEM_EVENT_MASK != 0)) + processEvent(e); + else if ((e.id <= PaintEvent.PAINT_LAST + && e.id >= PaintEvent.PAINT_FIRST) + && (paintListener != null + || eventMask & AWTEvent.PAINT_EVENT_MASK != 0)) + processEvent(e); + else if ((e.id <= TextEvent.TEXT_LAST + && e.id >= TextEvent.TEXT_FIRST) + && (textListener != null + || eventMask & AWTEvent.TEXT_EVENT_MASK != 0)) + processEvent(e); + else if ((e.id <= InvocationEvent.INVOCATION_LAST + && e.id >= InvocationEvent.INVOCATION_FIRST) + && (invocationListener != null + || eventMask & AWTEvent.INVOCATION_EVENT_MASK != 0)) + processEvent(e); + } + */ + + void dispatchEventImpl(AWTEvent e) + { + // Make use of event id's in order to avoid multiple instanceof tests. + if (e.id <= ComponentEvent.COMPONENT_LAST + && e.id >= ComponentEvent.COMPONENT_FIRST + && (componentListener != null + || (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0)) + processEvent(e); + else if (e.id <= KeyEvent.KEY_LAST + && e.id >= KeyEvent.KEY_FIRST + && (keyListener != null + || (eventMask & AWTEvent.KEY_EVENT_MASK) != 0)) + processEvent(e); + else if (e.id <= MouseEvent.MOUSE_LAST + && e.id >= MouseEvent.MOUSE_FIRST + && (mouseListener != null + || mouseMotionListener != null + || (eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0)) + processEvent(e); + else if (e.id <= FocusEvent.FOCUS_LAST + && e.id >= FocusEvent.FOCUS_FIRST + && (focusListener != null + || (eventMask & AWTEvent.FOCUS_EVENT_MASK) != 0)) + processEvent(e); + else if (e.id <= InputMethodEvent.INPUT_METHOD_LAST + && e.id >= InputMethodEvent.INPUT_METHOD_FIRST + && (inputMethodListener != null + || (eventMask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0)) + processEvent(e); + else if (e.id <= HierarchyEvent.HIERARCHY_LAST + && e.id >= HierarchyEvent.HIERARCHY_FIRST + && (hierarchyListener != null + || hierarchyBoundsListener != null + || (eventMask & AWTEvent.HIERARCHY_EVENT_MASK) != 0)) + processEvent(e); + } + + /** @deprecated */ + public boolean postEvent(Event e) + { + return false; + } + + public synchronized void addComponentListener(ComponentListener l) + { + componentListener = AWTEventMulticaster.add(componentListener, l); + if (componentListener != null) + enableEvents(AWTEvent.COMPONENT_EVENT_MASK); + } + + public synchronized void removeComponentListener(ComponentListener l) + { + componentListener = AWTEventMulticaster.remove(componentListener, l); + } + + public synchronized void addFocusListener(FocusListener l) + { + focusListener = AWTEventMulticaster.add(focusListener, l); + if (focusListener != null) + enableEvents(AWTEvent.FOCUS_EVENT_MASK); + } + + public synchronized void removeFocusListener(FocusListener l) + { + focusListener = AWTEventMulticaster.remove(focusListener, l); + } + + /** @since 1.3 */ + public synchronized void addHierarchyListener(HierarchyListener l) + { + hierarchyListener = AWTEventMulticaster.add(hierarchyListener, l); + if (hierarchyListener != null) + enableEvents(AWTEvent.HIERARCHY_EVENT_MASK); + } + + /** @since 1.3 */ + public synchronized void removeHierarchyListener(HierarchyListener l) + { + hierarchyListener = AWTEventMulticaster.remove(hierarchyListener, l); + } + + /** @since 1.3 */ + public synchronized void addHierarchyBoundsListener(HierarchyBoundsListener l) + { + hierarchyBoundsListener = + AWTEventMulticaster.add(hierarchyBoundsListener, l); + if (hierarchyBoundsListener != null) + enableEvents(AWTEvent.HIERARCHY_EVENT_MASK); + } + + /** @since 1.3 */ + public synchronized void + removeHierarchyBoundsListener(HierarchyBoundsListener l) + { + hierarchyBoundsListener = + AWTEventMulticaster.remove(hierarchyBoundsListener, l); + } + + public synchronized void addKeyListener(KeyListener l) + { + keyListener = AWTEventMulticaster.add(keyListener, l); + if (keyListener != null) + enableEvents(AWTEvent.KEY_EVENT_MASK); + } + + public synchronized void removeKeyListener(KeyListener l) + { + keyListener = AWTEventMulticaster.remove(keyListener, l); + } - public void addNotify () { } + public synchronized void addMouseListener(MouseListener l) + { + mouseListener = AWTEventMulticaster.add(mouseListener, l); + if (mouseListener != null) + enableEvents(AWTEvent.MOUSE_EVENT_MASK); + } + + public synchronized void removeMouseListener(MouseListener l) + { + mouseListener = AWTEventMulticaster.remove(mouseListener, l); + } + + public synchronized void addMouseMotionListener(MouseMotionListener l) + { + mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, l); + if (mouseMotionListener != null) + enableEvents(AWTEvent.MOUSE_EVENT_MASK); + } + + public synchronized void removeMouseMotionListener(MouseMotionListener l) + { + mouseMotionListener = AWTEventMulticaster.remove(mouseMotionListener, l); + } + + /** @since 1.2 */ + public synchronized void addInputMethodListener(InputMethodListener l) + { + inputMethodListener = AWTEventMulticaster.add(inputMethodListener, l); + if (inputMethodListener != null) + enableEvents(AWTEvent.INPUT_METHOD_EVENT_MASK); + } + + /** @since 1.2 */ + public synchronized void removeInputMethodListener(InputMethodListener l) + { + inputMethodListener = AWTEventMulticaster.remove(inputMethodListener, l); + } + + /** Returns all registered EventListers of the given listenerType. + * listenerType must be a subclass of EventListener, or a + * ClassClassException is thrown. + * @since 1.3 + */ + public EventListener[] getListeners(Class listenerType) + { + if (listenerType == ComponentListener.class) + return getListenersImpl(listenerType, componentListener); + else if (listenerType == FocusListener.class) + return getListenersImpl(listenerType, focusListener); + else if (listenerType == KeyListener.class) + return getListenersImpl(listenerType, keyListener); + else if (listenerType == MouseListener.class) + return getListenersImpl(listenerType, mouseListener); + else if (listenerType == MouseMotionListener.class) + return getListenersImpl(listenerType, mouseMotionListener); + else if (listenerType == InputMethodListener.class) + return getListenersImpl(listenerType, inputMethodListener); + else if (listenerType == HierarchyListener.class) + return getListenersImpl(listenerType, hierarchyListener); + else if (listenerType == HierarchyBoundsListener.class) + return getListenersImpl(listenerType, hierarchyBoundsListener); + else + return getListenersImpl(listenerType, null); + } + + static EventListener[] getListenersImpl(Class listenerType, EventListener el) + { + if (! EventListener.class.isAssignableFrom(listenerType)) + throw new ClassCastException(); + + Vector v = new Vector(); + if (el != null) + getListenerList (el, v); + EventListener[] el_a = (EventListener[]) Array.newInstance(listenerType, + v.size()); + v.copyInto(el_a); + return el_a; + } + + static void getListenerList(EventListener el, Vector v) + { + if (el instanceof AWTEventMulticaster) + { + AWTEventMulticaster mc = (AWTEventMulticaster) el; + getListenerList(mc.a, v); + getListenerList(mc.b, v); + } + else + v.addElement(el); + } + + // The input method framework is currently unimplemented. + // /** @since 1.2 */ + // + //public InputMethodRequests getInputMethodRequests() + // + // /** @since 1.2 */ + // + // public InputContext getInputContext() + + protected final void enableEvents(long eventsToEnable) + { + eventMask |= eventsToEnable; + // TODO: Unlike Sun's implementation, I think we should try and + // enable/disable events at the peer (gtk/X) level. This will avoid + // clogging the event pipeline with useless mousemove events that + // we arn't interested in, etc. This will involve extending the peer + // interface, but thats okay because the peer interfaces have been + // deprecated for a long time, and no longer feature in the + // API specification at all. + } + + protected final void disableEvents(long eventsToDisable) + { + eventMask &= ~eventsToDisable; + // forward new event mask to peer? + } + + /** coalesceEvents is called by the EventQueue if two events with the same + * event id are queued. Returns a new combined event, or null if no + * combining is done. + */ + protected AWTEvent coalesceEvents(AWTEvent existingEvent, AWTEvent newEvent) + { + if (existingEvent instanceof MouseEvent + && (existingEvent.id == MouseEvent.MOUSE_DRAGGED + || existingEvent.id == MouseEvent.MOUSE_MOVED)) + { + // Just drop the old (intermediate) event and return the new one. + return newEvent; + } + /* + else if (existingEvent instanceof PaintEvent) + { + // The JDK 1.3 documentation says that in this case a complex + // RepaintArea is generated. We don't do that yet, and creating a + // union area as suggested by older documentation sounds ugly. + } + */ + + // FIXME + return null; + } + + /** Forward event to the appropriate processXXXEvent method based on the + * event type. + */ + protected void processEvent(AWTEvent e) + { + if (e instanceof ComponentEvent) + processComponentEvent((ComponentEvent) e); + else if (e instanceof FocusEvent) + processFocusEvent((FocusEvent) e); + else if (e instanceof KeyEvent) + processKeyEvent((KeyEvent) e); + else if (e instanceof MouseEvent) + { + if (e.id == MouseEvent.MOUSE_MOVED + || e.id == MouseEvent.MOUSE_DRAGGED) + processMouseMotionEvent((MouseEvent) e); + else + processMouseEvent((MouseEvent) e); + } + else if (e instanceof InputMethodEvent) + processInputMethodEvent((InputMethodEvent) e); + else if (e instanceof HierarchyEvent) + { + if (e.id == HierarchyEvent.HIERARCHY_CHANGED) + processHierarchyEvent((HierarchyEvent) e); + else + processHierarchyBoundsEvent((HierarchyEvent) e); + } + } + + protected void processComponentEvent(ComponentEvent e) + { + if (componentListener == null) + return; + switch (e.id) + { + case ComponentEvent.COMPONENT_HIDDEN: + componentListener.componentHidden(e); + break; + + case ComponentEvent.COMPONENT_MOVED: + componentListener.componentMoved(e); + break; + + case ComponentEvent.COMPONENT_RESIZED: + componentListener.componentResized(e); + break; + + case ComponentEvent.COMPONENT_SHOWN: + componentListener.componentShown(e); + break; + } + } + + protected void processFocusEvent(FocusEvent e) + { + if (focusListener == null) + return; + switch (e.id) + { + case FocusEvent.FOCUS_GAINED: + focusListener.focusGained(e); + break; + case FocusEvent.FOCUS_LOST: + focusListener.focusLost(e); + break; + } + } + + protected void processKeyEvent(KeyEvent e) + { + if (keyListener == null) + return; + switch (e.id) + { + case KeyEvent.KEY_PRESSED: + keyListener.keyPressed(e); + break; + case KeyEvent.KEY_RELEASED: + keyListener.keyReleased(e); + break; + case KeyEvent.KEY_TYPED: + keyListener.keyTyped(e); + break; + } + } + + protected void processMouseEvent(MouseEvent e) + { + if (mouseListener == null) + return; + switch (e.id) + { + case MouseEvent.MOUSE_CLICKED: + mouseListener.mousePressed(e); + break; + case MouseEvent.MOUSE_ENTERED: + mouseListener.mouseEntered(e); + break; + case MouseEvent.MOUSE_EXITED: + mouseListener.mouseExited(e); + break; + case MouseEvent.MOUSE_PRESSED: + mouseListener.mousePressed(e); + break; + case MouseEvent.MOUSE_RELEASED: + mouseListener.mouseReleased(e); + break; + } + } + + protected void processMouseMotionEvent(MouseEvent e) + { + if (mouseMotionListener == null) + return; + switch (e.id) + { + case MouseEvent.MOUSE_DRAGGED: + mouseMotionListener.mouseDragged(e); + break; + case MouseEvent.MOUSE_MOVED: + mouseMotionListener.mouseMoved(e); + break; + } + } + + /** @since 1.2 */ + protected void processInputMethodEvent(InputMethodEvent e) + { + if (inputMethodListener == null) + return; + switch (e.id) + { + case InputMethodEvent.CARET_POSITION_CHANGED: + inputMethodListener.caretPositionChanged(e); + break; + case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED: + inputMethodListener.inputMethodTextChanged(e); + break; + } + } + + /** @since 1.3 */ + protected void processHierarchyEvent(HierarchyEvent e) + { + if (hierarchyListener == null) + return; + if (e.id == HierarchyEvent.HIERARCHY_CHANGED) + hierarchyListener.hierarchyChanged(e); + } + + /** @since 1.3 */ + protected void processHierarchyBoundsEvent(HierarchyEvent e) + { + if (hierarchyBoundsListener == null) + return; + switch (e.id) + { + case HierarchyEvent.ANCESTOR_MOVED: + hierarchyBoundsListener.ancestorMoved(e); + break; + case HierarchyEvent.ANCESTOR_RESIZED: + hierarchyBoundsListener.ancestorResized(e); + break; + } + } + + /** @deprecated */ + public boolean handleEvent(Event evt) + { + return false; + } + + /** @deprecated */ + public boolean mouseDown(Event evt, int x, int y) + { + return false; + } + + /** @deprecated */ + public boolean mouseDrag(Event evt, int x, int y) + { + return false; + } + + /** @deprecated */ + public boolean mouseUp(Event evt, int x, int y) + { + return false; + } + + /** @deprecated */ + public boolean mouseMove(Event evt, int x, int y) + { + return false; + } + + /** @deprecated */ + public boolean mouseEnter(Event evt, int x, int y) + { + return false; + } + + /** @deprecated */ + public boolean mouseExit(Event evt, int x, int y) + { + return false; + } + + /** @deprecated */ + public boolean keyDown(Event evt, int key) + { + return false; + } + + /** @deprecated */ + public boolean keyUp(Event evt, int key) + { + return false; + } + + /** @deprecated */ + public boolean action(Event evt, Object what) + { + return false; + } + + public void addNotify() + { + // FIXME + } + + public void removeNotify() + { + // FIXME + } + + /** @deprecated */ + public boolean gotFocus(Event evt, Object what) + { + return false; + } + + /** @deprecated */ + public boolean lostFocus(Event evt, Object what) + { + return false; + } + + public boolean isFocusTraversable() + { + // FIXME + return false; + } + + public void requestFocus() + { + // FIXME + } + + public void transferFocus() + { + // FIXME + } + + /** @deprecated */ + public void nextFocus() + { + transferFocus(); + } + + /** @since 1.2 */ + public boolean hasFocus() + { + // FIXME + return false; + } + + public synchronized void add(PopupMenu popup) + { + if (popups == null) + popups = new Vector(); + popups.addElement(popup); + } + + public synchronized void remove(MenuComponent popup) + { + popups.removeElement(popup); + } + + protected String paramString() + { + // FIXME + return "FIXME"; + } + + public String toString() + { + return paramString(); + } + + public void list() + { + } + + public void list(PrintStream out) + { + } + + public void list(PrintStream out, int indent) + { + } + + public void list(PrintWriter out) + { + } + + public void list(PrintWriter out, int indent) + { + } + + public void addPropertyChangeListener(PropertyChangeListener listener) + { + + } + + public void removePropertyChangeListener(PropertyChangeListener listener) + { + } + + public void addPropertyChangeListener(String propertyName, + PropertyChangeListener listener) + { + } + + public void removePropertyChangeListener(String propertyName, + PropertyChangeListener listener) + { + } + + protected void firePropertyChange(String propertyName, Object oldValue, + Object newValue) + { + } + + public void setComponentOrientation(ComponentOrientation o) + { + // FIXME + } + + public ComponentOrientation getComponentOrientation() + { + // FIXME + return null; + } + + /* + public AccessibleContext getAccessibleContext() + { + return accessibleContext; + } + */ } diff --git a/libjava/java/awt/ComponentOrientation.java b/libjava/java/awt/ComponentOrientation.java new file mode 100644 index 0000000..739db00 --- /dev/null +++ b/libjava/java/awt/ComponentOrientation.java @@ -0,0 +1,84 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +/* Status: Incomplete. Needs a Locale lookup table. */ + +package java.awt; + +import java.util.Locale; +import java.util.ResourceBundle; + +public class ComponentOrientation implements java.io.Serializable +{ + public static final ComponentOrientation LEFT_TO_RIGHT + = new ComponentOrientation(HORIZONTAL_ID & LEFT_TO_RIGHT_ID); + public static final ComponentOrientation RIGHT_TO_LEFT + = new ComponentOrientation(HORIZONTAL_ID); + public static final ComponentOrientation UNKNOWN + = new ComponentOrientation(0); + + // FIXME: This field is from the serialization spec, but what are the + // correct values? + int orientation; + + // Here is a wild guess. + private static int HORIZONTAL_ID = 1 << 0, + LEFT_TO_RIGHT_ID = 1 << 1; + + ComponentOrientation(int orientation) + { + this.orientation = orientation; + } + + public boolean isHorizontal() + { + return ((orientation & HORIZONTAL_ID) != 0); + } + + public boolean isLeftToRight() + { + return ((orientation & LEFT_TO_RIGHT_ID) != 0); + } + + public static ComponentOrientation getOrientation(Locale locale) + { + // FIXME: Use a table to look this up. + return LEFT_TO_RIGHT; + } + + public static ComponentOrientation getOrientation(ResourceBundle bdl) + { + ComponentOrientation r; + + try + { + Object obj = bdl.getObject("Orientation"); + r = (ComponentOrientation) obj; + if (r != null) + return r; + } + catch (Exception x) + { + // Fall through + } + + try + { + Locale l = bdl.getLocale(); + r = getOrientation(l); + if (r != null) + return r; + } + catch (Exception x) + { + // Fall through + } + + return (getOrientation (Locale.getDefault ())); + } +} diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java index 6befa79..8484024 100644 --- a/libjava/java/awt/Container.java +++ b/libjava/java/awt/Container.java @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 1999, 2000 Free Software Foundation This file is part of libjava. @@ -8,26 +8,320 @@ details. */ package java.awt; +import java.awt.event.*; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.util.EventListener; + /* A very incomplete placeholder. */ public abstract class Container extends Component { - int componentCount; - Component[] components; + /* Serialized fields from the serialization spec. */ + int ncomponents; + Component[] component; + LayoutManager layoutMgr; + /* LightweightDispatcher dispatcher; */ // wtf? + Dimension maxSize; + int containerSerializedDataVersion; - public Component[] getComponents() + /* Anything else is non-serializable, and should be declared "transient". */ + transient ContainerListener containerListener; + + public Container() { - Component[] result = new Component[componentCount]; - if (componentCount > 0) - System.arraycopy(components, 0, result, 0, componentCount); - return result; + } + + public int getComponentCount() + { + return ncomponents; + } + + /** @deprecated Use getComponentCount() instead. */ + public int countComponents() + { + return ncomponents; } public Component getComponent (int n) { - if (n < 0 || n >= componentCount) + if (n < 0 || n >= ncomponents) throw new ArrayIndexOutOfBoundsException("no such component"); - return components[n]; + return component[n]; + } + + public Component[] getComponents() + { + Component[] result = new Component[ncomponents]; + if (ncomponents > 0) + System.arraycopy(component, 0, result, 0, ncomponents); + return result; + } + + public Insets getInsets() + { + // FIXME + return null; + } + + /** @deprecated Use getInsets() instead. */ + public Insets insets() + { + return getInsets(); + } + + public Component add(Component comp) + { + // FIXME + return null; + } + + public Component add(String name, Component comp) + { + // FIXME + return null; + } + + public Component add(Component comp, int index) + { + // FIXME + return null; + } + + public void add(Component comp, Object constraints) + { + // FIXME + } + + public void add(Component comp, Object constraints, int index) + { + // FIXME + } + + protected void addImpl(Component comp, Object constraints, int index) + { + // FIXME + } + + public void remove(int index) + { + // FIXME + } + + public void remove(Component comp) + { + // FIXME + } + + public void removeAll() + { + // FIXME + } + + public LayoutManager getLayout() + { + return layoutMgr; + } + + public void setLayout(LayoutManager mgr) + { + layoutMgr = mgr; + // FIXME + } + + public void doLayout() + { + // FIXME + } + + /** @deprecated Use doLayout() instead. */ + public void layout() + { + doLayout(); + } + + public void invalidate() + { + // FIXME + } + + public void validate() + { + // FIXME + } + + protected void validateTree() + { + // FIXME + } + + public void setFont(Font f) + { + // FIXME + } + + public Dimension getPreferredSize() + { + // FIXME + return null; + } + + /** @deprecated Use getPreferredSize() instead */ + public Dimension preferredSize() + { + return getPreferredSize(); + } + + public Dimension getMinimumSize() + { + // FIXME + return null; + } + + /** @deprecated Use getMinimumSize() instead */ + public Dimension minimumSize() + { + return getMinimumSize(); + } + + public Dimension getMaximumSize() + { + // FIXME + return null; + } + + public float getAlignmentX() + { + // FIXME + return 0; + } + + public float getAlignmentY() + { + // FIXME + return 0; + } + + public void paint(Graphics g) + { + // FIXME + } + + public void update(Graphics g) + { + // FIXME + } + + public void print(Graphics g) + { + // FIXME + } + + public void paintComponents(Graphics g) + { + // FIXME + } + + public void printComponents(Graphics g) + { + // FIXME + } + + void dispatchEventImpl(AWTEvent e) + { + if ((e.id <= ContainerEvent.CONTAINER_LAST + && e.id >= ContainerEvent.CONTAINER_FIRST) + && (containerListener != null + || (eventMask & AWTEvent.CONTAINER_EVENT_MASK) != 0)) + processEvent(e); + else super.dispatchEventImpl(e); + } + + public void addContainerListener(ContainerListener l) + { + containerListener = (ContainerListener) + AWTEventMulticaster.add(containerListener, l); + } + + public void removeContainerListener(ContainerListener l) + { + containerListener = (ContainerListener) + AWTEventMulticaster.remove(containerListener, l); + } + + /** @since 1.3 */ + public EventListener[] getListeners(Class listenerType) + { + if (listenerType == ContainerListener.class) + return getListenersImpl(listenerType, containerListener); + else return super.getListeners(listenerType); + } + + protected void processEvent(AWTEvent e) + { + if (e instanceof ContainerEvent) + processContainerEvent((ContainerEvent) e); + else super.processEvent(e); + } + + protected void processContainerEvent(ContainerEvent e) + { + if (componentListener == null) + return; + switch (e.id) + { + case ContainerEvent.COMPONENT_ADDED: + containerListener.componentAdded(e); + break; + + case ContainerEvent.COMPONENT_REMOVED: + containerListener.componentRemoved(e); + break; + } + } + + /** @deprecated */ + public void deliverEvent(Event e) + { + } + + public Component getComponentAt(int x, int y) + { + // FIXME + return null; + } + + /** @deprecated Use getComponentAt() instead */ + public Component locate(int x, int y) + { + return getComponentAt(x, y); + } + + public Component getComponentAt(Point p) + { + return getComponentAt(p.x, p.y); + } + + public Component findComponentAt(int x, int y) + { + // FIXME + return null; + } + + public Component findComponentAt(Point p) + { + return findComponentAt(p.x, p.y); + } + + public void addNotify () + { + for (int i = ncomponents; --i >= 0; ) + component[i].addNotify(); + } + + public void removeNotify() + { + // FIXME } public boolean isAncestorOf (Component comp) @@ -42,18 +336,18 @@ public abstract class Container extends Component } } - public Component add (String name, Component comp) + protected String paramString() { - /* FIXME */ - return comp; + return "FIXME"; } - - public void addNotify () + + public void list(PrintStream out, int indent) { - for (int i = componentCount; --i >= 0; ) - components[i].addNotify(); + // FIXME + } + + public void list(PrintWriter out, int indent) + { + // FIXME } - - public void setLayout (LayoutManager layout) - { /* FIXME */ } } diff --git a/libjava/java/awt/Cursor.java b/libjava/java/awt/Cursor.java new file mode 100644 index 0000000..96d36e7 --- /dev/null +++ b/libjava/java/awt/Cursor.java @@ -0,0 +1,87 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt; + +/* A somewhat incomplete placeholder. */ + +public class Cursor +{ + public static final int DEFAULT_CURSOR = 0, + CROSSHAIR_CURSOR = 1, + TEXT_CURSOR = 2, + WAIT_CURSOR = 3, + SW_RESIZE_CURSOR = 4, + SE_RESIZE_CURSOR = 5, + NW_RESIZE_CURSOR = 6, + NE_RESIZE_CURSOR = 7, + N_RESIZE_CURSOR = 8, + S_RESIZE_CURSOR = 9, + W_RESIZE_CURSOR = 10, + E_RESIZE_CURSOR = 11, + HAND_CURSOR = 12, + MOVE_CURSOR = 13, + CUSTOM_CURSOR = 0xFFFFFFFF; + + private static final int PREDEFINED_COUNT = 14; + + protected static Cursor[] predefined = new Cursor[PREDEFINED_COUNT]; + protected String name; + int type; + + public Cursor(int type) + { + this.type = type; + // FIXME: lookup and set name? + } + + /** This constructor is used internally only. + * Application code should call Toolkit.createCustomCursor(). + */ + protected Cursor(String name) + { + this.name = name; + // FIXME + } + + public static Cursor getPredefinedCursor(int type) + { + if (type >= PREDEFINED_COUNT) + return null; + if (predefined[type] == null) + predefined[type] = new Cursor(type); + return predefined[type]; + } + + public static Cursor getSystemCustomCursor(String name) + throws AWTException + { + // FIXME + return null; + } + + public static Cursor getDefaultCursor() + { + return getPredefinedCursor(0); + } + + public int getType() + { + return type; + } + + public String getName() + { + return name; + } + + public String toString() + { + return (this.getClass() + "[" + getName() + "]"); + } +} diff --git a/libjava/java/awt/Event.java b/libjava/java/awt/Event.java index 241e68e..f1f81c1 100644 --- a/libjava/java/awt/Event.java +++ b/libjava/java/awt/Event.java @@ -11,8 +11,7 @@ package java.awt; /** * Written using on-line Java Platform 1.2 API Specification, as well * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). - * Status: Believed complete and correct, except for the paramString() - * method, which is stubbed. + * Status: Believed complete and correct. */ public class Event @@ -132,7 +131,7 @@ public class Event protected String paramString () { - return "Event.paramString() not implemented"; + return "id=" + id + ",x=" + x + ",y=" + y + "target=" + target; } public boolean shiftDown() @@ -142,9 +141,7 @@ public class Event public String toString() { - String r = getClass() + "[id=" + id + ",x=" + x + ",y=" + y + "target=" - + ((target == null) ? "null" : target) + "]"; - return r; + return getClass().getName() + "[" + paramString() + "]"; } public void translate (int x, int y) diff --git a/libjava/java/awt/EventDispatchThread.java b/libjava/java/awt/EventDispatchThread.java new file mode 100644 index 0000000..cf2e7a6 --- /dev/null +++ b/libjava/java/awt/EventDispatchThread.java @@ -0,0 +1,45 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +/** @author Bryce McKinlay */ + +/* Status: believed complete, but untested. */ + +package java.awt; + +class EventDispatchThread extends Thread +{ + private static int dispatchThreadNum = 1; + + private EventQueue queue; + + EventDispatchThread(EventQueue queue) + { + super(); + setName("AWT-EventQueue-" + dispatchThreadNum++); + this.queue = queue; + setPriority(NORM_PRIORITY + 1); + } + + public void run() + { + while (true) + { + try + { + AWTEvent evt = queue.getNextEvent(); + queue.dispatchEvent(evt); + } + catch (Throwable x) + { + System.err.println("Exception during event dispatch:"); + x.printStackTrace(System.err); + } + } + } +} diff --git a/libjava/java/awt/EventQueue.java b/libjava/java/awt/EventQueue.java new file mode 100644 index 0000000..0a60d69 --- /dev/null +++ b/libjava/java/awt/EventQueue.java @@ -0,0 +1,259 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt; + +import java.awt.event.*; +import java.util.EmptyStackException; +import java.lang.reflect.InvocationTargetException; + +/* Written using on-line Java 2 Platform Standard Edition v1.3 API + * Specification, as well as "The Java Class Libraries", 2nd edition + * (Addison-Wesley, 1998). + * Status: Believed complete, but untested. Check FIXME's. + */ + +/** @author Bryce McKinlay */ + +public class EventQueue +{ + private static final int INITIAL_QUEUE_DEPTH = 8; + private AWTEvent[] queue = new AWTEvent[INITIAL_QUEUE_DEPTH]; + + private int next_in = 0; // Index where next event will be added to queue + private int next_out = 0; // Index of next event to be removed from queue + + private EventQueue next; + private EventQueue prev; + + private EventDispatchThread dispatchThread = new EventDispatchThread(this); + + public EventQueue() + { + } + + public synchronized AWTEvent getNextEvent() + throws InterruptedException + { + if (next != null) + return next.getNextEvent(); + + while (next_in == next_out) + wait(); + + AWTEvent res = queue[next_out]; + + if (++next_out == queue.length) + next_out = 0; + return res; + } + + /** @specnote Does not block. Returns null if there are no events on the + * queue. + */ + public synchronized AWTEvent peekEvent() + { + if (next != null) + return next.peekEvent(); + + if (next_in != next_out) + return queue[next_out]; + else return null; + } + + /** @specnote Does not block. Returns null if there are no matching events + * on the queue. + */ + public synchronized AWTEvent peekEvent(int id) + { + if (next != null) + return next.peekEvent(id); + + int i = next_out; + while (i != next_in) + { + AWTEvent qevt = queue[i]; + if (qevt.id == id) + return qevt; + } + return null; + } + + public synchronized void postEvent(AWTEvent evt) + { + if (next != null) + { + next.postEvent(evt); + return; + } + // FIXME: Security checks? + + /* Check for any events already on the queue with the same source + and ID. */ + int i = next_out; + while (i != next_in) + { + AWTEvent qevt = queue[i]; + Object src; + if (qevt.id == evt.id + && (src = qevt.getSource()) == evt.getSource() + && src instanceof Component) + { + /* If there are, call coalesceEvents on the source component + to see if they can be combined. */ + Component srccmp = (Component) src; + AWTEvent coalesced_evt = srccmp.coalesceEvents(qevt, evt); + if (coalesced_evt != null) + { + /* Yes. Replace the existing event with the combined event. */ + queue[i] = coalesced_evt; + return; + } + break; + } + if (++i == queue.length) + i = 0; + } + + queue[next_in] = evt; + if (++next_in == queue.length) + next_in = 0; + + if (next_in == next_out) + { + /* Queue is full. Extend it. */ + AWTEvent[] oldQueue = queue; + queue = new AWTEvent[queue.length * 2]; + + int len = oldQueue.length - next_out; + System.arraycopy(oldQueue, next_out, queue, 0, len); + if (next_out != 0) + System.arraycopy(oldQueue, 0, queue, len, next_out); + + next_out = 0; + next_in = oldQueue.length; + } + notify(); + } + + /** @since JDK1.2 */ + public static void invokeAndWait(Runnable runnable) + throws InterruptedException, InvocationTargetException + { + // FIXME: Is this an appropriate way to access the event queue? + EventQueue eq = Toolkit.systemEventQueue; + Thread current = Thread.currentThread(); + if (current == eq.dispatchThread) + throw new Error("Can't call invokeAndWait from event dispatch thread"); + + InvocationEvent ie = + new InvocationEvent(eq, runnable, current, true); + + eq.postEvent(ie); + + synchronized (current) + { + current.wait(); + } + + Exception exception; + + if ((exception = ie.getException()) != null) + throw new InvocationTargetException(exception); + } + + /** @since JDK1.2 */ + static void invokeLater(Runnable runnable) + { + // FIXME: Is this an appropriate way to access the event queue? + EventQueue eq = Toolkit.systemEventQueue; + + InvocationEvent ie = + new InvocationEvent(eq, runnable, null, false); + + eq.postEvent(ie); + } + + static boolean isDispatchThread() + { + // FIXME: Is this an appropriate way to access the event queue? + EventQueue eq = Toolkit.systemEventQueue; + return (Thread.currentThread() == eq.dispatchThread); + } + + /** Allows a custom EventQueue implementation to replace this one. + * All pending events are transferred to the new queue. Calls to postEvent, + * getNextEvent, and peekEvent are forwarded to the pushed queue until it + * is removed with a pop(). + */ + public synchronized void push(EventQueue newEventQueue) + { + int i = next_out; + while (i != next_in) + { + newEventQueue.postEvent(queue[i]); + next_out = i; + if (++i == queue.length) + i = 0; + } + + next = newEventQueue; + newEventQueue.prev = this; + } + + /** Transfer any pending events from this queue back to the parent queue that + * was previously push()ed. Event dispatch from this queue is suspended. */ + protected void pop() throws EmptyStackException + { + if (prev == null) + throw new EmptyStackException(); + + // Don't synchronize both this and prev at the same time, or deadlock could + // occur. + synchronized (prev) + { + prev.next = null; + } + + synchronized (this) + { + int i = next_out; + while (i != next_in) + { + prev.postEvent(queue[i]); + next_out = i; + if (++i == queue.length) + i = 0; + } + } + } + + protected void dispatchEvent(AWTEvent evt) + { + if (evt instanceof ActiveEvent) + { + ActiveEvent active_evt = (ActiveEvent) evt; + active_evt.dispatch(); + } + else + { + Object source = evt.getSource(); + + if (source instanceof Component) + { + Component srccmp = (Component) source; + srccmp.dispatchEvent(evt); + } + else if (source instanceof MenuComponent) + { + MenuComponent srccmp = (MenuComponent) source; + srccmp.dispatchEvent(evt); + } + } + } +} diff --git a/libjava/java/awt/Font.java b/libjava/java/awt/Font.java index 9d25342..833b3c8 100644 --- a/libjava/java/awt/Font.java +++ b/libjava/java/awt/Font.java @@ -8,6 +8,8 @@ details. */ package java.awt; +import java.util.Locale; + /** * @author Warren Levy * @date March 16, 2000. @@ -71,6 +73,18 @@ public class Font return name; } + public String getFamily() + { + // FIXME + return null; + } + + public String getFamily(Locale l) + { + // FIXME + return null; + } + public int getStyle() { return style; @@ -87,4 +101,20 @@ public class Font } public static Font decode(String str) { return null; } // FIXME + + public String toString() + { + String style_str = ""; + if (isPlain()) + style_str = "plain"; + else + { + if (isBold()) + style_str += "bold"; + if (isItalic()) + style_str += "italic"; + } + return getClass().getName() + "[family=" + getFamily() + ",name=" + + getName() + ",style=" + style_str + ",size=" + getSize() + "]"; + } } diff --git a/libjava/java/awt/FontMetrics.java b/libjava/java/awt/FontMetrics.java new file mode 100644 index 0000000..560481d --- /dev/null +++ b/libjava/java/awt/FontMetrics.java @@ -0,0 +1,153 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt; + +/** + * Status: Stubbed; A very incomplete implementation. + */ + +public class FontMetrics implements java.io.Serializable +{ + protected Font font; + + protected FontMetrics(Font font) + { + this.font = font; + } + + public Font getFont() + { + return font; + } + + public int getLeading() + { + // FIXME?? + return getHeight() - (getDescent() + getAscent()); + } + + public int getAscent() + { + // FIXME?? + return getHeight() - (getDescent() + getLeading()); + } + + public int getDescent() + { + // FIXME?? + return getHeight() - getDescent(); + } + + public int getHeight() + { + // FIXME?? + return getLeading() + getAscent() + getDescent(); + } + + public int getMaxAscent() + { + // FIXME + return 0; + } + + public int getMaxDescent() + { + // FIXME + return 0; + } + + /* @deprecated Use getMaxDescent() instead. */ + public int getMaxDecent() + { + return getMaxDescent(); + } + + public int getMaxAdvance() + { + // FIXME + return 0; + } + + public int charWidth(int ch) + { + // FIXME + return 0; + } + + public int charWidth(char ch) + { + // FIXME + return 0; + } + + public int stringWidth(String str) + { + return charsWidth(str.toCharArray(), 0, str.length()); + } + + public int charsWidth(char[] data, int off, int len) + { + // FIXME + return -1; + } + + public int bytesWidth(byte[] data, int off, int len) + { + // FIXME? + return -1; + } + + public int[] getWidths() + { + // FIXME + return new int[0]; + } + + public boolean hasUniformLineMetrics() + { + // FIXME + return false; + } + + // Don't have LineMetrics yet... + /* + public LineMetrics getLineMetrics(String str, Graphics context) + + public LineMetrics getLineMetrics(String str, int beginIndex, int limit, + Graphics context) + + public LineMetrics getLineMetrics(char[] chars, int beginIndex, int limit, + Graphics context) + + public LineMetrics getLineMetrics(CharacterIterator ci, int beginIndex, + int limit, Graphics context) + */ + + // Don't have Java2D yet. + /* + public Rectangle2D getStringBounds(String str, Graphics context) + + public Rectangle2D getStringBounds(String str, int beginIndex, int limit, + Graphics context) + + public Rectangle2D getStringBounds(char[] chars, int beginIndex, int limit, + Graphics context) + + public Rectangle2D getStringBounds(CharacterIterator ci, int beginIndex, + int limit, Graphics context) + + public Rectangle2D getMaxCharBounds(Graphics context) + */ + + public String toString() + { + return this.getClass() + "[font=" + font + ",ascent=" + getAscent() + + ",descent=" + getDescent() + ",height=" + getHeight() + "]"; + } +} diff --git a/libjava/java/awt/GraphicsConfiguration.java b/libjava/java/awt/GraphicsConfiguration.java new file mode 100644 index 0000000..cd37a0b --- /dev/null +++ b/libjava/java/awt/GraphicsConfiguration.java @@ -0,0 +1,28 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +/* Status: Complete, but commented out until we have the required Java2D + classes. */ + +package java.awt; + +public abstract class GraphicsConfiguration +{ + /* + public abstract GraphicsDevice getDevice(); + public abstract BufferedImage createCompatibleImage(int width, int height); + public abstract BufferedImage createCompatibleImage(int width, int height, + int transparency); + public abstract ColorModel getColorModel(); + public abstract ColorModel getColorModel(int transparency); + public abstract AffineTransform getDefaultTransform(); + public abstract AffineTransform getNormalizingTransform(); + */ + /* @since 1.3 */ + public abstract Rectangle getBounds(); +} diff --git a/libjava/java/awt/Insets.java b/libjava/java/awt/Insets.java new file mode 100644 index 0000000..c28353e --- /dev/null +++ b/libjava/java/awt/Insets.java @@ -0,0 +1,56 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt; + +public class Insets implements Cloneable, java.io.Serializable +{ + public int top; + public int left; + public int bottom; + public int right; + + public Insets(int top, int left, int bottom, int right) + { + this.top = top; + this.left = left; + this.bottom = bottom; + this.right = right; + } + + public boolean equals(Object obj) + { + if (obj instanceof Insets) + { + Insets i = (Insets) obj; + return (i.top == top + && i.left == left + && i.bottom == bottom + && i.right == right); + } + return false; + } + + public int hashCode() + { + // FIXME: what is the correct algorithm for this? + return (top * (2 * left) * (3 * right) * (4 * bottom)); + } + + public String toString() + { + return (getClass() + "[top=" + top + ",left=" + left + ",bottom=" + + bottom + ",right=" + right + "]"); + } + + public Object clone() + { + Insets r = new Insets(top, left, bottom, right); + return r; + } +} diff --git a/libjava/java/awt/Menu.java b/libjava/java/awt/Menu.java index af1c4c8..34dd600 100644 --- a/libjava/java/awt/Menu.java +++ b/libjava/java/awt/Menu.java @@ -8,26 +8,128 @@ details. */ package java.awt; -/* A very incomplete placeholder. */ +import java.util.Vector; + +/* Status: Incomplete. */ public class Menu extends MenuItem implements MenuContainer { - public Menu (String label) + // Fields from the serialization spec. Decalare others "transient". + Vector items = new Vector(); + boolean tearOff; + boolean isHelpMenu; + int menuSerializedDataVersion; + + static final MenuItem separator = new MenuItem("-"); + + public Menu() + { + this(null, false); + } + + public Menu(String label) { - super(label); // ??? - throw new Error ("java.awt.Menu: not implemented"); + this(label, false); + } + + public Menu(String label, boolean tearOff) + { + super(label); + this.tearOff = tearOff; } - public void add (String label) - { /* FIXME */ } + public void addNotify() + { + // FIXME + } + + public void removeNotify() + { + // FIXME + } - public synchronized MenuItem add (MenuItem item) + public boolean isTearOff() { - /* FIXME */ - return item; + return tearOff; } - public Font getFont() { return null; } // FIXME - public boolean postEvent(Event evt) { return false; } // FIXME - public void remove(MenuComponent comp) { } // FIXME + public int getItemCount() + { + return items.size(); + } + + /** @deprecated Use getItemCount() instead. */ + public int countItems() + { + return getItemCount(); + } + + public MenuItem getItem(int index) + { + return (MenuItem) items.elementAt(index); + } + + public synchronized MenuItem add(MenuItem mi) + { + items.addElement(mi); + if (mi.parent != null) + { + mi.parent.remove(mi); + } + mi.parent = this; + return mi; + } + + public void add(String label) + { + MenuItem mi = new MenuItem(label); + this.add(mi); + } + + public synchronized void insert(MenuItem menuitem, int index) + { + if (index < 0) + throw new IllegalArgumentException(); + items.insertElementAt(menuitem, index); + } + + public void insert(String label, int index) + { + MenuItem mi = new MenuItem(label); + this.insert(mi, index); + } + + public void addSeparator() + { + this.add(separator); + } + + public void insertSeparator(int index) + { + this.insert(separator, index); + } + + public synchronized void remove(int index) + { + items.removeElementAt(index); + } + + public synchronized void remove(MenuComponent item) + { + items.removeElement(item); + } + + public synchronized void removeAll() + { + items.removeAllElements(); + } + + public String paramString() + { + return getName() + ",label" + label + ",tearOff=" + tearOff + + ",isHelpMenu=" + isHelpMenu; + } + + // Accessibility API not yet implemented. + // public AccessibleContext getAccessibleContext() } diff --git a/libjava/java/awt/MenuComponent.java b/libjava/java/awt/MenuComponent.java index e18314d..5c0ea69 100644 --- a/libjava/java/awt/MenuComponent.java +++ b/libjava/java/awt/MenuComponent.java @@ -1,15 +1,118 @@ -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 1999, 2000 Free Software Foundation - This file is part of libjava. + This file is part of libgcj. This software is copyrighted work licensed under the terms of the -Libjava License. Please consult the file "LIBJAVA_LICENSE" for +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details. */ package java.awt; -/* A very incomplete placeholder. */ +/* Status: partially complete, untested. */ public abstract class MenuComponent { + // Fields from the serialization spec. Decalare others "transient". + Font font; + String name; + boolean nameExplicitlySet; + boolean newEventsOnly; + //AccessibleContext accessibleContext; + + transient MenuContainer parent; + transient java.awt.peer.MenuComponentPeer peer; + + public MenuComponent() + { + } + + public String getName() + { + if (name == null && !nameExplicitlySet) + name = generateName(); + return name; + } + + /** Subclasses should override this to generate unique names like + * "menuitem0". + */ + String generateName() + { + // MenuComponent is abstract. + return null; + } + + public void setName(String name) + { + nameExplicitlySet = true; + this.name = name; + } + + public MenuContainer getParent() + { + return parent; + } + + /** @deprecated Don't use this. */ + public java.awt.peer.MenuComponentPeer getPeer() + { + return peer; + } + + public Font getFont() + { + return font; + } + + public void setFont(Font f) + { + this.font = f; + } + + public void removeNotify() + { + // FIXME + } + + /** @deprecated Replaced by dispatchEvent(AWTEvent) */ + public boolean postEvent(Event evt) + { + return false; + } + + public final void dispatchEvent(AWTEvent e) + { + // FIXME + dispatchEventImpl(e); + } + + void dispatchEventImpl(AWTEvent e) + { + // This is overridden by subclasses that support events. + } + + protected void processEvent(AWTEvent e) + { + // Nothing to do here? This is be overridden by subclasses that + // support events. + } + + protected String paramString() + { + return name; + } + + public String toString() + { + return this.getClass().getName() + "[" + paramString() + "]"; + } + + protected final Object getTreeLock() + { + // FIXME: figure out how the tree lock works. + return null; + } + + // Accessibility API not yet implemented. + // public AccessibleContext getAccessibleContext() } diff --git a/libjava/java/awt/MenuItem.java b/libjava/java/awt/MenuItem.java index 2681a20..d766d42 100644 --- a/libjava/java/awt/MenuItem.java +++ b/libjava/java/awt/MenuItem.java @@ -1,25 +1,159 @@ -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 1999, 2000 Free Software Foundation - This file is part of libjava. + This file is part of libgcj. This software is copyrighted work licensed under the terms of the -Libjava License. Please consult the file "LIBJAVA_LICENSE" for +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details. */ package java.awt; import java.awt.event.*; +import java.util.EventListener; /* A very incomplete placeholder. */ public class MenuItem extends MenuComponent { + // Fields from the serialization spec. Decalare others "transient". + boolean enabled; + String label; + String actionCommand; + long eventMask; + MenuShortcut shortcut; + int menuItemSerializedDataVersion; + + transient ActionListener actionListener; + public MenuItem (String label) { - throw new Error("java.awt.MenuItem: not implemented"); + this.label = label; + } + + public String getLabel() + { + return label; + } + + public synchronized void setLabel(String label) + { + this.label = label; + } + + public boolean isEnabled() + { + return enabled; + } + + public synchronized void setEnabled(boolean b) + { + this.enabled = b; + } + + /** @deprecated Use setEnabled() instead. */ + public void enable() + { + setEnabled(true); + } + + /** @deprecated Use setEnabled() instead. */ + public void enable(boolean b) + { + setEnabled(b); + } + + /** @deprecated Use setEnabled() instead. */ + public void disable() + { + setEnabled(false); + } + + public MenuShortcut getShortcut() + { + return shortcut; + } + + public void setShortcut(MenuShortcut s) + { + this.shortcut = s; + } + + public void deleteShortcut() + { + setShortcut(null); } - public synchronized void addActionListener (ActionListener listener) + protected final void enableEvents(long eventsToEnable) { - /* FIXME */ + eventMask |= eventsToEnable; + // TODO: see comment in Component.enableEvents(). } + + protected final void disableEvents(long eventsToDisable) + { + eventMask &= ~eventsToDisable; + } + + public void setActionCommand(String command) + { + this.actionCommand = command; + } + + public String getActionCommand() + { + return actionCommand; + } + + public synchronized void addActionListener(ActionListener l) + { + actionListener = AWTEventMulticaster.add(actionListener, l); + if (actionListener != null) + enableEvents(AWTEvent.ACTION_EVENT_MASK); + } + + public synchronized void removeActionListener(ActionListener l) + { + actionListener = AWTEventMulticaster.remove(actionListener, l); + } + + /** Returns all registered EventListers of the given listenerType. + * listenerType must be a subclass of EventListener, or a + * ClassClassException is thrown. + * @since 1.3 + */ + public EventListener[] getListeners(Class listenerType) + { + if (listenerType == ActionListener.class) + return Component.getListenersImpl(listenerType, actionListener); + else + return Component.getListenersImpl(listenerType, null); + } + + void dispatchEventImpl(AWTEvent e) + { + if (e.id <= ActionEvent.ACTION_LAST + && e.id >= ActionEvent.ACTION_FIRST + && (actionListener != null + || (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0)) + processEvent(e); + } + + protected void processEvent(AWTEvent e) + { + if (e instanceof ActionEvent) + processActionEvent((ActionEvent) e); + } + + protected void processActionEvent(ActionEvent e) + { + if (actionListener != null) + actionListener.actionPerformed(e); + } + + public String paramString() + { + return name + ",label=" + label; + } + + // Accessibility API not yet implemented. + // public AccessibleContext getAccessibleContext() } diff --git a/libjava/java/awt/MenuShortcut.java b/libjava/java/awt/MenuShortcut.java new file mode 100644 index 0000000..b198926 --- /dev/null +++ b/libjava/java/awt/MenuShortcut.java @@ -0,0 +1,75 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt; + +import java.awt.event.KeyEvent; + +/* Status: Complete, except for hashCode(). Untested. */ + +public class MenuShortcut +{ + // Fields from the serialization spec. Decalare others "transient". + int key; + boolean usesShift; + + public MenuShortcut(int key) + { + this.key = key; + } + + public MenuShortcut(int key, boolean useShiftModifier) + { + this.key = key; + this.usesShift = useShiftModifier; + } + + public int getKey() + { + return key; + } + + public boolean usesShiftModifier() + { + return usesShift; + } + + public boolean equals(MenuShortcut ms) + { + return (ms.key == key && ms.usesShift == usesShift); + } + + public boolean equals(Object obj) + { + if (obj instanceof MenuShortcut) + { + MenuShortcut ms = (MenuShortcut) obj; + return (ms.key == key && ms.usesShift == usesShift); + } + return false; + } + + public int hashCode() + { + // FIXME: find/implement the correct algorithm for this + if (usesShift) + return (2 * key); + else + return key; + } + + public String toString() + { + return paramString(); // ? + } + + protected String paramString() + { + return KeyEvent.getKeyText(key); + } +} diff --git a/libjava/java/awt/Panel.java b/libjava/java/awt/Panel.java new file mode 100644 index 0000000..59aa6e2 --- /dev/null +++ b/libjava/java/awt/Panel.java @@ -0,0 +1,32 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt; + +/* An incomplete placeholder. */ + +public class Panel extends Container +{ + public Panel() + { + super(); + } + + public Panel(LayoutManager layout) + { + super(); + setLayout (layout); + } + + //public AccessibleContext getAccessibleContext() + + public void addNotify() + { + // FIXME + } +} diff --git a/libjava/java/awt/PopupMenu.java b/libjava/java/awt/PopupMenu.java new file mode 100644 index 0000000..3be7f84 --- /dev/null +++ b/libjava/java/awt/PopupMenu.java @@ -0,0 +1,37 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libjava. + +This software is copyrighted work licensed under the terms of the +Libjava License. Please consult the file "LIBJAVA_LICENSE" for +details. */ + +package java.awt; + +/* Status: Incomplete. */ + +public class PopupMenu extends Menu +{ + public PopupMenu() + { + super(); + } + + public PopupMenu(String label) + { + super(label); + } + + public void addNotify() + { + // FIXME + } + + public void show(Component origin, int x, int y) + { + // FIXME + } + + // Accessibility API not yet implemented. + // public AccessibleContext getAccessibleContext() +} diff --git a/libjava/java/awt/Rectangle.java b/libjava/java/awt/Rectangle.java index d6c9c5e..c741a33 100644 --- a/libjava/java/awt/Rectangle.java +++ b/libjava/java/awt/Rectangle.java @@ -8,28 +8,324 @@ details. */ package java.awt; -/* Status: Quite imcomplete. */ +/* Status: Mostly complete. Some of the Java2D stuff is commented out. */ -public class Rectangle implements Shape +// FIXME: Should extend Rectangle2D for 1.2 implementation +public class Rectangle implements Cloneable, Shape { public int x; public int y; public int width; public int height; - public Rectangle () { } + public Rectangle() + { + x = 0; + y = 0; + width = 0; + height = 0; + } + + public Rectangle(Rectangle r) + { + x = r.x; + y = r.y; + width = r.width; + height = r.height; + } + + public Rectangle(int x, int y, int width, int height) + { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } - public Rectangle (int width, int height) - { this.width = width; this.height = height; } + public Rectangle(int width, int height) + { + x = 0; + y = 0; + this.width = width; + this.height = height; + } + + public Rectangle(Point p, Dimension d) + { + x = p.x; + y = p.y; + width = d.width; + height = d.height; + } + + public Rectangle(Point p) + { + x = p.x; + y = p.y; + width = 0; + height = 0; + } - public Rectangle (int x, int y, int width, int height) + public Rectangle(Dimension d) { - this.x = x; this.y = y; - this.width = width; this.height = height; + x = 0; + y = 0; + width = d.width; + height = d.height; } public Rectangle getBounds () { - return new Rectangle (x, y, width, height); + return (Rectangle) this.clone(); + } + + public void add(int newx, int newy) + { + int x = this.x > newx ? newx : this.x; + int y = this.y > newy ? newy : this.y; + width = (this.x + width > newx ? this.x + width : newx) - x; + height = (this.y + height > newy ? this.y + height : newy) - y; + this.x = x; + this.y = y; + } + + public void add(Point pt) + { + add (pt.x, pt.y); + } + + public void add(Rectangle r) + { + int x = this.x > r.x ? r.x : this.x; + int y = this.y > r.y ? r.y : this.y; + width = (this.x + width > r.x + r.width ? + this.x + width : r.x + r.width) - x; + height = (this.y + height > r.y + r.height ? + this.y + height : r.y + r.height) - y; + this.x = x; + this.y = y; + } + + public boolean contains(int x, int y) + { + return (x >= this.x && x <= this.x + this.width + && y >= this.y && y <= this.y + this.height); + } + + public boolean contains(int x, int y, int w, int h) + { + return (x >= this.x && x + w <= this.x + this.width + && y >= this.y && y + h <= this.y + this.height); + } + + public boolean contains(Point p) + { + return contains(p.x, p.y); + } + + public boolean contains(Rectangle r) + { + return contains(r.x, r.y, r.width, r.height); + } + + public boolean equals(Object obj) + { + if (obj instanceof Rectangle) + { + Rectangle r = (Rectangle) obj; + return (r.x == x + && r.y == y + && r.width == width + && r.height == height); + } + return false; + } + + public double getHeight() + { + return (double) this.height; + } + + public Point getLocation() + { + return new Point(x,y); + } + + public Dimension getSize() + { + return new Dimension(width, height); + } + + public double getWidth() + { + return (double) this.width; + } + + public double getX() + { + return (double) x; + } + + public double getY() + { + return (double) y; + } + + public void grow(int h, int v) + { + width += h; + height += v; + } + + /** @deprecated Use contains() instead. */ + public boolean inside(int x, int y) + { + return contains(x, y); } + + /** @specnote If there is no intersection, an empty rectangle at 0,0 + * is returned. + */ + public Rectangle intersection(Rectangle r) + { + int newx = x < r.x ? r.x : x; + int newy = y < r.y ? r.y : y; + int neww = (x + width < r.x + r.width ? + x + width : r.x + r.width) - newx; + int newh = (y + height < r.y + r.height ? + y + height : r.y + r.height) - newy; + if (neww >= 0 && newh >= 0) + return new Rectangle(newx, newy, neww, newh); + else + return new Rectangle(0, 0, 0, 0); + } + + /** @specnote If the intersection is at an edge or corner only (an empty + * intersection with a non-zero location), false is returned. + */ + public boolean intersects(Rectangle r) + { + int neww = (x + width < r.x + r.width ? + x + width : r.x + r.width) - (x < r.x ? r.x : x); + int newh = (y + height < r.y + r.height ? + y + height : r.y + r.height) - (y < r.y ? r.y : y); + return (neww > 0 && newh > 0); + } + + public boolean isEmpty() + { + return (width > 0 && height > 0); + } + + /** @deprecated Use setLocation() instead. */ + public void move(int x, int y) + { + setLocation(x, y); + } + + public int outcode(double x, double y) + { + // FIXME + return 0; + } + + /** @deprecated Use setBounds() instead. */ + public void reshape(int x, int y, int width, int height) + { + setBounds(x, y, width, height); + } + + /** @deprecated Use setSize() instead. */ + public void resize(int width, int height) + { + setSize(width, height); + } + + public void setBounds(int x, int y, int width, int height) + { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } + + public void setBounds(Rectangle r) + { + this.x = r.x; + this.y = r.y; + this.width = r.width; + this.height = r.height; + } + + public void setLocation(int x, int y) + { + this.x = x; + this.y = y; + } + + public void setLocation(Point p) + { + this.x = p.x; + this.y = p.y; + } + + public void setRect(double x, double y, double width, double height) + { + this.x = (int) x; + this.y = (int) y; + this.width = (int) width; + this.height = (int) height; + } + + public void setSize(Dimension d) + { + this.width = d.width; + this.height = d.height; + } + + public void setSize(int width, int height) + { + this.width = width; + this.height = height; + } + + public void translate(int x, int y) + { + x += x; + y += y; + } + + public Rectangle union(Rectangle r) + { + int newx = x > r.x ? r.x : x; + int newy = y > r.y ? r.y : y; + int neww = (this.x + width > r.x + r.width ? + this.x + width : r.x + r.width) - newx; + int newh = (this.y + height > r.y + r.height ? + this.y + height : r.y + r.height) - newy; + return new Rectangle(newx, newy, neww, newh); + } + + // Commented out until we have Rectangle2D + /* + public Rectangle2D createIntersection(Rectangle2D r) + { + } + + public Rectangle2D createUnion(Rectangle2D r) + { + } + + public Rectangle2D getBounds2D() + { + } + */ + + public String toString() + { + return getClass().getName() + "[x=" + x + ",y=" + y + ",width=" + width + + ",height=" + height + "]"; + } + + } diff --git a/libjava/java/awt/Toolkit.java b/libjava/java/awt/Toolkit.java index bd1085a..f7ec764 100644 --- a/libjava/java/awt/Toolkit.java +++ b/libjava/java/awt/Toolkit.java @@ -15,6 +15,7 @@ import java.net.URL; public abstract class Toolkit { static Toolkit defaultToolkit; + static EventQueue systemEventQueue = new EventQueue(); public static synchronized Toolkit getDefaultToolkit() { @@ -26,6 +27,11 @@ public abstract class Toolkit protected abstract FramePeer createFrame(Frame target); public abstract Image getImage(URL url); + public final EventQueue getSystemEventQueue() + { + return systemEventQueue; + } + private static void init() { } // private static native void init(); // static { init(); } diff --git a/libjava/java/awt/event/ActionEvent.java b/libjava/java/awt/event/ActionEvent.java index de0d376..cd0761c 100644 --- a/libjava/java/awt/event/ActionEvent.java +++ b/libjava/java/awt/event/ActionEvent.java @@ -21,25 +21,25 @@ public class ActionEvent extends AWTEvent public static final int META_MASK = 4; public static final int SHIFT_MASK = 1; - String actionCommand; + String cmd; int modifiers; public ActionEvent (Object source, int id, String command) { super(source, id); - actionCommand = command; + cmd = command; } public ActionEvent (Object source, int id, String command, int modifiers) { super(source, id); - actionCommand = command; + cmd = command; this.modifiers = modifiers; } - public String getActionCommand () + public String getcmd () { - return actionCommand; + return cmd; } public int getModifiers () @@ -49,7 +49,18 @@ public class ActionEvent extends AWTEvent public String paramString () { - return ("ActionEvent[" + actionCommand + "," + modifiers - + ";" + super.paramString () + "]"); + String r; + switch (id) + { + case ACTION_PERFORMED: + r = "ACTION_PERFORMED"; + break; + default: + r = "unknown type"; + break; + } + + r += ",cmd=" + cmd; + return r; } } diff --git a/libjava/java/awt/event/AdjustmentEvent.java b/libjava/java/awt/event/AdjustmentEvent.java index 84838b6..9da9993 100644 --- a/libjava/java/awt/event/AdjustmentEvent.java +++ b/libjava/java/awt/event/AdjustmentEvent.java @@ -30,7 +30,7 @@ public class AdjustmentEvent extends AWTEvent public AdjustmentEvent (Adjustable source, int id, int type, int value) { super (source, id); - this.type = type; + this.adjType = type; this.value = value; } @@ -41,7 +41,7 @@ public class AdjustmentEvent extends AWTEvent public int getAdjustmentType () { - return type; + return adjType; } public int getValue () @@ -51,10 +51,45 @@ public class AdjustmentEvent extends AWTEvent public String paramString () { - return ("AdjustmentEvent[" + type + "," + value - + ";" + super.paramString () + "]"); + String r; + switch (id) + { + case ADJUSTMENT_VALUE_CHANGED: + r = "ADJUSTMENT_VALUE_CHANGED"; + break; + default: + r = "unknown id"; + break; + } + + r += ",adjType="; + + switch (adjType) + { + case BLOCK_DECREMENT: + r += "BLOCK_DECREMENT"; + break; + case BLOCK_INCREMENT: + r += "BLOCK_INCREMENT"; + break; + case TRACK: + r += "TRACK"; + break; + case UNIT_DECREMENT: + r += "UNIT_DECREMENT"; + break; + case UNIT_INCREMENT: + r += "UNIT_INCREMENT"; + break; + default: + r += "unknown type"; + break; + } + + r += ",value=" + value; + return r; } - private int type; + private int adjType; private int value; } diff --git a/libjava/java/awt/event/ComponentEvent.java b/libjava/java/awt/event/ComponentEvent.java index bb34a6e..bdf80ce 100644 --- a/libjava/java/awt/event/ComponentEvent.java +++ b/libjava/java/awt/event/ComponentEvent.java @@ -37,6 +37,25 @@ public class ComponentEvent extends AWTEvent public String paramString () { - return super.paramString (); + String r; + switch (id) + { + case COMPONENT_HIDDEN: + r = "COMPONENT_HIDDEN"; + break; + case COMPONENT_MOVED: + r = "COMPONENT_MOVED"; + break; + case COMPONENT_RESIZED: + r = "COMPONENT_RESIZED"; + break; + case COMPONENT_SHOWN: + r = "COMPONENT_SHOWN"; + break; + default: + r = "unknown id"; + break; + } + return r; } } diff --git a/libjava/java/awt/event/ContainerEvent.java b/libjava/java/awt/event/ContainerEvent.java index b662169..fc68d14 100644 --- a/libjava/java/awt/event/ContainerEvent.java +++ b/libjava/java/awt/event/ContainerEvent.java @@ -23,8 +23,8 @@ public class ContainerEvent extends ComponentEvent public static final int CONTAINER_FIRST = 300; public static final int CONTAINER_LAST = 301; - // FIXME: jdk1.2 docs say source is a Component. - public ContainerEvent (Container source, int id, Component child) + /** @specnote In JDK1.2 and 1.3, source is a Component. */ + public ContainerEvent (Component source, int id, Component child) { super (source, id); this.child = child; @@ -35,15 +35,29 @@ public class ContainerEvent extends ComponentEvent return child; } - public Component getContainer () + public Component getComponent () { - return (Container) source; + return (Component) source; } public String paramString () { - return ("ContainerEvent[" + child - + ";" + super.paramString () + "]"); + String r; + switch (id) + { + case COMPONENT_ADDED: + r = "COMPONENT_ADDED"; + break; + case COMPONENT_REMOVED: + r = "COMPONENT_REMOVED"; + break; + default: + r = "unknown id"; + break; + + } + r += ",child=" + child; + return r; } private Component child; diff --git a/libjava/java/awt/event/FocusEvent.java b/libjava/java/awt/event/FocusEvent.java index 9b559ea..ab125f5 100644 --- a/libjava/java/awt/event/FocusEvent.java +++ b/libjava/java/awt/event/FocusEvent.java @@ -42,8 +42,21 @@ public class FocusEvent extends AWTEvent public String paramString () { - return ("FocusEvent[" + temporary - + ";" + super.paramString () + "]"); + String r = ""; + switch (id) + { + case FOCUS_GAINED: + r += "FOCUS_GAINED"; + break; + case FOCUS_LOST: + r += "FOCUS_LOST"; + break; + default: + r += "unknown id"; + break; + } + r += (temporary ? "temporary" : "permanent"); + return r; } private boolean temporary; diff --git a/libjava/java/awt/event/HierarchyBoundsAdapter.java b/libjava/java/awt/event/HierarchyBoundsAdapter.java new file mode 100644 index 0000000..39ce1ab --- /dev/null +++ b/libjava/java/awt/event/HierarchyBoundsAdapter.java @@ -0,0 +1,27 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libjava License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.event; + +/** + * @since 1.3 + * @author Bryce McKinlay + */ + +/* Status: Believed complete and correct. */ + +public abstract class HierarchyBoundsAdapter implements HierarchyBoundsListener +{ + public void ancestorMoved(HierarchyEvent e) + { + } + + public void ancestorResized(HierarchyEvent e) + { + } +} diff --git a/libjava/java/awt/event/HierarchyBoundsListener.java b/libjava/java/awt/event/HierarchyBoundsListener.java new file mode 100644 index 0000000..aa853a0 --- /dev/null +++ b/libjava/java/awt/event/HierarchyBoundsListener.java @@ -0,0 +1,22 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libjava License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.event; + +/** + * @since 1.3 + * @author Bryce McKinlay + */ + +/* Status: Believed complete and correct. */ + +public interface HierarchyBoundsListener extends java.util.EventListener +{ + public void ancestorMoved(HierarchyEvent e); + public void ancestorResized(HierarchyEvent e); +} diff --git a/libjava/java/awt/event/HierarchyEvent.java b/libjava/java/awt/event/HierarchyEvent.java new file mode 100644 index 0000000..171d8b2 --- /dev/null +++ b/libjava/java/awt/event/HierarchyEvent.java @@ -0,0 +1,96 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libjava License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.event; +import java.awt.*; + +/** + * @since 1.3 + * @author Bryce McKinlay + */ + +/* Status: thought to be complete and correct. */ + +public class HierarchyEvent extends AWTEvent +{ + public static final int PARENT_CHANGED = 1 << 0, + DISPLAYABILITY_CHANGED = 1 << 1, + SHOWING_CHANGED = 1 << 2, + HIERARCHY_FIRST = 1400, + HIERARCHY_CHANGED = 1400, + ANCESTOR_MOVED = 1401, + ANCESTOR_RESIZED = 1402, + HIERARCHY_LAST = 1402; + + /* Serialized fields from the serialization spec. */ + Component changed; + Container changedParent; + long changeFlags = 0; + + public HierarchyEvent(Component source, int id, Component changed, + Container changedParent) + { + super(source, id); + this.changed = changed; + this.changedParent = changedParent; + } + + public HierarchyEvent(Component source, int id, Component changed, + Container changedParent, long changeFlags) + { + super(source,id); + this.changed = changed; + this.changedParent = changedParent; + this.changeFlags = changeFlags; + } + + public Component getComponent() + { + return (Component) source; + } + + public Component getChanged() + { + return changed; + } + + public Container getChangedParent() + { + return changedParent; + } + + public long getChangeFlags() + { + return changeFlags; + } + + public String paramString() + { + String r; + switch (id) + { + case HIERARCHY_CHANGED: + r = "HIERARCHY_CHANGED"; + break; + + case ANCESTOR_MOVED: + r = "ANCESTOR_MOVED"; + break; + + case ANCESTOR_RESIZED: + r = "ANCESTOR_RESIZED"; + break; + + default: + return "unknown type"; + } + + r += "(" + changed + "," + changedParent + ")"; + return r; + } +} diff --git a/libjava/java/awt/event/HierarchyListener.java b/libjava/java/awt/event/HierarchyListener.java new file mode 100644 index 0000000..b78e857 --- /dev/null +++ b/libjava/java/awt/event/HierarchyListener.java @@ -0,0 +1,21 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libjava License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.event; + +/** + * @since 1.3 + * @author Bryce McKinlay + */ + +/* Status: Believed complete and correct. */ + +public interface HierarchyListener extends java.util.EventListener +{ + public void hierarchyChanged(HierarchyEvent e); +} diff --git a/libjava/java/awt/event/InputMethodEvent.java b/libjava/java/awt/event/InputMethodEvent.java index d047a73..3cafd35 100644 --- a/libjava/java/awt/event/InputMethodEvent.java +++ b/libjava/java/awt/event/InputMethodEvent.java @@ -43,7 +43,21 @@ public class InputMethodEvent extends AWTEvent public TextHitInfo getVisiblePosition (); public boolean isConsumed (); - public String paramString (); + public String paramString () + { + String r; + switch (id) + { + case CARET_POSITION_CHANGED: + r = "CARET_POSITION_CHANGED"; + break; + case INPUT_METHOD_TEXT_CHANGED: + r = "INPUT_METHOD_TEXT_CHANGED"; + break; + } + r += ""; // FIXME + return r; + } */ // FIXME: this is just to let it compile. diff --git a/libjava/java/awt/event/InvocationEvent.java b/libjava/java/awt/event/InvocationEvent.java index 522447a..778eb18 100644 --- a/libjava/java/awt/event/InvocationEvent.java +++ b/libjava/java/awt/event/InvocationEvent.java @@ -14,7 +14,7 @@ import java.awt.*; * @date April 8, 2000 */ -/* Status: Still one bug. */ +/* Status: Believed to be complete and correct. */ public class InvocationEvent extends AWTEvent implements ActiveEvent { @@ -37,28 +37,29 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent this.runnable = runnable; } - public InvocationEvent (Object source, Runnable runnable, Object notifier) + public InvocationEvent(Object source, Runnable runnable, Object notifier, + boolean catchExceptions) { super (source, INVOCATION_DEFAULT); this.runnable = runnable; this.notifier = notifier; + this.catchExceptions = catchExceptions; } public void dispatch () { Exception e = null; - try - { - runnable.run (); - } - catch (Exception _) - { - e = _; - } - - // FIXME: what to do if !catchExceptions? if (catchExceptions) - exception = e; + try + { + runnable.run (); + } + catch (Exception x) + { + exception = x; + } + else + runnable.run (); if (notifier != null) notifier.notifyAll (); @@ -71,9 +72,15 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent public String paramString () { - return ("InvocationEvent[" + notifier + "," + runnable - + "," + catchExceptions - + ";" + super.paramString () + "]"); + String r; + if (id == INVOCATION_DEFAULT) + r = "INVOCATION_DEFAULT"; + else + r = "unknown type"; + + r += ",runnable=" + runnable + ",notifier=" + notifier + + ",catchExceptions=" + catchExceptions; + return r; } protected boolean catchExceptions; diff --git a/libjava/java/awt/event/ItemEvent.java b/libjava/java/awt/event/ItemEvent.java index cb36fea..3d2e502 100644 --- a/libjava/java/awt/event/ItemEvent.java +++ b/libjava/java/awt/event/ItemEvent.java @@ -48,8 +48,32 @@ public class ItemEvent extends AWTEvent public String paramString () { - return ("ItemEvent[" + item + "," + stateChange - + ";" + super.paramString () + "]"); + String r; + switch (id) + { + case ITEM_STATE_CHANGED: + r = "ITEM_STATE_CHANGED"; + break; + default: + r = "unknown id"; + break; + } + + r += ",item=" + item + ",stateChange="; + switch (stateChange) + { + case SELECTED: + r += "SELECTED"; + break; + case DESELECTED: + r += "DESELECTED"; + break; + default: + r += "unknown"; + break; + } + + return r; } private Object item; diff --git a/libjava/java/awt/event/KeyEvent.java b/libjava/java/awt/event/KeyEvent.java index 4aadea1..3f6a14c 100644 --- a/libjava/java/awt/event/KeyEvent.java +++ b/libjava/java/awt/event/KeyEvent.java @@ -251,8 +251,22 @@ public class KeyEvent extends InputEvent public String paramString () { - return ("KeyEvent[" + keyCode + "," + keyChar + "," + modifiers - + ";" + super.paramString () + "]"); + String r; + switch (id) + { + case KEY_PRESSED: + r = "KEY_PRESSED"; + break; + case KEY_RELEASED: + r = "KEY_RELEASED"; + break; + case KEY_TYPED: + r = "KEY_TYPED"; + break; + } + r += ",keyCode=" + keyCode + "," + getKeyText(keyCode) + ",modifiers=" + + getKeyModifiersText(modifiers); + return r; } private int keyCode; diff --git a/libjava/java/awt/event/MouseEvent.java b/libjava/java/awt/event/MouseEvent.java index e3dff04..bb9602c 100644 --- a/libjava/java/awt/event/MouseEvent.java +++ b/libjava/java/awt/event/MouseEvent.java @@ -67,10 +67,37 @@ public class MouseEvent extends InputEvent public String paramString () { - return ("MouseEvent[" + when + "," + modifiers - + ",(" + x + "," + y + ")," - + clickCount + "," + popupTrigger - + ";" + super.paramString () + "]"); + String r; + switch (id) + { + case MOUSE_CLICKED: + r = "MOUSE_CLICKED"; + break; + case MOUSE_DRAGGED: + r = "MOUSE_DRAGGED"; + break; + case MOUSE_ENTERED: + r = "MOUSE_ENTERED"; + break; + case MOUSE_EXITED: + r = "MOUSE_EXITED"; + break; + case MOUSE_MOVED: + r = "MOUSE_MOVED"; + break; + case MOUSE_PRESSED: + r = "MOUSE_PRESSED"; + break; + case MOUSE_RELEASED: + r = "MOUSE_RELEASED"; + break; + default: + r = "unknown id"; + break; + } + r += ",(" + x + "," + y + "),modifiers=" + modifiers + ",clickCount=" + + clickCount; + return r; } public void translatePoint (int x, int y) diff --git a/libjava/java/awt/event/PaintEvent.java b/libjava/java/awt/event/PaintEvent.java index 7784c58..21c42e4 100644 --- a/libjava/java/awt/event/PaintEvent.java +++ b/libjava/java/awt/event/PaintEvent.java @@ -36,8 +36,22 @@ public class PaintEvent extends ComponentEvent public String paramString () { - return ("PaintEvent[" + updateRect - + ";" + super.paramString () + "]"); + String r; + switch (id) + { + case UPDATE: + r = "UPDATE"; + break; + case PAINT: + r = "PAINT"; + break; + default: + r = "unknown id"; + break; + } + + r += ",updateRect=" + updateRect; + return r; } public void setUpdateRect (Rectangle updateRect) diff --git a/libjava/java/awt/event/TextEvent.java b/libjava/java/awt/event/TextEvent.java index 2d3d26a..85c5d85 100644 --- a/libjava/java/awt/event/TextEvent.java +++ b/libjava/java/awt/event/TextEvent.java @@ -24,6 +24,6 @@ public class TextEvent extends AWTEvent public String paramString () { - return super.paramString (); + return "TEXT_VALUE_CHANGED"; } } diff --git a/libjava/java/awt/event/WindowEvent.java b/libjava/java/awt/event/WindowEvent.java index 7e00f0e..675adec 100644 --- a/libjava/java/awt/event/WindowEvent.java +++ b/libjava/java/awt/event/WindowEvent.java @@ -35,6 +35,31 @@ public class WindowEvent extends ComponentEvent public String paramString () { - return super.paramString (); + String r; + switch (id) + { + case WINDOW_ACTIVATED: + r = "WINDOW_ACTIVATED"; + break; + case WINDOW_CLOSED: + r = "WINDOW_CLOSED"; + break; + case WINDOW_CLOSING: + r = "WINDOW_CLOSING"; + break; + case WINDOW_DEACTIVATED: + r = "WINDOW_DEACTIVATED"; + break; + case WINDOW_DEICONIFIED: + r = "WINDOW_DEICONIFIED"; + break; + case WINDOW_ICONIFIED: + r = "WINDOW_ICONIFIED"; + break; + case WINDOW_OPENED: + r = "WINDOW_OPENED"; + break; + } + return r; } } diff --git a/libjava/java/awt/peer/ButtonPeer.java b/libjava/java/awt/peer/ButtonPeer.java new file mode 100644 index 0000000..d4d8034 --- /dev/null +++ b/libjava/java/awt/peer/ButtonPeer.java @@ -0,0 +1,15 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface ButtonPeer extends ComponentPeer +{ + void setLabel(String label); +} + diff --git a/libjava/java/awt/peer/CanvasPeer.java b/libjava/java/awt/peer/CanvasPeer.java new file mode 100644 index 0000000..67c4055 --- /dev/null +++ b/libjava/java/awt/peer/CanvasPeer.java @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface CanvasPeer extends ComponentPeer +{ +} diff --git a/libjava/java/awt/peer/CheckboxMenuItemPeer.java b/libjava/java/awt/peer/CheckboxMenuItemPeer.java new file mode 100644 index 0000000..42c6c8f --- /dev/null +++ b/libjava/java/awt/peer/CheckboxMenuItemPeer.java @@ -0,0 +1,15 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface CheckboxMenuItemPeer extends MenuItemPeer +{ + void setState(boolean state); +} + diff --git a/libjava/java/awt/peer/CheckboxPeer.java b/libjava/java/awt/peer/CheckboxPeer.java new file mode 100644 index 0000000..b27b2cf --- /dev/null +++ b/libjava/java/awt/peer/CheckboxPeer.java @@ -0,0 +1,16 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface CheckboxPeer extends ComponentPeer +{ + void setCheckboxGroup(java.awt.CheckboxGroup group); + void setLabel(String label); + void setState(boolean state); +} diff --git a/libjava/java/awt/peer/ChoicePeer.java b/libjava/java/awt/peer/ChoicePeer.java new file mode 100644 index 0000000..f100615 --- /dev/null +++ b/libjava/java/awt/peer/ChoicePeer.java @@ -0,0 +1,18 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface ChoicePeer extends ComponentPeer +{ + void add(String item, int index); + void addItem(String item, int index); + void remove(int index); + void select(int index); +} + diff --git a/libjava/java/awt/peer/ComponentPeer.java b/libjava/java/awt/peer/ComponentPeer.java index 806b962..883d2b3 100644 --- a/libjava/java/awt/peer/ComponentPeer.java +++ b/libjava/java/awt/peer/ComponentPeer.java @@ -1,23 +1,48 @@ -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 2000 Free Software Foundation - This file is part of libjava. + This file is part of libgcj. This software is copyrighted work licensed under the terms of the -Libjava License. Please consult the file "LIBJAVA_LICENSE" for +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details. */ package java.awt.peer; -import java.awt.*; -/* A very incomplete placeholder. */ +import java.awt.*; +import java.awt.image.*; public interface ComponentPeer { - public abstract Toolkit getToolkit (); - - public Dimension getMinimumSize (); - - public Dimension getPreferredSize (); - - public void setBounds (int x, int y, int w, int h); + int checkImage(Image img, int width, int height, ImageObserver o); + Image createImage(ImageProducer prod); + Image createImage(int width, int height); + void disable(); + void dispose(); + void enable(); + ColorModel getColorModel(); + FontMetrics getFontMetrics(Font f); + Graphics getGraphics(); + Point getLocationOnScreen(); + Dimension getMinimumSize(); + Dimension getPreferredSize(); + Toolkit getToolkit(); + void handleEvent(AWTEvent e); + void hide(); + boolean isFocusTraversable(); + Dimension minimumSize(); + Dimension preferredSize(); + void paint(Graphics graphics); + boolean prepareImage(Image img, int width, int height, ImageObserver o); + void print(Graphics graphics); + void repaint(long tm, int x, int y, int width, int height); + void requestFocus(); + void reshape(int x, int y, int width, int height); + void setBackground(Color color); + void setBounds(int x, int y, int width, int height); + void setCursor(Cursor cursor); + void setEnabled(boolean enabled); + void setFont(Font font); + void setForeground(Color color); + void setVisible(boolean visible); + void show(); } diff --git a/libjava/java/awt/peer/ContainerPeer.java b/libjava/java/awt/peer/ContainerPeer.java index c8e459a..8f1235c 100644 --- a/libjava/java/awt/peer/ContainerPeer.java +++ b/libjava/java/awt/peer/ContainerPeer.java @@ -1,15 +1,19 @@ -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 2000 Free Software Foundation - This file is part of libjava. + This file is part of libgcj. This software is copyrighted work licensed under the terms of the -Libjava License. Please consult the file "LIBJAVA_LICENSE" for +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details. */ package java.awt.peer; -/* A very incomplete placeholder. */ +import java.awt.Insets; public interface ContainerPeer extends ComponentPeer { + Insets insets(); + Insets getInsets(); + void beginValidate(); + void endValidate(); } diff --git a/libjava/java/awt/peer/DialogPeer.java b/libjava/java/awt/peer/DialogPeer.java new file mode 100644 index 0000000..009410f --- /dev/null +++ b/libjava/java/awt/peer/DialogPeer.java @@ -0,0 +1,15 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface DialogPeer extends WindowPeer +{ + void setResizable(boolean resizeable); + void setTitle(String title); +} diff --git a/libjava/java/awt/peer/FileDialogPeer.java b/libjava/java/awt/peer/FileDialogPeer.java new file mode 100644 index 0000000..c378f10 --- /dev/null +++ b/libjava/java/awt/peer/FileDialogPeer.java @@ -0,0 +1,18 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +import java.io.FilenameFilter; + +public interface FileDialogPeer extends DialogPeer +{ + void setDirectory(String dir); + void setFile(String file); + void setFilenameFilter(FilenameFilter filter); +} diff --git a/libjava/java/awt/peer/FontPeer.java b/libjava/java/awt/peer/FontPeer.java new file mode 100644 index 0000000..2a65a38 --- /dev/null +++ b/libjava/java/awt/peer/FontPeer.java @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface FontPeer +{ +} diff --git a/libjava/java/awt/peer/FramePeer.java b/libjava/java/awt/peer/FramePeer.java index e68a17f..c47b0f5 100644 --- a/libjava/java/awt/peer/FramePeer.java +++ b/libjava/java/awt/peer/FramePeer.java @@ -1,16 +1,20 @@ -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 2000 Free Software Foundation - This file is part of libjava. + This file is part of libgcj. This software is copyrighted work licensed under the terms of the -Libjava License. Please consult the file "LIBJAVA_LICENSE" for +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details. */ package java.awt.peer; -/* A very incomplete placeholder. */ +import java.awt.Image; +import java.awt.MenuBar; public interface FramePeer extends WindowPeer { + void setIconImage(Image image); + void setMenuBar(MenuBar mb); + void setResizable(boolean resizable); void setTitle(String title); } diff --git a/libjava/java/awt/peer/LabelPeer.java b/libjava/java/awt/peer/LabelPeer.java new file mode 100644 index 0000000..4d32b79 --- /dev/null +++ b/libjava/java/awt/peer/LabelPeer.java @@ -0,0 +1,15 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface LabelPeer extends ComponentPeer +{ + void setAlignment(int alignment); + void setText(String text); +} diff --git a/libjava/java/awt/peer/LightweightPeer.java b/libjava/java/awt/peer/LightweightPeer.java new file mode 100644 index 0000000..af3c132 --- /dev/null +++ b/libjava/java/awt/peer/LightweightPeer.java @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface LightweightPeer extends ComponentPeer +{ +} diff --git a/libjava/java/awt/peer/ListPeer.java b/libjava/java/awt/peer/ListPeer.java new file mode 100644 index 0000000..a334e38 --- /dev/null +++ b/libjava/java/awt/peer/ListPeer.java @@ -0,0 +1,28 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +import java.awt.Dimension; + +public interface ListPeer extends ComponentPeer +{ + void add(String item, int index); + void addItem(String item, int index); + void clear(); + void delItems(int start_index, int end_index); + void deselect(int index); + int[] getSelectedIndexes(); + void makeVisible(int index); + Dimension minimumSize(int size); + Dimension preferredSize(int size); + void removeAll(); + void select(int index); + void setMultipleMode(boolean multipleMode); + void setMultipleSelections(boolean multipleSelections); +} diff --git a/libjava/java/awt/peer/MenuBarPeer.java b/libjava/java/awt/peer/MenuBarPeer.java new file mode 100644 index 0000000..e660ba2 --- /dev/null +++ b/libjava/java/awt/peer/MenuBarPeer.java @@ -0,0 +1,18 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +import java.awt.Menu; + +public interface MenuBarPeer extends MenuComponentPeer +{ + void addHelpMenu(Menu menu); + void addMenu(Menu menu); + void delMenu(int index); +} diff --git a/libjava/java/awt/peer/MenuComponentPeer.java b/libjava/java/awt/peer/MenuComponentPeer.java new file mode 100644 index 0000000..080f9ea --- /dev/null +++ b/libjava/java/awt/peer/MenuComponentPeer.java @@ -0,0 +1,14 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface MenuComponentPeer +{ + void dispose(); +} diff --git a/libjava/java/awt/peer/MenuItemPeer.java b/libjava/java/awt/peer/MenuItemPeer.java new file mode 100644 index 0000000..555a38b --- /dev/null +++ b/libjava/java/awt/peer/MenuItemPeer.java @@ -0,0 +1,17 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface MenuItemPeer extends MenuComponentPeer +{ + void disable(); + void enable(); + void setEnabled(boolean enabled); + void setLabel(String text); +} diff --git a/libjava/java/awt/peer/MenuPeer.java b/libjava/java/awt/peer/MenuPeer.java new file mode 100644 index 0000000..eca98dc --- /dev/null +++ b/libjava/java/awt/peer/MenuPeer.java @@ -0,0 +1,18 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +import java.awt.MenuItem; + +public interface MenuPeer extends MenuItemPeer +{ + void addItem(MenuItem item); + void addSeparator(); + void delItem(int index); +} diff --git a/libjava/java/awt/peer/PanelPeer.java b/libjava/java/awt/peer/PanelPeer.java new file mode 100644 index 0000000..13b0e90 --- /dev/null +++ b/libjava/java/awt/peer/PanelPeer.java @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface PanelPeer extends ContainerPeer +{ +} diff --git a/libjava/java/awt/peer/PopupMenuPeer.java b/libjava/java/awt/peer/PopupMenuPeer.java new file mode 100644 index 0000000..e0b3980 --- /dev/null +++ b/libjava/java/awt/peer/PopupMenuPeer.java @@ -0,0 +1,16 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +import java.awt.Event; + +public interface PopupMenuPeer extends MenuPeer +{ + void show(Event e); +} diff --git a/libjava/java/awt/peer/ScrollPanePeer.java b/libjava/java/awt/peer/ScrollPanePeer.java new file mode 100644 index 0000000..fe300e4 --- /dev/null +++ b/libjava/java/awt/peer/ScrollPanePeer.java @@ -0,0 +1,21 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +import java.awt.Adjustable; + +public interface ScrollPanePeer extends ContainerPeer +{ + void childResized(int width, int height); + int getHScrollbarHeight(); + int getVScrollbarWidth(); + void setScrollPosition(int x, int y); + void setUnitIncrement(Adjustable adj, int increment); + void setValue(Adjustable adj, int value); +} diff --git a/libjava/java/awt/peer/ScrollbarPeer.java b/libjava/java/awt/peer/ScrollbarPeer.java new file mode 100644 index 0000000..3981c22 --- /dev/null +++ b/libjava/java/awt/peer/ScrollbarPeer.java @@ -0,0 +1,16 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface ScrollbarPeer extends ComponentPeer +{ + void setLineIncrement(int increment); + void setPageIncrement(int increment); + void setValues(int value, int visible, int minimum, int maximum); +} diff --git a/libjava/java/awt/peer/TextAreaPeer.java b/libjava/java/awt/peer/TextAreaPeer.java new file mode 100644 index 0000000..ce5a294 --- /dev/null +++ b/libjava/java/awt/peer/TextAreaPeer.java @@ -0,0 +1,23 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +import java.awt.Dimension; + +public interface TextAreaPeer extends TextComponentPeer +{ + Dimension getMinimumSize(int rows, int columns); + Dimension getPreferredSize(int rows, int columns); + void insert(String text, int pos); + void insertText(String text, int pos); + Dimension minimumSize(int rows, int cols); + Dimension preferredSize(int rows, int cols); + void replaceRange(String text, int start, int end); + void replaceText(String text, int start, int end); +} diff --git a/libjava/java/awt/peer/TextComponentPeer.java b/libjava/java/awt/peer/TextComponentPeer.java new file mode 100644 index 0000000..ba4ce1d --- /dev/null +++ b/libjava/java/awt/peer/TextComponentPeer.java @@ -0,0 +1,21 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +public interface TextComponentPeer extends ComponentPeer +{ + int getCaretPosition(); + int getSelectionEnd(); + int getSelectionStart(); + String getText(); + void select(int start, int end); + void setCaretPosition(int pos); + void setEditable(boolean editable); + void setText(String text); +} diff --git a/libjava/java/awt/peer/TextFieldPeer.java b/libjava/java/awt/peer/TextFieldPeer.java new file mode 100644 index 0000000..cf4d675 --- /dev/null +++ b/libjava/java/awt/peer/TextFieldPeer.java @@ -0,0 +1,21 @@ +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package java.awt.peer; + +import java.awt.Dimension; + +public interface TextFieldPeer extends TextComponentPeer +{ + Dimension getMinimumSize(int columns); + Dimension getPreferredSize(int columns); + Dimension minimumSize(int columns); + Dimension preferredSize(int columns); + void setEchoChar(char echo); + void setEchoCharacter(char echo); +} diff --git a/libjava/java/awt/peer/WindowPeer.java b/libjava/java/awt/peer/WindowPeer.java index 109992d..d805805 100644 --- a/libjava/java/awt/peer/WindowPeer.java +++ b/libjava/java/awt/peer/WindowPeer.java @@ -1,15 +1,15 @@ -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 2000 Free Software Foundation - This file is part of libjava. + This file is part of libgcj. This software is copyrighted work licensed under the terms of the -Libjava License. Please consult the file "LIBJAVA_LICENSE" for +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details. */ package java.awt.peer; -/* A very incomplete placeholder. */ - public interface WindowPeer extends ContainerPeer { + void toBack(); + void toFront(); } diff --git a/libjava/java/util/ResourceBundle.java b/libjava/java/util/ResourceBundle.java index 6cec4c2..b5edfbf 100644 --- a/libjava/java/util/ResourceBundle.java +++ b/libjava/java/util/ResourceBundle.java @@ -28,6 +28,12 @@ public abstract class ResourceBundle public ResourceBundle () { } + + public Locale getLocale() + { + // FIXME: Stub added for this missing method because it is needed for AWT. + return null; + } public final String getString (String key) throws MissingResourceException { @@ -110,9 +116,14 @@ public abstract class ResourceBundle // Look for a properties file. { + String prop_name = (bundleName.replace('.', '/') + ".properties"); + System.out.println ("trying '" + prop_name + "' for '" + bundleName); + InputStream i = ClassLoader.getSystemResourceAsStream (prop_name); + /* InputStream i = ClassLoader.getSystemResourceAsStream (bundleName.replace ('.', '/') + ".properties"); + */ if (i != null) { try {