Developing Java Beans reject an unacceptable change to

Developing Java Beans // defer to the support object boundSupport.removePropertyChangeListener(l); } // add a constrained property listenerpublic void addVetoableChangeListener(VetoableChangeListener l) { // defer to the support object vetoSupport.addVetoableChangeListener(l); } // remove a constrained property listenerpublic void removeVetoableChangeListener(VetoableChangeListener l) { // defer to the support object vetoSupport.removeVetoableChangeListener(l); } // the get method for the Value property public int getValue() { return theValue; } // the set method for the Value property public void setValue(int newValue) throws PropertyVetoException { // fire the change to any constrained listenersvetoSupport.fireVetoableChange(”Value”, new Integer(theValue), new Integer(newValue)); // no veto, so save the old value and then change it Integer oldVal = new Integer(theValue); theValue = newValue; setText(String.valueOf(theValue)); repaint(); // fire the change to any bound listeners boundSupport.firePropertyChange(”Value”, oldVal, new Integer(theValue)); } // handle property change events from others public void propertyChange(PropertyChangeEvent evt) { // only interested in changes to Value properties if (evt.getPropertyName().equals(”Value”)) { // just change our own property Integer val = (Integer)evt.getNewValue(); try { setValue(val.intValue()); } catch (PropertyVetoException e) { } } } } page 66
Note: If you are looking for high quality webhost to host and run your jsp application check Vision jsp hosting services

Comments are closed.