//Write a program to demonstrate the use of ActionListner.
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
/*<applet code=buttontest height=200 width=200>
</applet>
*/
public class buttontest extends Applet{
Label lb1=new Label (“Button 1”);
Button b1=new Button (“ok”);
Label lb2=new Label (“Button 2”);
Button b2=new Button (“Cancel”);
public void init(){
setLayout(new FlowLayout());
b1.addActionListener(new B1());
b2.addActionListener(new B2());
add(lb1);
add(b1);
add(lb2);
add(b2);
}
class B1 implements ActionListener{
public void actionPerformed(ActionEvent e){
getAppletContext().showStatus(“Button1: ok clicked”);
}
}
class B2 implements ActionListener{
public void actionPerformed(ActionEvent e){
getAppletContext().showStatus(“Button2: cancel clicked”);
}
}
}
SiteMap
|
Link Us
...Language...
English
French
German
Hindi
Italian
Russian
Japanese
Chinese
Home
|
About Us
|
Portfolio
|
Services
|
Courses
|
Career
|
Cost
|
Contact Us
Services
SEO
Link Building
Data Entry
Web Design and development
Web Application development
Graphic and multimedia
E-Commerce Solutions
Software development
Web Marketing & Promoting
Internet Marketing
IT Outsourcing
Multimedia/CD Presentation
Synopsis Ideas
Project Ideas
Placement Papers
Live Project Training
Programming & Projects
Faq
Training @balujalabs
Method
To demonstrate the use of action listener.
1
To demonstrate key press event.
2
To demonstrate action listener event.
3
To demonstrate action listener event
4
To demonstrate Item listener event.
5
To create a calculator using event handling.
6
To demonstrate the use of action listener.
7
To demonstrate the mouse handling event.