| Accelerator.java |

    1
    2 import org.swixml.SwingEngine;
    3
    4 import javax.swing.*;
    5 import java.awt.event.ActionEvent;
    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 */
    15public class Accelerator {
    16  private static final String DESCRIPTOR = "xml/accelerator.xml";
    17  SwingEngine swix = new SwingEngine( this );
    18
    19  public Accelerator() throws Exception {
    20    swix.render( Accelerator.DESCRIPTOR ).setVisible( true );
    21  }
    22
    23  public Action newAction = new AbstractAction() {
    24    public void actionPerformed( ActionEvent e ) {
    25      JOptionPane.showMessageDialog( swix.getRootComponent(), "Sorry, not implemented yet." );
    26    }
    27  };
    28
    29  public Action aboutAction = new AbstractAction() {
    30    public void actionPerformed( ActionEvent e ) {
    31      JOptionPane.showMessageDialog( swix.getRootComponent(), "This is the Accelerator Example." );
    32    }
    33  };
    34
    35  public static void main( String[] args ) {
    36    try {
    37      new Accelerator();
    38    } catch (Exception e) {
    39      System.err.println( e.getMessage() );
    40    }
    41  }
    42
    43}
    44

| Accelerator.java |