| InitClass.java |

    1
    2 import org.swixml.SwingEngine;
    3
    4 import javax.swing.*;
    5 import java.awt.event.ActionEvent;
    6 import java.awt.event.WindowAdapter;
    7
    8 /**
    9  * The InitClass class demonstrates how to use the initclass attribute.
    10 * Date: Mar 10, 2003
    11 *
    12 * @author <a href="mailto:wolf@paulus.com">Wolf Paulus</a>
    13 * @version $Revision: 1.1 $
    14 * @since swixml 0.76
    15 */
    16
    17public class InitClass extends WindowAdapter {
    18  public Action DO_SELECT = new AbstractAction() {
    19    public void actionPerformed(ActionEvent e) {
    20      System.out.println( ((JComboBox) e.getSource()).getSelectedItem().toString() );
    21    }
    22  };
    23
    24  private InitClass() throws Exception {
    25    new SwingEngine( this ).render( "xml/initclass.xml" ).setVisible( true );
    26  }
    27
    28  public static void main(String[] args) {
    29    try {
    30      new InitClass();
    31    } catch (Exception e) {
    32      e.printStackTrace();
    33    }
    34  }
    35}
    36
    37

| InitClass.java |