KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Accelerator


1
2 import org.swixml.SwingEngine;
3
4 import javax.swing.*;
5 import java.awt.event.ActionEvent JavaDoc;
6
7 /**
8  * The Accelerator shows in the usage of accelerators.
9  *
10  * @author <a HREF="mailto:wolf@paulus.com">Wolf Paulus</a>
11  * @version $Revision: 1.1 $
12  *
13  * @since swixml (#101)
14  */

15 public class Accelerator {
16   private static final String JavaDoc DESCRIPTOR = "xml/accelerator.xml";
17   SwingEngine swix = new SwingEngine( this );
18
19   public Accelerator() throws Exception JavaDoc {
20     swix.render( Accelerator.DESCRIPTOR ).setVisible( true );
21   }
22
23   public Action newAction = new AbstractAction() {
24     public void actionPerformed( ActionEvent JavaDoc e ) {
25       JOptionPane.showMessageDialog( swix.getRootComponent(), "Sorry, not implemented yet." );
26     }
27   };
28
29   public Action aboutAction = new AbstractAction() {
30     public void actionPerformed( ActionEvent JavaDoc e ) {
31       JOptionPane.showMessageDialog( swix.getRootComponent(), "This is the Accelerator Example." );
32     }
33   };
34
35   public static void main( String JavaDoc[] args ) {
36     try {
37       new Accelerator();
38     } catch (Exception JavaDoc e) {
39       System.err.println( e.getMessage() );
40     }
41   }
42
43 }
44
Popular Tags