| ★ wanayoo — archive 1999 http://javaboutique.webdeveloper.com/tutorials/Step/Chapter2/ActionExample.html | Nouvelle recherche | Portail wanayoo |
![]() | |||||||||||||||||||||
Tutorials :
Step by Step :
|
|||||||||||||||||||||
| Contents |
| Event Listeners |
| The ActionListener |
| The MouseListener |
| The MouseMotionListener |
| /* Now you will be able to perform actions when
a button is clicked
to get and place text in/out of a textfield and to get the state of checkboxes. This example will only let the button do actions. */
import java.awt.*;
// Tells the applet you will be using the ActionListener methods.
public class ActionExample extends Applet implements
ActionListener
Button okButton;
public void init()
// Attach actions to the components
// Here we will show the results of our
actions
// Now that the color is set you can get
the text out of the TextField
// When the button is clicked this method
will get automatically called
public
void actionPerformed(ActionEvent evt)
// Actions of the wrongButton
// Change the text on the button
for fun
}
// That gives you an idea of how to implement
actions.
// Next example is about MouseListener, a way to let the user interact with mouse-clicks. // Go to MouseClickExample.java |
|
Applet Index (sorted alphabetically) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #s |
The Java Source (applets w/source code) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
New Article:
J2EE Deployment Specification
Why is it that J2EE
applications written in the same language, Java, may not coexist
on different servers? While the answer isn't simple Sun has set
out to alleviate these problems with the "J2EE Deployment
Specification".
... [more articles]
New Tutorial:
Designing Packages for Stability
Are your designs stable? This month Samudra will focus on the change impact relationship involved in designing classes showing us how to take them into account when designing the package relationship.
... [more Tutorials]
Year in Review:
The Best of 2002
The year 2002 saw 201 new applets posted to JavaBoutique.
Check out the 2 most popular apps from each month of 2002!
... [popular applets]
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
|
