| ClientAttr.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 ClientAttr shows in the usage of client attributes in swixml tags.
    10 *
    11 * @author <a href="mailto:wolf@paulus.com">Wolf Paulus</a>
    12 * @version $Revision: 1.1 $
    13 *
    14 * @since swixml 0.98
    15 */
    16public class ClientAttr extends WindowAdapter {
    17  private SwingEngine swix = new SwingEngine( this );
    18
    19  public JButton btn;
    20  public JTextArea ta;
    21  public Action show = new AbstractAction() {
    22    public void actionPerformed( ActionEvent e ) {
    23      ta.setText( "X:" + btn.getClientProperty( "X" ) + "\n" + "Y:" + btn.getClientProperty( "Y" ) );
    24    }
    25  };
    26
    27  private ClientAttr() {
    28    try {
    29      swix.render( "xml/clientattr.xml" ).setVisible( true );
    30      swix.forget( "x" );
    31    } catch (Exception e) {
    32      e.printStackTrace();
    33    }
    34  }
    35
    36  public static void main( String[] args ) {
    37    new ClientAttr();
    38  }
    39}

| ClientAttr.java |