Applet viewer usage. java

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.