home *** CD-ROM | disk | FTP | other *** search
/ Programming with VisualAge for Java / IBMVJAVA.ISO / vajwin / data1.cab / Ide / project_resources / jars / misc.jar / sunw / demo / misc / Voter.class (.txt) < prev   
Encoding:
Java Class File  |  1997-04-06  |  1.1 KB  |  39 lines

  1. package sunw.demo.misc;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Font;
  6. import java.awt.Label;
  7. import java.beans.PropertyChangeEvent;
  8. import java.beans.PropertyVetoException;
  9.  
  10. public class Voter extends Label {
  11.    private boolean vetoAll = true;
  12.  
  13.    public Voter() {
  14.       super("No");
  15.       ((Component)this).setFont(new Font("Helvetica", 1, 36));
  16.       ((Component)this).setBackground(Color.black);
  17.       ((Component)this).setForeground(Color.red);
  18.    }
  19.  
  20.    public void setVetoAll(boolean var1) {
  21.       this.vetoAll = var1;
  22.       if (this.vetoAll) {
  23.          ((Label)this).setText("No");
  24.       } else {
  25.          ((Label)this).setText("Yes");
  26.       }
  27.    }
  28.  
  29.    public boolean getVetoAll() {
  30.       return this.vetoAll;
  31.    }
  32.  
  33.    public void vetoableChange(PropertyChangeEvent var1) throws PropertyVetoException {
  34.       if (this.vetoAll) {
  35.          throw new PropertyVetoException("NO!", var1);
  36.       }
  37.    }
  38. }
  39.