1
2 import org.swixml.SwingEngine;
3
4 import javax.swing.*;
5 import java.awt.event.ActionEvent;
6 import java.net.URL;
7
8
9
21
22public class SwixApplet extends JApplet {
23
24
25 public JTextField tf;
26
29 public AbstractAction submit = new AbstractAction() {
30 public void actionPerformed( ActionEvent e ) {
31 tf.setText( tf.getText() + '#' );
32 }
33 };
34
35 public void init() {
36
37 super.init();
38 try {
39 String descriptorfile = this.getParameter( "xml" );
40 if (descriptorfile == null) {
41 descriptorfile = "xml/applet.xml";
42 }
43 new SwingEngine( this ).insert( new URL( getCodeBase(), descriptorfile ), this );
44 this.setVisible( true );
45 } catch (Exception e) {
46 e.printStackTrace();
47 }
48 }
49}
50