| Localization.java |

    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  */
    10import org.swixml.SwingEngine;
    11
    12import javax.swing.*;
    13import java.awt.event.ActionEvent;
    14import java.awt.event.WindowAdapter;
    15import java.awt.event.WindowEvent;
    16
    17
    18public 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  /**
    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 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

| Localization.java |