diff options
author | Tom Tromey <tromey@cygnus.com> | 2000-07-30 23:19:57 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-07-30 23:19:57 +0000 |
commit | 4e07a9eadbf4c8bf943964c95a664494508cc28e (patch) | |
tree | 5171363ed0ce09ef1ceb12e1a0d67aa47dd4bd2a /libjava/java/awt/Button.java | |
parent | 3a8c5c77d573036d25982d47366164bc05112f61 (diff) | |
download | gcc-4e07a9eadbf4c8bf943964c95a664494508cc28e.zip gcc-4e07a9eadbf4c8bf943964c95a664494508cc28e.tar.gz gcc-4e07a9eadbf4c8bf943964c95a664494508cc28e.tar.bz2 |
Container.java (remove(int)): Wrote.
* java/awt/Container.java (remove(int)): Wrote.
(remove(Component)): Wrote.
(add(Component)): Wrote.
(add(Component,int)): Wrote.
(removeAll): Wrote.
(addNotify): Set our own peer.
* java/awt/Scrollbar.java (listeners): Changed type.
(Scrollbar): Don't initialize listeners.
(addNotify): Wrote.
(setValue): Call setValues.
(setMinimum): Likewise.
(setMaxPriority): Likewise.
(setVisibleAmount): Likewise.
(setValues): Wrote.
(setUnitIncrement): Forward to peer.
(setLineIncrement): Call setUnitIncrement.
(setPageIncrement): Call setBlockIncrement.
(setBlockIncrement): Forward to peer.
(addAdjustmentListener): Rewrote.
(removeAdjustmentListener): Rewrote.
(processAdjustmentEvent): Rewrote.
(paramString): Wrote.
* Makefile.in: Rebuilt.
* Makefile.am (awt_java_source_files): Added Button.java.
* java/awt/Button.java: New file.
* java/awt/Toolkit.java (createLabel): Declare.
(createButton): Likewise.
(createScrollbar): Likewise.
(createContainer): Likewise.
* java/awt/Label.java (addNotify): Wrote.
(setAlignment): Call setAlignment in the peer.
(setText): Call setText in the peer.
From-SVN: r35354
Diffstat (limited to 'libjava/java/awt/Button.java')
-rw-r--r-- | libjava/java/awt/Button.java | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/libjava/java/awt/Button.java b/libjava/java/awt/Button.java new file mode 100644 index 0000000..a582b96 --- /dev/null +++ b/libjava/java/awt/Button.java @@ -0,0 +1,94 @@ +/* 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 () + { + 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; +} |