From 4b042b000c43aaa94ec765606ec009f30502b169 Mon Sep 17 00:00:00 2001 From: tromey Date: Mon, 31 Jul 2000 02:03:51 +0000 Subject: * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35361 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/java/awt/Window.java | 130 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 123 insertions(+), 7 deletions(-) (limited to 'libjava/java/awt/Window.java') diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java index 4112861f6c6..463b67b6681 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; } -- cgit v1.2.1