2010-11-29 3 views
3

Может кто-нибудь сказать мне, как вызвать JDialog из JInternalframe?Как вызвать jdialog из jinternalframe

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 

} 
} 

Это то, что я сейчас имею. Я вставил только самые важные строки кода.

+1

Так что это ваша проблема? У вас есть код для создания диалога, но у вас нет кода для его отображения. – camickr 2010-11-29 16:23:25

ответ

1

Похоже, что вы уже называете это? Вы просто пытаетесь сделать его видимым?

 

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

 
+0

opps .. теперь я получил смысл. В моем коде у меня был setVisible (true), а не jdg.setVisible (true). Я изменил его. Теперь он работает нормально. Раньше он не появлялся. Спасибо приятель – nath 2010-11-30 02:54:11

1

попробуйте этот код

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

customer_registration является еще JDialog

Смежные вопросы