ADM CApplication Widget
(Since adm V0.3)

Creates an awt frame, and initializes a connection to a server, typically a gateway such as cdevGateway. Extending this class automates making this connection.

There are four CApplication constructors. Use CApplication () and CApplication (String title) to connect to the local host and default port (9199). Use constructors CApplication (String host, int port) and CApplication (String host, int port, String title) to connect to a specific host and port.

The window closing event is implemented in this class. Before exiting the application, CApplication disconnects from the CDEV server.

Here is sample code:


import java.awt.*;
import adm.*;
 
public class Test1 extends CApplication {
    public static void main (String [] args) {
        int port = 9199;
        String host = "localhost";
        Test1 f = new Test1 (host, port);
        f.setSize(300, 200);
        f.show();
    }
    
    public Test1 (String host, int port)  {       
        super(host, port, "CApplication test demo");
        Panel p = new Panel();
        add(p);

        CBits bits = new CBits("R121", "int");
        bits.setSize(150, 30);
        bits.setLabelStyle(CConstants.LABEL_AXIS);
        p.add(bits);

        CBar bar = new CBar("R121", "pp");
        bar.setSize(50, 120);
        bar.setColorMode(CConstants.CLRMOD_ALARM);
        bar.setLabelStyle(CConstants.LABEL_ALL);
        p.add(bar);
    }
}