home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / sun / awt / windows / WCheckboxPeer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.7 KB  |  64 lines

  1. package sun.awt.windows;
  2.  
  3. import java.awt.Checkbox;
  4. import java.awt.CheckboxGroup;
  5. import java.awt.Color;
  6. import java.awt.Component;
  7. import java.awt.Dimension;
  8. import java.awt.FontMetrics;
  9. import java.awt.peer.CheckboxPeer;
  10. import sun.awt.SunToolkit;
  11.  
  12. public class WCheckboxPeer extends WComponentPeer implements CheckboxPeer {
  13.    public native void setState(boolean var1);
  14.  
  15.    public native void setCheckboxGroup(CheckboxGroup var1);
  16.  
  17.    public native void setLabel(String var1);
  18.  
  19.    public Dimension getMinimumSize() {
  20.       String var1 = ((Checkbox)super.target).getLabel();
  21.       if (var1 != null) {
  22.          FontMetrics var2 = ((WComponentPeer)this).getFontMetrics(((Checkbox)super.target).getFont());
  23.          return new Dimension(30 + var2.stringWidth(var1), Math.max(var2.getHeight() + 8, 15));
  24.       } else {
  25.          return new Dimension(20, 15);
  26.       }
  27.    }
  28.  
  29.    public boolean isFocusTraversable() {
  30.       return true;
  31.    }
  32.  
  33.    WCheckboxPeer(Checkbox var1) {
  34.       super(var1);
  35.    }
  36.  
  37.    native void create(WComponentPeer var1);
  38.  
  39.    void initialize() {
  40.       Checkbox var1 = (Checkbox)super.target;
  41.       this.setState(var1.getState());
  42.       this.setCheckboxGroup(var1.getCheckboxGroup());
  43.       Color var2 = ((Component)super.target).getBackground();
  44.       if (var2 != null) {
  45.          ((WComponentPeer)this).setBackground(var2);
  46.       }
  47.  
  48.       super.initialize();
  49.    }
  50.  
  51.    public boolean shouldClearRectBeforePaint() {
  52.       return false;
  53.    }
  54.  
  55.    void handleAction(boolean var1) {
  56.       Checkbox var2 = (Checkbox)super.target;
  57.       SunToolkit.executeOnEventHandlerThread(var2, new 1(this, var2, var1));
  58.    }
  59.  
  60.    public Dimension minimumSize() {
  61.       return this.getMinimumSize();
  62.    }
  63. }
  64.