tags:

views:

37

answers:

1

I have one panel which i am adding to dialog from some othere frame. But my problem is, i want to close the jdialog when user presses "Enter",

For Example,

from frame-1 i am calling and adding the panel which contains table to the dialog from this frame,

 /* Frame_1*/

JDialog jd = new JDialog();
jd.add(panel1);  // This panel comes from another java file Frame_2 which contains     JTable and retruns Panel

So i want is that when user press "Enter" i want this dialog to be disposed, but the focus goes to table, and the code for listeners is in Frame_2 for JTable. and i dont know how to do dispose in Frame_2 for JDialog ??

+1  A: 

And, as per the description, the table just informative.

If you remove the table, does the dialog close upon "Enter" already?

If so, try making the JTable read-only to avoid get the focus and you're done.

OscarRyz