Code example for PropertyChangeListener

Methods: propertyChange

0
			try { 
				bean.getClass().getMethod("addPropertyChangeListener", PropertyChangeListener.class).invoke(bean, new PropertyChangeListener() {
					 
					public void propertyChange(PropertyChangeEvent evt) {
						if (propertyName.equals(evt.getPropertyName()))
							listener.propertyChange(evt);
					} 
				}); 
			} catch (Exception ex2) {
				throw new RuntimeException(ex);
			} 
		} 
	} 
	public static void removePropertyChangeListener(Object bean, String propertyName, PropertyChangeListener listener) {
		if (bean == null) 
			throw new NullPointerException("Null bean !");
		 
		try { 
			bean.getClass().getMethod("removePropertyChangeListener", PropertyChangeListener.class).invoke(bean, listener);
		} catch (Exception ex) {
Experience pair programming with AI  Get Codota for Java