import java.awt.*; import adm.*; /** * Create a named application invoke by CJavaMenuItem. * It takes two arguments device name and property name. * For same device there is only one window will be shown up. */ public class NamedApp extends CNamedApplication { CLabel L; Label label; /** * A main method (it need to call super.invoke) */ public static void main (String [] args) { if (args.length != 2) { System.out.println("java MyApp2 device property"); System.exit(0); } CNamedApplication.invoke("NamedApp", args); } /** * A null constructor (it can call one of the super class constructors). * Add any widgets (adm or awt) here. */ public NamedApp () { super("CNameApplication demo"); setLayout(new GridLayout(2, 1, 10, 10)); setBounds(200, 20, 100, 80); label = new Label(); label.setFont(new Font("Dialog", Font.BOLD, 14)); add(label); L = new CLabel(); L.setColorMode(CConstants.CLRMOD_ALARM); add(L); } /** * overwrite setArgs method since main takes arguments */ public void setArgs (String[] args) { L.setDeviceName(args[0]); L.setPropertyName(args[1]); label.setText(args[0]+"."+args[1]); } }