1) we will be creating an applet, which needs a webpage, which TextPad creates for us (you'll see)
2) we will be doing some "import" statements. This means we will be bringing in some pre-defined classes from other parts of JAVA
3) we will use those pre-defined classes to create objects
4) we will "instantiate" those objects by naming them
OK, let's get right to the program; here it is:
import java.applet.*;
import java.awt.Graphics;
public class FirstFor extends Applet
{
public void paint( Graphics g )
{
for (int i=1; i < 100; i++)
g.drawLine( 10, 10, 250, 10 + i * 10 );
} //end for loop
}//end paint
}//end class FirstFor
}//end class FirstFor
Save it, properly name it, then compile it
Then, run this applet by hitting Ctrl + 3, then clicking OK
Alrighty then, now for the explanation...
Cheers,
Uncle Paulie

No comments:
Post a Comment