Source code: jreversepro/gui/ConfirmCloseDialog.java
1 /*
2 * @(#)ConfirmCloseDialog.java
3 *
4 * JReversePro - Java Decompiler / Disassembler.
5 * Copyright (C) 2000 Karthik Kumar.
6 * EMail: akarthikkumar@hotmail.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it , under the terms of the GNU General Public License as published
10 * by the Free Software Foundation; either version 2 of the License,
11 * or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 * See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program.If not, write to
19 * The Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
22 */
23 /*
24 * ConfirmCloseDialog : Appears if the user wants to close the dialog.
25 *
26 */
27 package jreversepro.gui;
28
29 import javax.swing.JFrame;
30 import javax.swing.JOptionPane;
31
32 /**
33 * ConfirmCloseDialog is te dialog that appears at the end of
34 * application when the user prompts to close the application.
35 * @author Karthik Kumar
36 * @version 1.3
37 **/
38 public final class ConfirmCloseDialog {
39
40 /**
41 * Prompts the user if (s)he would exit the application.
42 * @param aAppFrame Application Frame.
43 * @return true, if the user chooses to close the app.
44 * false, otherwise.
45 **/
46 public static boolean confirmExit(JFrame aAppFrame ) {
47 int OptionSelect = JOptionPane.showConfirmDialog(
48 aAppFrame ,
49 "Are you sure you want to exit ?",
50 "Confirm Exit",
51 JOptionPane.YES_NO_CANCEL_OPTION ,
52 JOptionPane.WARNING_MESSAGE );
53 if ( OptionSelect == JOptionPane.YES_OPTION ) {
54 return true;
55 }
56 else {
57 return false;
58 }
59 }
60 }