diff options
author | Tom Tromey <tromey@cygnus.com> | 2000-07-31 02:03:51 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-07-31 02:03:51 +0000 |
commit | e0a339f785fd6673790ffe95448fa4375e4cc77f (patch) | |
tree | e4242f7fec5fd46deb2e127e632eaf9fc1aceb50 /libjava/java/awt/Window.java | |
parent | 911a71a72912cfa7bc2d762f35e76e2f58e3097c (diff) | |
download | gcc-e0a339f785fd6673790ffe95448fa4375e4cc77f.zip gcc-e0a339f785fd6673790ffe95448fa4375e4cc77f.tar.gz gcc-e0a339f785fd6673790ffe95448fa4375e4cc77f.tar.bz2 |
BorderLayout.java (BorderLayout()): New constructor.
* java/awt/BorderLayout.java (BorderLayout()): New constructor.
* java/awt/Frame.java (Frame): Pass `null' to Window constructor.
* java/awt/Window.java (addNotify): Wrote.
(addWindowListener): Wrote.
(getLocale): Wrote.
(getWarningString): Wrote.
(processEvent): Wrote.
(processWindowEvent): Wrote.
(removeWindowListener): Wrote.
(show): Call validate(), setVisible().
(toBack): Wrote.
(toFront): Wrote.
* java/awt/Toolkit.java (createWindow): Declare.
* java/awt/Frame.java (addNotify): Use getToolkit to find
toolkit.
* java/awt/Component.java (invalidate): Wrote.
(isValid): Wrote.
(getToolkit): Wrote.
* java/awt/Container.java (addContainerListener): Removed
unnecessary cast.
(removeContainerListener): Likewise.
(addImpl): Wrote.
(add(Component)): Use it.
(add(String,Component)): Likewise.
(add(Component,int)): Likewise.
(add(Component,Object)): Likewise.
(add(Component,Object,int)): Likewise.
(doLayout): Wrote.
(getAlignmentX): Wrote.
(getAlignmentY): Wrote.
(getComponentAt): Wrote.
(getMaximumSize): Wrote.
(invalidate): Wrote.
(list(PrintStream,int)): Wrote.
(list(PrintWriter,int)): Wrote.
(getMinimumSize): Wrote.
(getPreferredSize): Wrote.
(printComponents): Wrote.
(processContainerEvent): Look at containerListener, not
componentListener.
(remove): Added event processing and peer destruction.
(removeAll): Use remove.
(removeNotify): Wrote.
(validate): Wrote.
(validateTree): Wrote.
* java/awt/Scrollbar.java (addNotify): Do nothing if peer exists.
* java/awt/Label.java (addNotify): Do nothing if peer exists.
* java/awt/Container.java (addNotify): Don't create Container
peer.
* java/awt/Button.java (addNotify): Do nothing if peer exists.
From-SVN: r35361
Diffstat (limited to 'libjava/java/awt/Window.java')
-rw-r--r-- | libjava/java/awt/Window.java | 130 |
1 files changed, 123 insertions, 7 deletions
diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java index 4112861..463b67b 100644 --- a/libjava/java/awt/Window.java +++ b/libjava/java/awt/Window.java @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 1999, 2000 Free Software Foundation This file is part of libjava. @@ -7,23 +7,139 @@ Libjava License. Please consult the file "LIBJAVA_LICENSE" for details. */ package java.awt; +import java.awt.event.WindowEvent; import java.awt.event.WindowListener; +import java.awt.peer.WindowPeer; +import java.awt.peer.ComponentPeer; +import java.util.Locale; /* A very incomplete placeholder. */ public class Window extends Container { - public void dispose () - { /* FIXME */ } + public Window (Frame parent) + { + this.parent = parent; + // FIXME: compiler bug + // this.layoutMgr = new BorderLayout (); + } + + public void addNotify () + { + if (peer == null) + peer = (ComponentPeer) getToolkit ().createWindow (this); + super.addNotify (); + } public synchronized void addWindowListener (WindowListener listener) - { /* FIXME */ } + { + windowListener = AWTEventMulticaster.add (windowListener, listener); + } + + public void dispose () + { + } + + public Component getFocusOwner () + { + return null; // FIXME + } + public Locale getLocale () + { + return locale == null ? Locale.getDefault () : locale; + } + + public String getWarningString () + { + return warningString; + } + + public void pack () + { + addNotify (); + // FIXME + } + + public boolean postEvent (Event evt) + { + return false; // FIXME + } + + protected void processEvent (AWTEvent evt) + { + if (evt instanceof WindowEvent) + processWindowEvent ((WindowEvent) evt); + else + super.processEvent (evt); + } + + protected void processWindowEvent (WindowEvent evt) + { + if (windowListener != null) + { + switch (evt.getID ()) + { + case WindowEvent.WINDOW_ACTIVATED: + windowListener.windowActivated (evt); + break; + case WindowEvent.WINDOW_CLOSED: + windowListener.windowClosed (evt); + break; + case WindowEvent.WINDOW_CLOSING: + windowListener.windowClosing (evt); + break; + case WindowEvent.WINDOW_DEACTIVATED: + windowListener.windowDeactivated (evt); + break; + case WindowEvent.WINDOW_DEICONIFIED: + windowListener.windowDeiconified (evt); + break; + case WindowEvent.WINDOW_ICONIFIED: + windowListener.windowIconified (evt); + break; + case WindowEvent.WINDOW_OPENED: + windowListener.windowOpened (evt); + break; + } + } + } + + public synchronized void removeWindowListener (WindowListener listener) + { + windowListener = AWTEventMulticaster.remove (windowListener, listener); + } public void show () { - addNotify(); - // validate FIXME - // validate setVisible FIXME + addNotify (); + validate (); + setVisible (true); + // FIXME: is there more to it? + } + + public void toBack () + { + if (peer != null) + { + WindowPeer wp = (WindowPeer) peer; + wp.toBack (); + } } + + public void toFront () + { + if (peer != null) + { + WindowPeer wp = (WindowPeer) peer; + wp.toFront (); + } + } + + // Serialized fields, from Sun's serialization spec. + // private FocusManager focusMgr; // FIXME: what is this? + private int state; + private String warningString; + + private transient WindowListener windowListener; } |