Topic: 窗口打开为何不能关闭 |
Print this page |
1.窗口打开为何不能关闭 | Copy to clipboard |
Posted by: 一枝梅 Posted on: 2005-06-13 12:02 import java.awt.*; public class ex10 extends Frame { static Frame frm=new Frame("Button class"); static Button btn=new Button("Push Me!!"); public static void main(String args[]) { frm.setLayout(null); btn.setBounds(45,65,100,40); frm.add(btn); frm.setVisible(true); } } |
2.Re:窗口打开为何不能关闭 [Re: 一枝梅] | Copy to clipboard |
Posted by: mesocool Posted on: 2005-06-13 12:18 JFrame 里有 setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); awt的Frame基本不用,不太清楚 |
3.Re:窗口打开为何不能关闭 [Re: 一枝梅] | Copy to clipboard |
Posted by: ysonic Posted on: 2005-06-13 13:32 Frame 要想关闭,需要addWindowsListener,其中一个函数 windowsclosing(WindowsEvent) {System.exit(0)} |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |