e0a339f785
* 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
96 lines
1.8 KiB
Java
96 lines
1.8 KiB
Java
/* 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;
|
|
import java.awt.peer.ButtonPeer;
|
|
import java.awt.peer.ComponentPeer;
|
|
import java.awt.event.ActionListener;
|
|
import java.awt.event.ActionEvent;
|
|
|
|
/**
|
|
* @author Tom Tromey <tromey@cygnus.com>
|
|
* @date July 30, 2000
|
|
*/
|
|
|
|
public class Button extends Component
|
|
{
|
|
public Button ()
|
|
{
|
|
this (null);
|
|
}
|
|
|
|
public Button (String label)
|
|
{
|
|
this.label = label;
|
|
}
|
|
|
|
public void addActionListener (ActionListener l)
|
|
{
|
|
listeners = AWTEventMulticaster.add (listeners, l);
|
|
}
|
|
|
|
public void addNotify ()
|
|
{
|
|
if (peer == null)
|
|
peer = (ComponentPeer) getToolkit ().createButton (this);
|
|
}
|
|
|
|
public String getActionCommand ()
|
|
{
|
|
return command;
|
|
}
|
|
|
|
public String getLabel ()
|
|
{
|
|
return label;
|
|
}
|
|
|
|
protected String paramString ()
|
|
{
|
|
return "Button[" + label + "]";
|
|
}
|
|
|
|
protected void processActionEvent (ActionEvent e)
|
|
{
|
|
if (listeners != null)
|
|
listeners.actionPerformed (e);
|
|
}
|
|
|
|
protected void processEvent (AWTEvent e)
|
|
{
|
|
if (e instanceof ActionEvent)
|
|
processActionEvent ((ActionEvent) e);
|
|
else
|
|
super.processEvent (e);
|
|
}
|
|
|
|
public void removeActionListener (ActionListener l)
|
|
{
|
|
listeners = AWTEventMulticaster.remove (listeners, l);
|
|
}
|
|
|
|
public void setActionCommand (String command)
|
|
{
|
|
this.command = (command == null) ? label : command;
|
|
}
|
|
|
|
public void setLabel (String label)
|
|
{
|
|
this.label = label;
|
|
if (peer != null)
|
|
{
|
|
ButtonPeer bp = (ButtonPeer) peer;
|
|
bp.setLabel (label);
|
|
}
|
|
}
|
|
|
|
private String label;
|
|
private String command;
|
|
private ActionListener listeners;
|
|
}
|