import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
public class Test extends Applet
{
/**
*
*/
private static final long serialVersionUID = -6059738190801891376L;
class Point
{
public int x, y;
}
Point p1, p2;
public void start()
{
p1 = new Point();
p1.x = p1.y = 0;
p2 = new Point();
p2.x = p2.y = 100;
}
public void paint(Graphics g)
{
g.setColor(Color.red);
g.drawLine(p1.x, p1.y, p2.x, p2.y);
}
}
② 鎬庝箞缂栧啓涓涓绠鍗旿ava搴旂敤绋嬪簭锛岃緭鍑鸿嚜宸辩殑濮撳悕鍜屽﹀彿锛
涓嬮潰鏄涓涓猨ava 灏忕▼搴忓疄鐜扮殑x0dx0aimport java.awt.*;//寮曞叆鍖匼x0dx0aimport java.applet.Applet;//寮曞叆鍖匼x0dx0apublic class Output extends Applet//瀹氫箟绫籠x0dx0a{x0dx0a //瀹氫箟鍙橀噺x0dx0a private String name;x0dx0a private int num;x0dx0a //鍒濆嬪寲x0dx0a public void init()x0dx0a {x0dx0a name = getParameter("vname");x0dx0a num = Integer.parseInt(getParameter("vnum"));x0dx0a }x0dx0a //杈撳嚭x0dx0a public void paint(Graphics g)x0dx0a {x0dx0a g.drawString ("濮撳悕锛"+name+"锛涘﹀彿锛"+num,20,30);x0dx0a }x0dx0a}x0dx0ax0dx0a鐩稿簲鐨刪tml鏂囦欢x0dx0ax0dx0ax0dx0ax0dx0ax0dx0ax0dx0a