Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the code inside the public void
actionPerformed(ActionEvent ae) override method in Applet
[ Condition:- you have one TextField and One Button , you
have to enter any color name inside the TextField, when you
click on Button Your background will change according to
your input color name]

Answer Posted / sriharsha gowda

public void actionPerformed(ActionEvent ae)
{
String str=ae.getActionCommand();

if(ae.getSource()==b1) setBackground(Color.yellow);
if(ae.getSource()==b2) setBackground(Color.blue);
if(ae.getSource()==b3) setBackground(Color.pink);
}
The above code can be used whenever we have different buttons and when any button is clicked its color changes accordingly

Is This Answer Correct ?    8 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you use parseint in java?

982


What is nextint java?

1066


What is the purpose of garbage collection in java? When is it used?

1048


which one is more efficient int x; 1. if(x==null) 2.if(null==x) state which one either 1 or 2?

11210


Difference between a process and a program?

1116


Is array a class in java?

981


What are the advantages of inner classes?

1031


Why scanner is used in java?

1074


What are the three best choices for a development environment?

1118


What are wrapper classes in java?

1073


What value is a variable of the string type automatically initialized?

1114


In a container there are 5 components. I want to display the all the components names, how will you do that one?

1044


Is it compulsory for a try block to be followed by a catch block in java for exception handling?

1014


Differentiate between overriding and overloading cases?

1106


What is the multi-catch block in java?

1040