wood burning stoves 2.0*
The moose likes Applets and the fly likes cant change background color of applet with button click Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "cant change background color of applet with button click" Watch "cant change background color of applet with button click" New topic
Author

cant change background color of applet with button click

Ben Hultin
Ranch Hand

Joined: Aug 17, 2009
Posts: 135
I am working on an assignment to create an applet where I need to change the background color of the applet with some button clicks


I am not getting any errors in eclipse so far, here is my code:



I appreciate the help
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41839
    
  63
You haven't added the applet as an action listener to the 3 buttons, hence the actionPerformed method is never called.


Ping & DNS - my free Android networking tools app
Ben Hultin
Ranch Hand

Joined: Aug 17, 2009
Posts: 135
so would that be something like this?

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41839
    
  63
You shouldn't create a new instance of the applet class; it'd be like:

red.addActionListener(this);
green.addActionListener(this);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cant change background color of applet with button click