package wo;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Ex4{
/**
* @param args
*/
JFrame myframe;
JLabel lab;
JDialog sub;
public Ex4(){
myframe=new JFrame("JFrame演示窗口");
lab=new JLabel("世界,你好");
sub=new JDialog(myframe,"我是对话框",true);
sub.getContentPane().setLayout(new FlowLayout());
sub.getContentPane().add(lab);
myframe.getContentPane().setLayout(new FlowLayout());
//myframe.getContentPane().add(lab);
myframe.setSize(300,300);
myframe.setVisible(true);
myframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
sub.setSize(200,200);
sub.setVisible(true);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new Ex4();
}
}