Professor Kit Romano's Web Site

 



Site Index

About Me

Welcome
Definition of Program
Variable Types
Understanding Memory
Declaring Variables
Simple Commands
Concatenation and Strings
Sleep-Threads-Try Catch
Campus Scenes
Pictures
Java simplified
Application Shell Styles
Reading Data From File
Overview of Applets
Excellent Graphics Applet
Online Reference
Nested if statements
Arrays
Sorting Arrays
Using Strings
Functions
Top 20 Replies 
First program 211
Important Class Example
JAVA in SDK Environment
Understanding OOP
OOP simple example
Recursion example
Example of Inheritance
     and use of JTextArea



*** Web Related **********
Build Student Web Page ?
What is FTP
Download WS ftp95
Download Java Plug In
Applets from jbuilder to sdk
Practice Problems

 

Programming Examples

 

 

                                                

// the setXORMode command allows you to achieve animation on a specific
 // object
// without the system redrawing the entire screen -- the repaint() command used 
// in Applet4
// will redraw the entire screen each time it is executed (lmore flicker )
// in the output)
import java.awt.*; 
import javax.swing.*; 
public class Applet13 extends JApplet
{
Thread t = new Thread();;
int a;
public void paint(Graphics g)
{
g.setColor(Color.blue);
g.setXORMode(Color.white);
for(a=1;a<400;a=a+1)
{
g.fillOval(a,a,10+a,10+a); // draw an image
try{t.sleep(45);} catch(Exception e){} // pause long enough to see the image
g.fillOval(a,a,10+a,10+a); // draw same image again
// because of the setZORMode
// command the pixels of the same
// color and position will cancel
// each other and the white (background)
// is what appears -- hense the image disappears



}

}