JFrame中包括好多个dialog,我现在做的是每次只能打开一个dialog,如何设置才能同时打开两个或者两个以上的dialog呢?
请高手指教

解决方案 »

  1.   

    楼主可以用MINI窗口。也就是JDeskTopPane。里面放的是JInternerFrame。可以在一个窗体中打开N个窗体,可以做到你想要打开几个就打开几个的
      

  2.   

    import java.awt.Color;
    import javax.swing.JDialog;public class Main {
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    JDialog d1 = new JDialog();
    d1.setSize(200, 200);
    d1.setLocation(0, 0);
    d1.getContentPane().setBackground(Color.BLACK);
    d1.setVisible(true);
    JDialog d2 = new JDialog();
    d2.setSize(200, 200);
    d2.setLocation(200, 0);
    d2.getContentPane().setBackground(Color.RED);
    d2.setVisible(true);
    JDialog d3 = new JDialog();
    d3.setSize(200, 200);
    d3.setLocation(0, 200);
    d3.getContentPane().setBackground(Color.GREEN);
    d3.setVisible(true);
    JDialog d4 = new JDialog();
    d4.setSize(200, 200);
    d4.setLocation(200, 200);
    d4.getContentPane().setBackground(Color.YELLOW);
    d4.setVisible(true);
    }
    }