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

  1. //
  2. // (c) 1997 Microsoft Corporation.  All rights reserved.
  3. //
  4. import java.awt.Insets;
  5. import com.ms.ui.*;
  6. import com.ms.fx.*;
  7.  
  8. class Pz15InfoPanel extends UIPanel implements Pz15Consts
  9. {
  10.         public UIText nummoves, minmoves, optmoves;
  11.         public Pz15Marquee marquee;
  12.         public UIText mrqtxt;
  13.         public String mrqstr;
  14.  
  15.         public Pz15InfoPanel()
  16.         {
  17.                 setLayout(new UIBorderLayout(0,0));
  18.                 setEdge(IFxGraphicsConstants.BDR_SUNKENOUTER | IFxGraphicsConstants.BDR_RAISEDINNER);
  19.                 mrqstr = " ";
  20.                 mrqtxt = new UIText(mrqstr);
  21.                 mrqtxt.setFont(new FxFont("Helvetica", FxFont.PLAIN, 14));
  22.                 marquee = new Pz15Marquee(mrqtxt, this);
  23.                 add(marquee, "north");
  24.  
  25.                 UIGroup txtinfo = new UIGroup("Statistics");
  26.                 txtinfo.setLayout(new UISplitLayout(0,180));
  27.  
  28.                 UIPanel pnl = new UIPanel();
  29.                 pnl.setLayout(new UIGridLayout(0,1,0,1));
  30.                 pnl.add(new UIText("Number of moves so far:", UIText.RIGHT));
  31.                 pnl.add(new UIText("Min number of moves to goal:", UIText.RIGHT));
  32.                 pnl.add(new UIText("Optimum solution:", UIText.RIGHT));
  33.                 txtinfo.add(pnl, "nw");
  34.  
  35.                 // Create data side of info panel
  36.                 pnl = new UIPanel();
  37.                 pnl.setLayout(new UIGridLayout(0,1,0,1));
  38.  
  39.                 nummoves = new UIText("0", UIText.LEFT);
  40.                 nummoves.setForeground(BaseColor.getColor (new FxColor(255,0,0)));
  41.                 nummoves.setFont(new FxFont("Dialog", FxFont.BOLD, 12));
  42.  
  43.                 minmoves = new UIText("" , UIText.LEFT);
  44.                 minmoves.setForeground(BaseColor.getColor (new FxColor(0,191,0)));
  45.                 minmoves.setFont(new FxFont("Dialog", FxFont.BOLD, 12));
  46.  
  47.                 optmoves = new UIText("", UIText.LEFT);
  48.                 optmoves.setForeground(BaseColor.getColor (new FxColor(0,0,255)));
  49.                 optmoves.setFont(new FxFont("Dialog", FxFont.BOLD, 12));
  50.  
  51.                 pnl.add(nummoves); pnl.add(minmoves); pnl.add(optmoves);
  52.                 txtinfo.add(pnl, "se");
  53.  
  54.                 add(txtinfo, "south");
  55.         }
  56.  
  57.         public Insets getInsets() { return(new Insets(10,10,10,10)); }
  58.  
  59.         //
  60.         // override isKeyable() so that the info panel can never get focus, and focus
  61.         //  will always be returned to the gamepanel through the UIApplet requestFocus().
  62.         //  see Puzzle15.java
  63.         //
  64.         public boolean isKeyable() { return false; }
  65. }
  66.