List of usage examples for java.awt Frame setEnabled
public void setEnabled(boolean b)
From source file:ModalFrameUtil.java
public static void showAsModal(final Frame frame, final Frame owner) { frame.addWindowListener(new WindowAdapter() { public void windowOpened(WindowEvent e) { owner.setEnabled(false); }/*from w w w . ja v a 2 s . c o m*/ public void windowClosing(WindowEvent e) { owner.setEnabled(true); frame.removeWindowListener(this); } public void windowClosed(WindowEvent e) { owner.setEnabled(true); frame.removeWindowListener(this); } }); owner.addWindowListener(new WindowAdapter() { public void windowActivated(WindowEvent e) { if (frame.isShowing()) { frame.setExtendedState(JFrame.NORMAL); frame.toFront(); } else { owner.removeWindowListener(this); } } }); frame.setVisible(true); try { new EventPump(frame).start(); } catch (Throwable throwable) { throw new RuntimeException(throwable); } }