Java Code Examples for javax.swing.JFrame#EXIT_ON_CLOSE
The following examples show how to use
javax.swing.JFrame#EXIT_ON_CLOSE .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: osp File: ApplicationApplet.java License: GNU General Public License v3.0 | 6 votes |
private void disposeOwnedFrames() { Frame frame[] = Frame.getFrames(); for(int i = 0, n = frame.length; i<n; i++) { if(frame[i].getClass().getName().startsWith("sun.plugin")) { //$NON-NLS-1$ continue; // don't mess with plugin } if((frame[i] instanceof JFrame)&&((JFrame) frame[i]).getDefaultCloseOperation()==JFrame.EXIT_ON_CLOSE) { ((JFrame) frame[i]).setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); } if(!existingFrames.contains(frame[i])) { frame[i].setVisible(false); frame[i].dispose(); } } newFrames.clear(); }
Example 2
Source Project: osp File: OSPFrame.java License: GNU General Public License v3.0 | 5 votes |
/** * Overrides JFrame method. This converts EXIT_ON_CLOSE to DISPOSE_ON_CLOSE * and sets the wishesToExit flag. * * @param operation the operation */ public void setDefaultCloseOperation(int operation) { if((operation==JFrame.EXIT_ON_CLOSE)&&OSPRuntime.launchingInSingleVM) { operation = WindowConstants.DISPOSE_ON_CLOSE; wishesToExit = true; } try { super.setDefaultCloseOperation(operation); } catch(Exception ex) { // cannot set the default close operation for java applets frames in Java 1.6 } }
Example 3
Source Project: osp File: FrameApplet.java License: GNU General Public License v3.0 | 5 votes |
private void disposeOwnedFrames() { Frame frame[] = Frame.getFrames(); for(int i = 0, n = frame.length; i<n; i++) { if((frame[i] instanceof JFrame)&&((JFrame) frame[i]).getDefaultCloseOperation()==JFrame.EXIT_ON_CLOSE) { ((JFrame) frame[i]).setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); } if(!existingFrames.contains(frame[i])) { // remove any frames that have been created by this applet frame[i].setVisible(false); removeWindowListeners(frame[i]); frame[i].dispose(); } } }
Example 4
Source Project: osp File: DataTool.java License: GNU General Public License v3.0 | 5 votes |
/** * Overrides OSPFrame method. This converts EXIT_ON_CLOSE to * DO_NOTHING_ON_CLOSE and sets the exitOnClose flag. * * @param operation the operation */ public void setDefaultCloseOperation(int operation) { if((operation==JFrame.EXIT_ON_CLOSE)) { exitOnClose = true; operation = WindowConstants.DO_NOTHING_ON_CLOSE; } if((operation!=WindowConstants.DO_NOTHING_ON_CLOSE)) { saveChangesOnClose = false; } super.setDefaultCloseOperation(operation); }
Example 5
Source Project: Ngram-Graphs File: utils.java License: Apache License 2.0 | 4 votes |
@Override public void windowClosed(WindowEvent e) { if (JFrame.EXIT_ON_CLOSE > 0) System.exit(0); }
Example 6
Source Project: Ngram-Graphs File: utils.java License: Apache License 2.0 | 4 votes |
@Override public void windowClosed(WindowEvent e) { if (JFrame.EXIT_ON_CLOSE > 0) System.exit(0); }