JAVA之GUI编程窗体事件

package GUI;

import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class studyFrame {
public static void main(String[] args) {
Frame f=new Frame();
f.setTitle("WINDOW----BY VON");
f.setSize(500,400);
f.setLocation(300,200);
f.setVisible(true);
f.setLayout(new FlowLayout());
f.addWindowListener(new MyWin());
Button b=new Button("I am a button");
f.add(b);
}
//public void windowClosing(WindowEvent e){
// System.exit(0);
//}
}
class MyWin extends WindowAdapter{
public void windowClosing(WindowEvent e){
System.exit(0);
}
}

JAVA之GUI编程窗体事件,布布扣,bubuko.com

JAVA之GUI编程窗体事件

上一篇:在 Windows 上搭建基于Android Studio 3.2 的 Flutter 开发环境


下一篇:安卓环境安装:ADK,ADB