KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > webdocwf > util > loader > wizard > CloseOctopusProjectAction


1 /*
2  * StopOctopusGeneratorAction.java. Created on Apr 23, 2004.
3  */

4 package org.webdocwf.util.loader.wizard;
5
6 import java.awt.Toolkit JavaDoc;
7 import java.awt.event.ActionEvent JavaDoc;
8
9 import javax.swing.AbstractAction JavaDoc;
10 import javax.swing.ImageIcon JavaDoc;
11 import javax.swing.JOptionPane JavaDoc;
12 import javax.swing.KeyStroke JavaDoc;
13
14 /**
15  *
16  *
17  * @author Zoran Milakovic
18  */

19 public class CloseOctopusProjectAction extends AbstractAction JavaDoc {
20
21
22     OctopusProjectFrame octopusProjectFrame;
23
24     /**
25      * This method stop the LoaderGenerator application
26      */

27     public CloseOctopusProjectAction(OctopusProjectFrame octopusProjectFrame, String JavaDoc label) {
28
29         this.octopusProjectFrame = octopusProjectFrame;
30         putValue(NAME, label);
31         putValue(
32             SMALL_ICON,
33             new ImageIcon JavaDoc(
34                 getClass().getClassLoader().getResource(
35                     "org/webdocwf/util/loader/" + "wizard/images/Stop.gif")));
36         putValue(SHORT_DESCRIPTION, "Close TDT project");
37         putValue(LONG_DESCRIPTION, "Close Together Data Transformer project");
38         putValue(
39             ACCELERATOR_KEY,
40             KeyStroke.getKeyStroke('E', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
41         putValue(MNEMONIC_KEY, new Integer JavaDoc('E'));
42     }
43
44     /**
45      * This method check if the action is performed (event key pressed)
46      * @param e is event
47      */

48     public void actionPerformed(ActionEvent JavaDoc e) {
49         if(
50             JOptionPane.showConfirmDialog(octopusProjectFrame, "Are you are sure want to close project?", "Close project", JOptionPane.INFORMATION_MESSAGE) == 0
51             )
52             {
53                 this.octopusProjectFrame.dispose();
54             }
55     }
56
57 }
58
Popular Tags