1 import org.swixml.SwingEngine;
2 
3 import javax.swing.*;
4 
5 public class HelloWorldnoAction {
6   /**
7    * submit counter
8    */
9   private int clicks;
10
11  /**
12   * JTextField member gets instantiated through Swixml (look for id="tf" in xml descriptor)
13   */
14  public JTextField tf;
15
16  /**
17   * Jlabel to display number of button clicks
18   */
19  public JLabel cnt;
20
21  /**
22   * bound, using an element's action attribute, which was set to submit.
23   */
24  public void submit() {
25
26    tf.setText(tf.getText() + '#');
27    cnt.setText(String.valueOf(++clicks));
28  }
29
30
31  /**
32   * Renders UI at construction
33   */
34  private HelloWorldnoAction() throws Exception {
35    new SwingEngine(this).render("xml/helloworld.xml").setVisible(true);
36  }
37
38  /**
39   * Makes the class bootable
40   */
41  public static void main(String[] args) throws Exception {
42    new HelloWorldnoAction();
43  }
44}
45
46