SimpleFrame(LAB 2-1)
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
class SimpleFrame extends JFrame{
private static final int DEFAULT_WIDTH=400;
private static final int DEFAULT_HEIGHT=300;
public SimpleFrame(){
setTitle("Simple Frame");
setSize(DEFAULT_WIDTH,DEFAULT_HEIGHT);
}
public static void main(String[]args){
JFrame frame = new SimpleFrame();
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e ){
System.exit(0);
}
});
frame.setVisible(true);
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น