This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Applets and the fly likes Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Applets
Bookmark "Error" Watch "Error" New topic


sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1240
when i run below code applet started.
after i click any of the button nothing print to the console.
why is that?

package aruna;

import java.applet.*;
import java.awt.Button;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class MyApplet extends Applet implements ActionListener{

private Button Send;
private Button Exit;
private Button Clear;

public MyApplet()


public void init()
Send=new Button("Send");
Exit=new Button("Exit");
Clear=new Button("Clear");


public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub


}else if(e.getSource()==Exit){

}else if(e.getSource()==Clear){


Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10744


Please use

You have not registered the buttons as the event source with the Applet.
Just curious. Why are you using Applet instead of JApplet?

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Error
It's not a secret anymore!