vetolistener.java
来自「java模式设计」· Java 代码 · 共 22 行
JAVA
22 行
package beandemo;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
public class VetoListener implements VetoableChangeListener {
public void vetoableChange(PropertyChangeEvent arg0)
throws PropertyVetoException {
Float newprice=(Float)arg0.getNewValue();
if(newprice.floatValue()>15000){
throw new PropertyVetoException("把价格调得太高了",arg0);
}
if(newprice.floatValue()<5000){
throw new PropertyVetoException("把价格调得太低了",arg0);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?