home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 139 / dpcs0999.iso / Web / CFserver / data1.cab / Java / CFJava.cab / CFJavaRuntime.cab / netscape / application / PopupItem.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-10-01  |  2.5 KB  |  67 lines

  1. package netscape.application;
  2.  
  3. import netscape.util.ClassInfo;
  4. import netscape.util.CodingException;
  5. import netscape.util.Decoder;
  6. import netscape.util.Encoder;
  7.  
  8. public class PopupItem extends ListItem {
  9.    Popup popup;
  10.    static final String POPUP_KEY = "popup";
  11.  
  12.    public void setPopup(Popup var1) {
  13.       this.popup = var1;
  14.    }
  15.  
  16.    public Popup popup() {
  17.       return this.popup;
  18.    }
  19.  
  20.    public void drawInRect(Graphics var1, Rect var2) {
  21.       super.drawInRect(var1, var2);
  22.       if (this.popup != null) {
  23.          PopupItem var6 = (PopupItem)this.popup.selectedItem();
  24.          if (var6.equals(this)) {
  25.             Image var5 = this.popup.popupImage();
  26.             int var3;
  27.             int var4;
  28.             if (var5 != null) {
  29.                var3 = var5.width();
  30.                var4 = var5.height();
  31.             } else {
  32.                var4 = 0;
  33.                var3 = 0;
  34.             }
  35.  
  36.             if (super.selected) {
  37.                var1.setColor(super.selectedColor);
  38.             } else {
  39.                var1.setColor(super.listView.backgroundColor());
  40.             }
  41.  
  42.             var1.fillRect(var2.x + var2.width - var3 - 4, var2.y, var3 + 4, var2.height);
  43.             if (var5 != null) {
  44.                var5.drawAt(var1, var2.x + var2.width - var3 - 2, var2.y + (var2.height - var4) / 2);
  45.             }
  46.          }
  47.       }
  48.  
  49.    }
  50.  
  51.    public void describeClassInfo(ClassInfo var1) {
  52.       super.describeClassInfo(var1);
  53.       var1.addClass("netscape.application.PopupItem", 1);
  54.       var1.addField("popup", (byte)18);
  55.    }
  56.  
  57.    public void encode(Encoder var1) throws CodingException {
  58.       super.encode(var1);
  59.       var1.encodeObject("popup", this.popup);
  60.    }
  61.  
  62.    public void decode(Decoder var1) throws CodingException {
  63.       super.decode(var1);
  64.       this.popup = (Popup)var1.decodeObject("popup");
  65.    }
  66. }
  67.