⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e003. implementing a constrained property.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
A constrained property fires a PropertyChangeEvent whenever its value is about to be changed. Any listener can veto the event, thereby preventing the change. This example bean implements a single constrained integer property called myProperty. 
    
int myProperty;
    public int getMyProperty() {
        return myProperty;
    }
    public void setMyProperty(int newValue) throws PropertyVetoException {
        try {
            vceListeners.fireVetoableChange(
                "myProperty", new Integer(myProperty), new Integer(newValue));
            myProperty = newValue;
        } catch (PropertyVetoException e) {
            throw e;
        }
    }
    
    // Create the listener list.
    VetoableChangeSupport vceListeners = new VetoableChangeSupport(this);
    
    // The listener list wrapper methods.
    public synchronized void addVetoableChangeListener(VetoableChangeListener listener) {
        vceListeners.addVetoableChangeListener(listener);
    }
    public synchronized void removeVetoableChangeListener(VetoableChangeListener listener) {
        vceListeners.removeVetoableChangeListener(listener);
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -