aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 39537
    
  27
You haven't added the applet as an action listener to the 3 buttons, hence the actionPerformed method is never called.


Ping & DNS - updated with new look and Ping home screen widget
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: 39537
    
  27
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
 
Similar Threads
Troubles with ActionListener and event driven program
method not abstract
can't see the background color of a frame , why?
. . .not abstract and doesnt overide abstract method actionPerfomed
Applet BackGround