KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Localization


1
2 /**
3  * Localization, also shows localization for the MAC OS
4  *
5  * @author <a HREF="mailto:wolf@paulus.com">Wolf Paulus</a>
6  * @version $Revision: 1.1 $
7  *
8  * @since swixml (#129)
9  */

10 import org.swixml.SwingEngine;
11
12 import javax.swing.*;
13 import java.awt.event.ActionEvent JavaDoc;
14 import java.awt.event.WindowAdapter JavaDoc;
15 import java.awt.event.WindowEvent JavaDoc;
16
17
18 public class Localization extends WindowAdapter JavaDoc {
19
20   private static final String JavaDoc DESCRIPTOR = "xml/localization.xml";
21   SwingEngine swix = new SwingEngine( this );
22
23
24
25   public Localization() throws Exception JavaDoc {
26     swix.render( Localization.DESCRIPTOR ).setVisible( true );
27   }
28
29
30   public Action actionOptions = new AbstractAction() {
31     public void actionPerformed( ActionEvent JavaDoc e ) {
32       JOptionPane.showMessageDialog( swix.getRootComponent(), "Sorry, " +swix.getLocalizer().getString("mis_Options") + " not implemented yet.");
33     }
34   };
35
36   public Action actionAbout = new AbstractAction() {
37     public void actionPerformed( ActionEvent JavaDoc e ) {
38       JOptionPane.showMessageDialog( swix.getRootComponent(), "This is the Mac OS X Example." );
39     }
40   };
41
42  public Action actionHelp = new AbstractAction() {
43     public void actionPerformed( ActionEvent JavaDoc e ) {
44       JOptionPane.showMessageDialog( swix.getRootComponent(), "Help ...." );
45     }
46   };
47
48   public Action actionExit = new AbstractAction() {
49     public void actionPerformed( ActionEvent JavaDoc e ) {
50       JOptionPane.showMessageDialog( swix.getRootComponent(), swix.getLocalizer().getString("mis_Exit"));
51       Localization.this.windowClosing(null);
52     }
53   };
54
55   /**
56    * Invoked when a window is in the process of being closed.
57    * The close operation can be overridden at this point.
58    */

59   public void windowClosing( WindowEvent JavaDoc e ) {
60     super.windowClosing( e );
61     System.exit(0);
62   }
63
64   public static void main( String JavaDoc[] args ) {
65     try {
66       new Localization();
67     } catch (Exception JavaDoc e) {
68       System.err.println( e.getMessage() );
69     }
70   }
71
72 }
73
Popular Tags