就是我写的程序弹不出那个小窗体。。。
public class JF1 extends JDialog implements ActionListener{
public JF1() {
Container c=getContentPane();
this.add(new JLabel("小窗体-标签"));
this.setBounds(100, 100, 100, 100);
}
public static void main(String[] args) {
JFrame jf=new JFrame("这是一个窗体");
jf.setVisible(true);
jf.setBounds(300, 200, 200, 200);
JButton jb=new JButton("窗体弹出按钮");
jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Container c=jf.getContentPane();
c.setLayout(new FlowLayout());
c.add(jb);
jb.setActionCommand("ooo");
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals("ooo")) {
JF1 j=new JF1();
j.setVisible(true);
}
}
}