Would you like to react to this message? Create an account in a few clicks or log in to continue.

add Applet Frame

Go down

 add  Applet  Frame Empty add Applet Frame

ตั้งหัวข้อ  Admin Tue May 27, 2008 2:41 pm

Applet ʴ ʴ (ͺѺǹٹ)


// HelloApplet.java

package addAppletToFrame;

import java.applet.Applet;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;

public class HelloApplet extends Applet {

public void init() {
setFont(new Font("Microsoft Sans Serif", Font.PLAIN,16));
setForeground(Color.red);
}

public void paint(Graphics g) {
for(int a=0;a<100;a+=20)
g.drawString("ʴդѺ", 10, a);
}
}




// HelloApp.java =>
HelloApplet.java

package addAppletToFrame;

import java.applet.Applet;

public class HelloApp {

public static void main(String[] args) {

Applet app = new HelloApplet();
java.awt.Frame fr = new java.awt.Frame();

fr.add(app);
fr.setSize(100,300); // Ҵ
fr.setVisible(true); // ʴ

}

}

Admin
Admin
Admin

จำนวนข้อความ : 112
Registration date : 18/05/2008

http://chawban.chocoforum.com

ขึ้นไปข้างบน Go down

ขึ้นไปข้างบน

- Similar topics

 
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ