home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 14 / IOPROG_14.ISO / soft / sdkjava / sdkjava.exe / SDKJava.cab / Samples / AFC / Puzzle15 / Src / Pz15AccGrfxBtn.Java < prev    next >
Encoding:
Java Source  |  1998-03-05  |  1.1 KB  |  56 lines

  1. //
  2. // (c) 1998 Microsoft Corporation.  All rights reserved.
  3. //
  4. import java.awt.Image;
  5. import java.awt.Event;
  6. import com.ms.ui.*;
  7.  
  8. public class Pz15AccGrfxBtn extends UIPushButton implements Pz15Consts
  9. {
  10.     public HotTrkGrfx grfx;
  11.     private Pz15Callbacks pzctrl;
  12.     private String name;
  13.  
  14.     public Pz15AccGrfxBtn(int i, Pz15Callbacks pzctrl)
  15.     {
  16.         super(new HotTrkGrfx(Pz15Images.get(i), Pz15Images.getHot(i), UIStatic.CENTERED),
  17.                 UIPushButton.RAISED | UIPushButton.THICK);
  18.         IUIComponent comp = getHeader();
  19.  
  20.         if ( comp instanceof HotTrkGrfx )
  21.             grfx = (HotTrkGrfx)comp;
  22.  
  23.         name = "Button #" + (i+1);
  24.         this.pzctrl = pzctrl;
  25.     }
  26.  
  27.     public Pz15AccGrfxBtn()
  28.     {
  29.         super("");
  30.         name = "Blank Space";
  31.     }
  32.  
  33.     public String getName()
  34.     {
  35.         return(name);
  36.     }
  37.  
  38.     public void setFocused(boolean on)
  39.     {
  40.         if ( pzctrl.getNavMode() == M_SELECT )
  41.             grfx.setImage(on ? grfx.hot : grfx.def);
  42.         super.setFocused(on);
  43.     }
  44. }
  45.  
  46. class HotTrkGrfx extends UIGraphic implements Pz15Consts
  47. {
  48.     public Image def,hot;
  49.  
  50.     public HotTrkGrfx(Image def, Image hot, int style)
  51.     {
  52.         super(def, style);
  53.         this.def = def;    this.hot = hot;
  54.     }
  55. }
  56.