public void setOpacity(int v) {
        if ((v < 0) || (v > 255)) {
            throw new IllegalArgumentException("The opacity (" + v + ") must be between 0 and 255.");
        }
        this.adjustingOpacity++;
        try {
            this.opacitySlider.setValue(v);
            this.alpha.spinner.setValue(new Integer(v));
            if (this.lastOpacity != v) {
                firePropertyChange(OPACITY_PROPERTY, new Integer(this.lastOpacity), new Integer(v));
                Color c = this.preview.getForeground();
                this.preview.setForeground(new Color(c.getRed(), c.getGreen(), c.getBlue(), v));
            }
            this.lastOpacity = v;
        } finally {
            this.adjustingOpacity--;
        }
    }