±Û¾´ÀÌ :Sung Yi 2000³â 2¿ù 11ÀÏ 01:33:01
In Reply to: ¾ÖÇø´¿¡¼ ¾ÖÇø®ÄÉÀ̼ÇÀ» µ¿½Ã¿¡ »ç¿ëÇÑ°¡¿ä? posted by ÀÌÈ£¿¬ on 2000³â 2¿ù 11ÀÏ 01:03:42:
It is fairly simple.
Here is the story how it goes in a Java applet sequentially.
1. extends Applet
2. set frame
3. init();
3. start();
In Java application, stick above lines in the main() method.
Here is an example:
import java.applet.*;
import java.awt.*;
public class apple extends Applet{
Font font = new Font("Dialog", Font.BOLD, 20);
String str = "Applet/Application";
public void init() {
super.init();
}
public static void main(java.lang.String[] args) {
apple applet = new apple();
java.awt.Frame frame = new java.awt.Frame("Applet");
frame.add("Center", applet);
frame.setSize(350, 250);
frame.show();
applet.init();
applet.start();
}
public void paint(Graphics g) {
g.setFont(font);
g.setColor(Color.black);
g.drawString(str, 5, 50);
}
}
This program should run inside the browser or as a stand alone program.