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

Why do we override tostring method in java?

942


What is immutable state?

994


Can we call a non-static method from inside a static method?

985


When is update method called?

1132


What is primitive data type in java?

952


What is comparable and comparator interface? List their differences

1081


What are some examples of variable costs?

931


I want to re-reach and use an object once it has been garbage collected. Define how it’s possible?

999


Does java support multiple inheritance or not?

1080


What is boolean logic?

1001


Is boolean a wrapper class in java?

1040


What java ide should I use?

975


what is thread? What are the high-level thread states? Or what are the states associated in the thread? : Java thread

975


Can a class have multiple constructors?

1009


What are the differences between stringbuffer and stringbuilder?

1039