home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VPage / Java.bin / CLASSES.ZIP / sun / beans / editors / BoolEditor.class (.txt) next >
Encoding:
Java Class File  |  1997-07-08  |  1.1 KB  |  29 lines

  1. package sun.beans.editors;
  2.  
  3. import java.beans.PropertyEditorSupport;
  4.  
  5. public class BoolEditor extends PropertyEditorSupport {
  6.    public String getJavaInitializationString() {
  7.       return (Boolean)((PropertyEditorSupport)this).getValue() ? "true" : "false";
  8.    }
  9.  
  10.    public String getAsText() {
  11.       return (Boolean)((PropertyEditorSupport)this).getValue() ? "True" : "False";
  12.    }
  13.  
  14.    public void setAsText(String var1) throws IllegalArgumentException {
  15.       if (var1.toLowerCase().equals("true")) {
  16.          ((PropertyEditorSupport)this).setValue(Boolean.TRUE);
  17.       } else if (var1.toLowerCase().equals("false")) {
  18.          ((PropertyEditorSupport)this).setValue(Boolean.FALSE);
  19.       } else {
  20.          throw new IllegalArgumentException(var1);
  21.       }
  22.    }
  23.  
  24.    public String[] getTags() {
  25.       String[] var1 = new String[]{"True", "False"};
  26.       return var1;
  27.    }
  28. }
  29.