1 2 10 import org.swixml.SwingEngine; 11 12 import javax.swing.*; 13 import java.awt.event.ActionEvent ; 14 import java.awt.event.WindowAdapter ; 15 import java.awt.event.WindowEvent ; 16 17 18 public class Localization extends WindowAdapter { 19 20 private static final String DESCRIPTOR = "xml/localization.xml"; 21 SwingEngine swix = new SwingEngine( this ); 22 23 24 25 public Localization() throws Exception { 26 swix.render( Localization.DESCRIPTOR ).setVisible( true ); 27 } 28 29 30 public Action actionOptions = new AbstractAction() { 31 public void actionPerformed( ActionEvent 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 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 e ) { 44 JOptionPane.showMessageDialog( swix.getRootComponent(), "Help ...." ); 45 } 46 }; 47 48 public Action actionExit = new AbstractAction() { 49 public void actionPerformed( ActionEvent e ) { 50 JOptionPane.showMessageDialog( swix.getRootComponent(), swix.getLocalizer().getString("mis_Exit")); 51 Localization.this.windowClosing(null); 52 } 53 }; 54 55 59 public void windowClosing( WindowEvent e ) { 60 super.windowClosing( e ); 61 System.exit(0); 62 } 63 64 public static void main( String [] args ) { 65 try { 66 new Localization(); 67 } catch (Exception e) { 68 System.err.println( e.getMessage() ); 69 } 70 } 71 72 } 73 | Popular Tags |