class Testprog3{
public static void output()
{
System.out.println(" Printout");
}
public static void main (String[] args)
{
int i;
output();
for(i=0;i<=10;i++)
{
System.out.println (i);
}
}
}
This can be accessed and downloaded at this
link.
import java.applet.Applet;
import java.awt.*;
import java.io.*;
import java.util.*;
import java.awt.event.*;
public class Example2
extends Applet
implements MouseListener
{
TextField t;
public void init()
{
System.out.println("hello");
t = new TextField("Hi There");
add(t);
addMouseListener(this);
}
public void mousePressed (MouseEvent e)
{
int x = e.getX();
int y = e.getY();
Graphics g = getGraphics();
g.fillOval(x,y,10,10);
}
public void mouseReleased(MouseEvent e)
{}
public void mouseEntered(MouseEvent e)
{}
public void mouseExited(MouseEvent e)
{}
public void mouseClicked(MouseEvent e)
{}
}
This can be accessed and downloaded at this
link.
It can be viewed at this
link with a browser that supports Java 1.1.
import java.applet.Applet;
import java.awt.*;
import java.io.*;
import java.util.*;
import java.awt.event.*;
public class Example5
extends Applet
implements MouseMotionListener
{
TextField t;
public void init()
{
System.out.println("hello");
t = new TextField("Hi There");
add(t);
addMouseMotionListener(this);
}
public void mouseDragged(MouseEvent e)
{
int x = e.getX();
int y = e.getY();
Graphics g = getGraphics();
g.fillOval(x,y,10,10);
}
public void mouseMoved(MouseEvent e)
{}
}
This can be accessed and downloaded at this
link.
It can be viewed at this
link with a browser that supports Java 1.1.
This page is maintained by Dennis C. Smolarski, S.J.
dsmolarski@math.scu.edu
© Copyright 1998, 2006, Dennis C. Smolarski, SJ, All rights reserved.
Last changed: 24 January 2006.