New Member FAQ | Forums | Earn Revenue


Resources Entrance Ask Experts Exam Papers Jobs English Projects Universities Colleges Courses Schools Training My India



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter



Resources » Articles/Knowledge Sharing » Education »

Program to Handle Java Button class


Posted Date: 09 Dec 2008    Resource Type: Articles/Knowledge Sharing    Category: Education
Author: uday kiranMember Level: Silver    
Rating: 3 out of 53 out of 53 out of 5Points: 2



/*Program for Handling Buttons*/

Aim: We will handle the Button Class provided by the java.awt package and the operations on Buttons



import java.awt.*;
import java.awt.event.*;

public class HandlingButtons extends Frame implements ActionListener
{
Button b1 = new Button("Hide");
Button b2 = new Button("Exit");
Label l = new Label();
public HandlingButtons()
{
super("Handling Buttons");
setSize(500,700);
setLayout(new FlowLayout());
add(b1);
add(b2);
add(l);
b1.addActionListener(this);
b2.addActionListener(this);
setVisible(true);
}
public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == b1)
{
String label = b1.getLabel();
if(label.equals("Hide"))
{
b1.setLabel("Show");
b2.setVisible(false);
l.setText("you Clicked Hide Button");
}
else
{
b1.setLabel("Hide");
b2.setVisible(true);
l.setText("you Clicked Show Button");
}
}
else
{
System.exit(0);
}
}

public static void main(String args[])
{
new HandlingButtons();
}
}



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Java Programs  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: IAS Preliminary Exam Syllabus for Zoology
Previous Resource: Program for Handling Java Label class
Return to Discussion Resource Index
Post New Resource
Category: Education


Post resources and earn money!
 
More Resources



Advertise Here





Contact Us   Advertise   Editors    Privacy Policy    Terms Of Use   

ISC Technologies.
2006 - 2009 All Rights Reserved.