如何从jinternalframe调用jdialog

时间:2010-11-29 11:40:20

标签: java swing

有人可以告诉我如何从JInternalframe调用JDialog吗?

public class BSJFrameUpdateOnlineTrdDlg extends JInternalFrame {

public BSJFrameUpdateOnlineTrdDlg(JDesktopPane jdesk) { //constructor
    super("Backoffice Synchronization");
     jdeskTop = jdesk;
     frame = this;
    try {

      jbInit();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
    setLocation(400, 200);
    setVisible(true);
    setSize(720, 570);

  }
private void jbInit() throws Exception {
//.......
 jButton1.addActionListener(new jButton1_upload_action());
this.getContentPane().add(jButton1, null);

}

 class jButton1_upload_action implements ActionListener{
    public void actionPerformed(ActionEvent e) {
 displayDialog(frame,marketStatus);
}}

 public void displayDialog(JInternalFrame frame,String status){
     JDialog jdg = new JDialog();
     //this is where the JDIalog get initiated

}
}

这就是我现在所拥有的。我只插入了最重要的代码行。

2 个答案:

答案 0 :(得分:1)

看起来你已经打电话了吗?你只是想让它变得可见吗?


public void displayDialog(JInternalFrame frame,String status){
     JDialog jdg = new JDialog();
     //...add the guts of the dialog
     jdg.setVisible(true);
}


答案 1 :(得分:1)

试试这段代码

 new customer_registration(null, true).setVisible(true);

customer_registration是另一个jdialog