Recently because of homework, we need to use Java to do some drawing applications, and displayed on the Web page. So, I'm doing some demonstrations here. (There is a mistake, please forgive me)
First, you can have the IDE write the good one package first,
Here I put the required. class files into this package.
Note that in Java applet Chinese, I introduced this package import shapepage.j_circle;
, this is important, if this goes wrong, it will cause the run to fail, and in the graphics class above, I have to declare the package they belong to.
/** To change this template, choose Tools | Templates * and open the template in the editor. */Importshapepage.j_circle;Importjava.applet.*;Importjava.awt.*;/** * * @authorAdministrator*/ Public classJextendsApplet { Publicj_circle C; @Override Public voidinit () {setbackground (color.yellow); C=NewJ_circle (100,100,2); } @Override Public voidPaint (Graphics g) {c.paint (g); }}
Finally, use CMD.
Most run structure:
Java Simple applet app creation.