Developing Java Beans // the decrement button protected
Developing Java Beans // the decrement button protected Button decButton = new Button(”<<"); // the increment button protected Button incButton = new Button(">>”); // the constrained label protected NumberLabel primaryLabel = new NumberLabel(”*****”); // the label that mirrors the primary label protected NumberLabel mirrorLabel = new NumberLabel(”*****”); // the constraining object protected Constrainer cnstr = new Constrainer(); // the constructor public ExampleApplet4() { } // the applet init public void init() { // add the user interface elements add(decButton); add(incButton); add(primaryLabel); add(mirrorLabel); // register the constrainer with the primary label primaryLabel.addVetoableChangeListener(cnstr); // register the mirroring label with the primary labelprimaryLabel.addPropertyChangeListener(mirrorLabel); // setup the button adapter try { adapter = new GenericButtonAdapter(this); adapter.registerActionEventHandler(decButton, “handleDecrement”); adapter.registerActionEventHandler(incButton, “handleIncrement”); } catch (NoSuchMethodException e) {} catch (ClassNotFoundException e) { } // start the labels at different values try { primaryLabel.setValue(15); mirrorLabel.setValue(5); } catch (PropertyVetoException e) { } } // handle the decrement button push page 68
Note: If you are looking for good and high quality web space to host and run your java application check Vision java hosting services