Import Java.awt.graphics;import Java.applet.applet;public class C4_1 extends applet{int a=5; Double b=23.4; public void Paint (Graphics g) {g.drawstring ("a=" +a,25,25); g.DrawString ("b=" +b,25,65); }}**//<applet Code=c4_1.class width=200 height=200></applet>**
The results are as follows:
650) this.width=650; "src=" http://img.blog.csdn.net/20150724020233158 "alt=" here write a picture describing "title=" "/>
Since the applet does not implement the main () method, in order to see the results of the applet running, it is necessary to write an HTML file for it and embed the following code in the middle
<applet Code=c4_1.class width=200 height=200></applet>12
Note: To insert!!!!!!! as a comment
Operation Steps in DOS window:
First, enter Javac C4_1.java
Second, enter Appletview C4_1.java
Third, no third!
Notes:
g.DrawString ("b=" +b,25,65), where 25 represents the x-coordinate and 65 represents the y-coordinate
<applet Code=c4_1.class width=200 height=200></applet>1
Where width stands for the window's height, and height stands for the window.
This article is from the "Sanghaidan blog column" blog, please be sure to keep this source http://10602803.blog.51cto.com/10592803/1683070
Applet viewer usage. java