public class Modal
{
public static void main(String args[])
{
final JFrame frame = new JFrame("Main");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JDesktopPane desktop = new JDesktopPane();
ActionListener showModal =
new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
// Construct a message internal frame popup
JInternalFrame iFrame =
new ModalFrame("Really Modal",frame.getRootPane(), desktop);
iFrame.setVisible(true);
}
};
JInternalFrame internal =
new JInternalFrame("Open",true,true,true,true);
desktop.add(internal);
JButton button = new JButton("Open");
button.addActionListener(showModal);