// Trying to 1) create a modal dialog 2) launch a dialog from that
modal
// dialog 3) modify the original modal dialog based on an event on the
new
// dialog ... the new dialog however freezes, if the first dialog is
NOT modal
// then this code works as I'm intending... BUT I need the first dialog
to be
// modal... any ideas?
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class DialogTest extends JDialog implements ActionListener {
JTextArea t=new JTextArea("This is some text.");
JButton b=new JButton("Open New Dialog");
/** Creates a new instance of DialogTest */
public DialogTest() {
b.addActionListener(this);
getContentPane().setLayout(new FlowLayout());
getContentPane().add(t);
getContentPane().add(b);
setSize(100,100);
}
public static void main(String[] args)
{
DialogTest t=new DialogTest();
// REMOVE setModal(true) and this code works...
t.setModal(true);
t.show();
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==b)
{
// launch another dialog that attempts to modify the original dialog
JDialog jd=new JDialog();
JButton jb=new JButton("Change Text Area");
jb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev)
{
t.setText("Text Changed");
}
});
jd.getContentPane().add(jb);
jd.setSize(200,75);
jd.show();
}
}
}
Andrei Kouznetsov - 15 Dec 2004 10:04 GMT
JDialog jd=new JDialog(this);
the new dioalog shold have your modal dialog as owner

Signature
Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities