Here is a complete sample JApplet done in Swixml; every button click adds a
dot to the label.
This sample uses features available in Swixml 0.65 or later.
HTML:
<html>
<head>
<title>Swixml Applet</title>
</head>
<body>
<applet code="SwixApplet" archive="swixml.jar" width="100%" height="100%"
hspace="0" vspace="0">
<param name="xml" value="xml/Applet.xml">
</applet>
</body>
</html>
XML:
<?xml version="1.0" encoding="UTF-8"?>
<applet size="640,480" title="Hello SWIXML World">
<panel constraints="BorderLayout.CENTER">
<label id="lbl" DisplayedMnemonic="VK_E" LabelFor="tf">
Hello World!
</label>
<textfield id="tf" Columns="20" Text="Swixml"/>
<button Text="Click Here" Action="click" />
</panel>
</applet>
JAVA:
public class SwixApplet extends JApplet {
private SwingEngine engine;
public JLabel lbl;
public Action click = new AbstractAction() {
public void actionPerformed( ActionEvent e ) {
lbl.setText( lbl.getText() + ".");
}
};
public void init() {
super.init();
try {
String descriptorfile = this.getParameter( "xml" );
engine = new SwingEngine(this);
engine.insert( new URL( getCodeBase(), descriptorfile ), this );
this.setVisible( true );
} catch (Exception e) {
e.printStackTrace();
}
}
}