UseWindow2(LAB7)
import javax.swing.*;
import java.awt.*;
public class UseWindow2{
public static void main(String[]args){
JWindow win=new JWindow();
win.setSize(300,150);
Container c=win.getContentPane();
c.setLayout(new FlowLayout());
c.add(new JLabel("Select Button"));
c.add(new JButton("OK"));
win.show();
try{
Thread.sleep(4000);
win.dispose();
Thread.sleep(4000);
c.add(new JLabel("After Dispose"));
win.show();
}catch(Exception e){System.out.println(e.getMessage());}
System.out.println("Hello World!");
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น