import javax.swing.*;
import java.awt.*;
import java.awt.event.*;class MyDialog extends JDialog{
JLabel label;
MyDialog(JFrame f,String s){
super(f,s);
label=new JLabel("哈哈!!");
setSize(90,90);
setModal(true);
getContentPane().setLayout(new FlowLayout());
getContentPane().add(label);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
}class MyFrame extends JFrame implements ActionListener{
JButton button;
MyDialog dialog;
MyFrame(){
setSize(400,300);
getContentPane().setLayout(new FlowLayout());
button=new JButton("确定");
dialog=new MyDialog(此处,"对话框");
getContentPane().add(button);
button.addActionListener(this);
setVisible(true);
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==button){
dialog.setVisible(true);
}
}
}public class Dd{
public static void main(String args[]){
new MyFrame();
}
}
//文中"此处"应该如何填写?望达人指教!