±Û¾´ÀÌ :HaeHyo 1998³â 6¿ù 18ÀÏ 09:23:46
In Reply to: ÇØÈ¿´Ô... ¼Ò½º´Â¿ä... posted by ÀÌÈñÁ¤ on 1998³â 6¿ù 18ÀÏ 08:41:35:
¿À ÀÌ·± Á¤½ÅÀÌ ¾ø±º¿ä.
¾Æ·¡ ½î¾²°¡ ÀÖ½À´Ï´Ù.
°æ±¸´ÔÀÌ ÁֽŰͿ¡´Ù Á¦°¡ Á¶±Ý »ìÀ» ºÙ¿´Áö¿ä.
setLayout(null); ¿Í setBounds(int x, int y, int width, int height)¸¦
»ç¿ëÇϴ°ɷΠ¾Ë°í Àִµ¥, Á¦ ½î¾²¿¡¼ ¹º°¡°¡ ºüÁø ¸ð¾çÀÔ´Ï´Ù.
Çѹø ºÁ ÁÖ¼¼¿ä.
±×¸®°í, ¾Æ·¡ URLÀº À̺¥Æ® Çڵ鸵 1.1 »õ·Î¿ÍÁø ºÎºÐµé
Âü°íÇÒ¼ö ÀÖ´Â »çÀÌÆ®ÀÔ´Ï´Ù. ÀÌ¹Ì ¾Ë°í °è½Ã°ÚÁö¸¸,
¸Ç³¯ µµ¿ò¸¸ ¹Þ´Â °Í °°¾Æ¼.... ÁÁÀº ÇÏ·ç...
** How to Convert Programs to the 1.1 AWT API
http://www.javasoft.com/products/jdk/1.1/docs/guide/awt/DeprecatedMethods.html#table
http://www.javasoft.com/products/jdk/1.1/docs/guide/awt/HowToUpgrade.html#events
************************ Source *****************
import java.awt.*;
import java.awt.event.*;
public class Gui7 extends java.applet.Applet {
Frame window;
public void start() {
window = new MyFrame("A PopUp Window");
window.setSize(500, 400);
window.setVisible(true);
}
public void stop() {
if (window!=null)
window.dispose();
}
}
class MyFrame extends Frame
implements ActionListener {
MyFrame(String title) {
super(title);
Panel p = new Panel();
p.setSize(500, 400);
// p.setLayout(new FlowLayout());
Button button1= new Button("³ª");
button1.setBounds(250, 50, 50, 30);
// button1.addActionListener(this);
p.add(button1);
Button button2= new Button("³Ê");
button2.setBounds(250, 100, 50, 30);
// button2.addActionListener(this);
p.add(button2);
Button button3= new Button("¿ì ¸®");
button3.setBounds(100, 300, 50, 30);
// button3.addActionListener(this);
p.add(button3);
Button button4= new Button("´Ý ±â");
button4.setBounds(300, 300, 50, 30);
button4.addActionListener(this);
p.add(button4);
TextArea textArea1 = new TextArea();
textArea1.setBounds(50, 50, 150, 200);
p.add(textArea1);
TextArea textArea2 = new TextArea();
textArea2.setBounds(50, 50, 150, 200);
p.add(textArea2);
// ----> public void setBounds(int x, int y, int width, int height)
p.setLayout(null);
add(p);
// p.add(new Label("This is a Window",Label.CENTER));
addWindowListener(
new WindowAdapter() { // anonymous local class
public void windowClosing(WindowEvent we) {
setVisible(false);
dispose();
}
}
);
}
// button action handler
public void actionPerformed(ActionEvent action) {
Object source=action.getSource();
if (source instanceof Button
&& action.getActionCommand().equals("´Ý ±â"))
{
setVisible(false);
dispose();
}
}
}