Java Tutorial

/* <applet code=\"SimpleClick\" height=100 width=400> </applet> */

import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
import java.applet.Applet;
import java.awt.Graphics;

public class SimpleClick extends Applet implements MouseListener {

    StringBuffer buffer;

    public void init() {
    buffer = new StringBuffer();
        addItem(\"initializing... \");

    public void start() {
        addItem(\"starting... \");

    public void stop() {
        addItem(\"stopping... \");

    public void destroy() {
        addItem(\"preparing for unloading...\");

    void addItem(String newWord) {

    public void paint(Graphics g) {
    //Draw a Rectangle around the applet\'s display area.
        g.drawRect(0, 0, 
           getSize().width - 1,
           getSize().height - 1);

    //Draw the current string inside the rectangle.
        g.drawString(buffer.toString(), 5, 15);

    //The following empty methods can be removed
    //by implementing a MouseAdapter (usually done
    //using an inner class).
    public void mouseEntered(MouseEvent event) {
    public void mouseExited(MouseEvent event) {
    public void mousePressed(MouseEvent event) {
    public void mouseReleased(MouseEvent event) {

    public void mouseClicked(MouseEvent event) {
    addItem(\"click!... \");

    Related Post:
  1. Program to show the use of Logical AND Operator (&) in If Statements

  2. An applet program that concatenates two string entered in TextField

  3. Program that accepts a shopping list of items from the command line and stores them in a vector. Also provide facility to perform operation

  4. An applet program showing Clicked Event on canvas

  5. Corba program of Count Client Applet, IDL,Server, Client

  6. Program to show the use of Logical or Boolean Negation i.e. NOT (!)

  7. Program to compute the sum of the digits of a given integer number. eg: I/o=4 then O/p=4+3+2+1=10

  8. program which takes a long sentence from the client passes to the server,server separates out each word and sends them back to client in reverse order

  9. Develop a CORBA based application for addition of two complex numbers and displaying the result on client side

  10. Pass the marks of 10 students from the client side design a servlet, which takes these marks and returns the number of students who obtained first cls

  11. An applet program to draw circle in center of the canvas

  12. Develop a game application in CORBA for which the player will guess a number between 1 to 100, which will be compared to the random number generated b

  13. Program to reverse the number eg given no : - 12345, output want :- 54321

  14. Program to check the start and end of a String

  15. An applet of displaying simple moving banner

  16. Program of bubble sort

  17. Program of FTP client and server

  18. RMI application for counting factorial of a given number.

  19. Program to show the use of Bitwise Operator (&) AND

  20. Program to show the use of Comparison operator (==) for comparing Strings

Didn't find what you were looking for? Find more on An applet program showing Clicked Event on canvas