KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * ShowHelpAction.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 ShowHelpAction extends AbstractAction JavaDoc {
20
21                 /**
22                  * Action which creates new help frame
23                  */

24                 public ShowHelpAction() {
25                     putValue(NAME, "Help");
26                     putValue(
27                         SMALL_ICON,
28                         new ImageIcon JavaDoc(
29                             getClass().getClassLoader().getResource(
30                                 "org/webdocwf/util/loader/" + "wizard/images/Help16.gif")));
31                     putValue(SHORT_DESCRIPTION, "Help for running the program");
32                     putValue(LONG_DESCRIPTION, "Help for running the program");
33                     putValue(
34                         ACCELERATOR_KEY,
35                         KeyStroke.getKeyStroke(
36                             'H',
37                             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
38                     putValue(MNEMONIC_KEY, new Integer JavaDoc('H'));
39                 }
40
41                 /**
42                  * Creating event for new windows help frame
43                  * @param e is creating events
44                  */

45                 public void actionPerformed(ActionEvent JavaDoc e) {
46                     try {
47                         OctopusGeneratorHelpFrame helpFrame = new OctopusGeneratorHelpFrame();
48                         helpFrame.setIconImage(
49                             new ImageIcon JavaDoc(
50                                 getClass().getClassLoader().getResource(
51                                     "org/webdocwf/util/loader/" + "wizard/images/Enhydra16.gif"))
52                                 .getImage());
53                         helpFrame.setVisible(true);
54                     } catch (Exception JavaDoc ex) {
55                         String JavaDoc message = "Error while creating Help button : " + ex.getMessage();
56                         JOptionPane.showMessageDialog(null, message + "\n", "Error", 0);
57                         System.exit(0);
58                     }
59                 }
60             
61 }
62
Popular Tags