Modal JInternalFrame

Hi, I have an application, which has several JinternalFrames inside a JDesktopPane.How do you make a JDialog or JOptionPane poping from one of the internal frame to Modal that particular Frame nothing else.Thank you.
[244 byte] By [jgowdera] at [2007-10-1 6:05:10]
# 1
JOptionPane.showMessageDialog(Component arg0, Object arg1, String arg2, int arg3) throws HeadlessException
ossifya at 2007-7-9 14:22:21 > top of Java-index,Desktop,Core GUI APIs...
# 2
# showConfirmDialog: Asks a confirming question, like Yes/No/Cancel.# showInputDialog: Prompt for input.# showMessageDialog: Inform the user that something has happened.# showOptionDialog: A combination of the above three.
ossifya at 2007-7-9 14:22:21 > top of Java-index,Desktop,Core GUI APIs...
# 3
But the thing is , it freezes the entire frame till you click the Dialog, I just want to make it Modal for just that JInternalFrame !
jgowdera at 2007-7-9 14:22:21 > top of Java-index,Desktop,Core GUI APIs...
# 4
Maybe this can help you get some ideas: http://www.javaworld.com/javaworld/javatips/jw-javatip89.html
Torgila at 2007-7-9 14:22:21 > top of Java-index,Desktop,Core GUI APIs...
# 5

Hello!

Here is a basic idea (not complete)

You have your JDesktop where you put your inner frame.

You have a dummy glass panel to block the desktop.

Your glass panel is registred to your inner frame to block/unblock the desktop

public class MyPannel extends JDesktopPane

{

private JPanel main;

private DummyGlassPane glass;

private MyInternalFrame frame;

public MyPannel ()

{

....

frame.addInternalFrameListener(glass);

add(main, JLayeredPane.FRAME_CONTENT_LAYER, 1);

add(frame, JLayeredPane.POPUP_LAYER, 2);

public class DummyGlassPane extends JPanel implements InternalFrameListener

{

public DummyGlassPane()

{

this.setOpaque(false);

// block the desktop panel

addKeyListener(new KeyAdapter() { });

addMouseListener(new MouseAdapter() { });

super.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

}

public void internalFrameOpened(InternalFrameEvent e) {}

public void internalFrameClosed(InternalFrameEvent e) {}

public void internalFrameClosing(InternalFrameEvent e) {}

public void internalFrameIconified(InternalFrameEvent e) {}

public void internalFrameDeiconified(InternalFrameEvent e) {}

public void internalFrameActivated(InternalFrameEvent e)

{ // block the panel on inner frame popup

MyPannel.this.add(glass, JLayeredPane.MODAL_LAYER, 0);

}

public void internalFrameDeactivated(InternalFrameEvent e)

{ // unblock the panel on hidding the inner frame

MyPannel.this.remove(this);

}

}

}

Regards,

D.

D_Repa at 2007-7-9 14:22:21 > top of Java-index,Desktop,Core GUI APIs...