home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 14 / IOPROG_14.ISO / soft / sdkjava / sdkjava.exe / SDKJava.cab / Samples / AFC / FxTextures / Src / BtnPanel.java next >
Encoding:
Java Source  |  1998-03-05  |  1.9 KB  |  74 lines

  1. //
  2. // (c) 1998 Microsoft Corporation.  All rights reserved.
  3. //
  4. import java.awt.Event;
  5. import com.ms.ui.*;
  6. import com.ms.fx.*;
  7.  
  8. class BtnPanel extends UIPanel implements SDKConsts
  9. {
  10.     private UIRadioButton none, middle, outer, all, tile;
  11.     private UICheckButton snapto;
  12.  
  13.     private TexturePnl tpnl;
  14.     private UIRadioGroup stretch;
  15.     private UICheckGroup features;
  16.  
  17.     public BtnPanel(TexturePnl tpnl)
  18.     {
  19.         this.tpnl = tpnl;
  20.  
  21.         setLayout(new UIVerticalFlowLayout(UIVerticalFlowLayout.FILL, 0));
  22.  
  23.         stretch = new UIRadioGroup("Stretch Mode"); add(stretch);
  24.         features = new UICheckGroup("Texture Features"); add(features);
  25.  
  26.         none = (UIRadioButton)stretch.add("NONE"); none.setChecked(true);
  27.         middle = (UIRadioButton)stretch.add("MIDDLE");
  28.         outer = (UIRadioButton)stretch.add("OUTER");
  29.         all = (UIRadioButton)stretch.add("ALL");
  30.         tile = (UIRadioButton)stretch.add("Tile Texture");
  31.  
  32.         snapto = (UICheckButton)features.add("Partial Texture"); snapto.setChecked(true);
  33.     }
  34.  
  35.     public boolean handleEvent(Event e)
  36.     {
  37.         if ( e.id == e.LIST_SELECT ) {
  38.             if ( e.arg instanceof UIButton ) {
  39.                 if ( e.arg == none ) {
  40.                     tpnl.setMode(FxTexture.STRETCH_NONE);
  41.                     snapto.setEnabled(true);
  42.                 }
  43.                 else if ( e.arg == middle ) {
  44.                     tpnl.setMode(FxTexture.STRETCH_MIDDLE);
  45.                     snapto.setEnabled(true);
  46.                 }
  47.                 else if ( e.arg == outer ) {
  48.                     tpnl.setMode(FxTexture.STRETCH_OUTER);
  49.                     snapto.setEnabled(true);
  50.                 }
  51.                 else if ( e.arg == all ) {
  52.                     tpnl.setMode(FxTexture.STRETCH_ALL);
  53.                     snapto.setEnabled(false);
  54.                 }
  55.                 else if ( e.arg == tile ) {
  56.                     tpnl.setTile(true);
  57.                     snapto.setEnabled(false);
  58.                 }
  59.                 else if ( e.arg == snapto )
  60.                     tpnl.setSnapTo(false);
  61.             }
  62.         }
  63.         else if ( e.id == e.LIST_DESELECT ) {
  64.             if ( e.arg instanceof UIButton ) {
  65.                 if ( e.arg == tile )
  66.                     tpnl.setTile(false);
  67.                 else if ( e.arg == snapto )
  68.                     tpnl.setSnapTo(true);
  69.             }
  70.         }
  71.         return(super.handleEvent(e));
  72.     }
  73. }
  74.