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
This commit is contained in:
Tom Tromey 2000-07-31 02:03:51 +00:00 committed by Tom Tromey
parent 911a71a729
commit e0a339f785
10 changed files with 375 additions and 91 deletions

View file

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