글쓴이 :해 효 1998년 6월 12일 18:12:21
In Reply to: [답변] 윈도우 X 버튼 눌렀을 때 종료하기... posted by 이희정 on 1998년 6월 12일 14:06:38:
안녕하세요. 태훈님, 희정님. 감사드립니다...
하루 종일 고생하셨다니까, 감사 + 미안 이군요.
물론 상응하는 보답은 있지요.. ==> 감사**무한대
음..먼저 희정님께서 주신것은 에러가 나고
그 에러를 제가 못 잡아서 어떻게 하지를 못하겠고,
희정님께 질문은 제가 1.0버젼이라서 1.1대로
변경하셨다고 했는데, 구체적으로 어떤 부분인가요.
public boolean handlevent(Event e) {
if(e.id == Event.WINDOW_DESTROY)
System.exit(0);
return super.handleEvent(e);
}
public boolean action(Event evt, Object arg) {
if(arg.equals("cancel"))
System.exit(0);
else return false;
return true;
}
이 부분들 인가요...
그리고, 태훈님께는 제가 원하는것은 브라우저에서 Gui2.html 을
엔터했을때,하나의 프레임 창이뜨고, 그리고, 그 프레임 창안에
버튼이 하나 있어 그 버튼을 눌렀을때 프레임창이 닫히게
하는 그리고, 프레임창의 맨 오른쪽에 있는
x 를 눌렀을때 프레임창이 닫히는프로그램을 원하는거지요.
기왕이면 완전한 쏘쓰를 주셨으면 합니다.
중간부터 보니, 이해가 늦네요...
그리고, 또하나 모든분들깨 질문...
아래 쏘쓰는 브라우저에서 프레임창이 하나 로드되면서,
TextArea 와 Button 이 사이즈 준대로 나타나게 하는
p/g 인데 올바르게 나타나지가 않네요.
원래 나타나야될 모양은 이렇죠...
__________________ ______ _______________
| | | | | |
| | |_____| | |
| | _____ | |
| | | | | |
|_________________| |_____| |______________|
______ ______
| | | |
|_____| |_____|
근데 이렇게 안나타나죠...
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Gui2 extends java.applet.Applet implements ActionListener {
Frame window;
public void init() {
window = new MyFrame("A PopUp Window");
// window.resize(508, 367);
window.show();
}
class MyFrame extends Frame {
MyFrame(String title) {
super(title);
Panel p = new Panel();
p.resize(508, 367);
p.setLayout(new FlowLayout());
Button button2 = new Button("취 소");
button2.reshape(216, 120, 77, 34);
p.add(button2);
Button button3 = new java.awt.Button("확 인");
button3.reshape(60, 252, 100, 34);
p.add(button3);
TextArea textArea1 = new TextArea();
textArea1.reshape(324, 36, 360, 156);
p.add(textArea1);
TextArea textArea2 = new TextArea();
textArea2.reshape(36, 48, 156, 156);
p.add(textArea2);
Button button1 = new java.awt.Button("결 재");
button1.reshape(216, 60, 77, 34);
p.add(button1);
Button button4 = new java.awt.Button("닫 기");
button4.reshape(216, 252, 100, 34);
p.add(button4);
add("South", p);
}
}
public boolean handleEvent(Event evt) {
if(evt.id == Event.WINDOW_DESTROY)
System.exit(0);
return super.handleEvent(evt);
}
public boolean action(Event evt, Object arg) {
if(arg.equals("취 소"))
System.exit(0);
else return false;
return true;
}
}