home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Java / JDesignerPro / Jdp3_0.exe / data1.cab / Program_Files / JDPSingle.jar / JDPButton.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-10-08  |  11.8 KB  |  731 lines

  1. import java.awt.Button;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Dimension;
  5. import java.awt.Event;
  6. import java.awt.Font;
  7. import java.awt.FontMetrics;
  8. import java.awt.Graphics;
  9. import java.awt.Image;
  10. import java.awt.Panel;
  11. import java.awt.Rectangle;
  12. import java.awt.image.ImageObserver;
  13.  
  14. public class JDPButton extends Panel {
  15.    static final String[] iconNames = new String[]{"", "Save", "Load", "Compile", "Build", "Search", "Go", "Undo", "Plus", "Delete", "New", "Copy", "Check", "Arrow", "Picture", "Label", "TextField", "ChiselFrame", "Button", "Checkbox", "RadioButton", "Choice", "List", "ScrollSouth", "ScrollEast", "Panel", "TabPanel", "Tree", "Grid", "HotKey", "Slider", "Progress", "Spinner", "Custom", "Chart", "Report", "Email", "Define", "Helpbook", "APIbook", "Layout", "Circular", "BuildErrors", "View", "Documents", "Pager", "NewFolder", "DebugBuild", "Printer", "SearchFwd", "SearchBack"};
  16.    public static final int SAVE = 0;
  17.    public static final int LOAD = 1;
  18.    public static final int COMPILE = 2;
  19.    public static final int BUILD = 3;
  20.    public static final int SEARCH = 4;
  21.    // $FF: renamed from: GO int
  22.    public static final int field_0 = 5;
  23.    public static final int UNDO = 6;
  24.    public static final int PLUS = 7;
  25.    public static final int DELETE = 8;
  26.    public static final int NEW = 9;
  27.    public static final int COPY = 10;
  28.    public static final int CHECK = 11;
  29.    public static final int ARROW = 12;
  30.    public static final int PICTURE = 13;
  31.    public static final int LABEL = 14;
  32.    public static final int TEXTFIELD = 15;
  33.    public static final int CHISELFRAME = 16;
  34.    public static final int BUTTON = 17;
  35.    public static final int CHECKBOX = 18;
  36.    public static final int RADIO = 19;
  37.    public static final int CHOICE = 20;
  38.    public static final int LIST = 21;
  39.    public static final int SCROLLSOUTH = 22;
  40.    public static final int SCROLLEAST = 23;
  41.    public static final int PANEL = 24;
  42.    public static final int TAB = 25;
  43.    public static final int TREE = 26;
  44.    public static final int GRID = 27;
  45.    public static final int HOTKEY = 28;
  46.    public static final int SLIDER = 29;
  47.    public static final int PROGRESS = 30;
  48.    public static final int SPINNER = 31;
  49.    public static final int CUSTOM = 32;
  50.    public static final int CHART = 33;
  51.    public static final int REPORT = 34;
  52.    public static final int EMAIL = 35;
  53.    public static final int DEFINE = 36;
  54.    public static final int HELPBOOK = 37;
  55.    public static final int APIBOOK = 38;
  56.    public static final int LAYOUT = 39;
  57.    public static final int CIRCULAR = 40;
  58.    public static final int BUILDERRORS = 41;
  59.    public static final int VIEW = 42;
  60.    public static final int DOCUMENTS = 43;
  61.    public static final int PAGER = 44;
  62.    public static final int NEWFOLDER = 45;
  63.    public static final int DEBUGBUILD = 46;
  64.    public static final int PRINTER = 47;
  65.    public static final int SEARCHFWD = 48;
  66.    public static final int SEARCHBACK = 49;
  67.    public static final int CENTER = 0;
  68.    public static final int LEFT = 1;
  69.    public static final int RIGHT = 2;
  70.    // $FF: renamed from: UP int
  71.    public static final int field_1 = 3;
  72.    public static final int DOWN = 4;
  73.    public static final int PULLDOWN = 5;
  74.    static String[] alignmentValues = new String[]{"Center", "Left", "Right"};
  75.    static boolean activated;
  76.    static JDPUser user;
  77.    static JDesignerPro thisJDP;
  78.    Image offscreen;
  79.    Rectangle offscreensize;
  80.    // $FF: renamed from: gr java.awt.Graphics
  81.    Graphics field_2;
  82.    static Image defaultIconImage;
  83.    String thisImageLoc;
  84.    Image iconImage;
  85.    Image iconImages;
  86.    Graphics grI;
  87.    Rectangle Bounds;
  88.    JDPImageLoader imageLoader;
  89.    String buttonText;
  90.    int buttonIcon;
  91.    int alignment;
  92.    String returnValue;
  93.    int arrowDirection;
  94.    Color back;
  95.    private boolean iconOnly;
  96.    Event thisEvent;
  97.    Event thisEvent1;
  98.    boolean buttonPressed;
  99.    boolean drawnPressed;
  100.    boolean stayOn;
  101.    Rectangle buttonRect;
  102.    Font lastFont;
  103.    // $FF: renamed from: fm java.awt.FontMetrics
  104.    FontMetrics field_3;
  105.    int[] widths;
  106.    Button Button;
  107.  
  108.    int totalWidth() {
  109.       int var1 = 0;
  110.       if (this.buttonIcon >= 0) {
  111.          var1 += 24;
  112.          if (this.buttonText != null) {
  113.             ++var1;
  114.          }
  115.       } else {
  116.          var1 = 8;
  117.       }
  118.  
  119.       if (this.buttonText != null) {
  120.          var1 = var1 + this.StringWidth(this.buttonText) + 3;
  121.       }
  122.  
  123.       return var1;
  124.    }
  125.  
  126.    public boolean isPressed() {
  127.       return this.buttonPressed;
  128.    }
  129.  
  130.    int[] getWidths() {
  131.       this.field_3 = this.field_2.getFontMetrics();
  132.       this.widths = this.field_3.getWidths();
  133.       return this.widths;
  134.    }
  135.  
  136.    void setJDPUser(JDPUser var1) {
  137.       user = var1;
  138.       this.checkIconsLoaded();
  139.    }
  140.  
  141.    public JDPButton() {
  142.       this.drawButton((String)null, -1, 0, "", -1);
  143.    }
  144.  
  145.    public JDPButton(String var1) {
  146.       this.drawButton(var1, -1, 0, var1, -1);
  147.    }
  148.  
  149.    public JDPButton(String var1, int var2) {
  150.       this.drawButton(var1, -1, var2, var1, -1);
  151.    }
  152.  
  153.    public JDPButton(String var1, int var2, int var3) {
  154.       this.drawButton(var1, var2, var3, var1, -1);
  155.    }
  156.  
  157.    public JDPButton(int var1, String var2, int var3) {
  158.       this.drawButton((String)null, var1, var3, var2, -1);
  159.    }
  160.  
  161.    public JDPButton(int var1, String var2) {
  162.       this.drawButton((String)null, var1, 0, var2, -1);
  163.    }
  164.  
  165.    public JDPButton(int var1) {
  166.       this.drawButton((String)null, -1, -1, "", var1);
  167.    }
  168.  
  169.    public void update(Graphics var1) {
  170.       Rectangle var2 = ((Component)this).bounds();
  171.       if (this.offscreen == null || var2.width != this.offscreensize.width || var2.height != this.offscreensize.height) {
  172.          if (var2.width < 10) {
  173.             var2.width = 10;
  174.          }
  175.  
  176.          if (var2.height < 10) {
  177.             var2.height = 10;
  178.          }
  179.  
  180.          this.offscreen = ((Component)this).createImage(var2.width, var2.height);
  181.          this.offscreensize = var2;
  182.          this.field_2 = this.offscreen.getGraphics();
  183.       }
  184.  
  185.       if (this.imageLoader != null && this.imageLoader.getImageReady()) {
  186.          this.iconImage = this.imageLoader.thisImage;
  187.          if (defaultIconImage == null) {
  188.             defaultIconImage = this.imageLoader.thisImage;
  189.          }
  190.  
  191.          this.imageLoader = null;
  192.       }
  193.  
  194.       if (defaultIconImage == null) {
  195.          this.checkIconsLoaded();
  196.       }
  197.  
  198.       this.back = ((Component)this).getBackground();
  199.       this.field_2.setFont(((Component)this).getFont());
  200.       if (this.thisEvent != null && !this.drawnPressed) {
  201.          this.buttonPressed = true;
  202.       }
  203.  
  204.       boolean var3 = this.drawnPressed;
  205.       boolean var4 = false;
  206.  
  207.       while(!var4) {
  208.          this.Bounds = ((Component)this).bounds();
  209.          this.field_2.setColor(this.back);
  210.          this.field_2.fillRect(0, 0, this.Bounds.width, this.Bounds.height);
  211.          this.buttonRect = new Rectangle(0, 0, this.Bounds.width, this.Bounds.height);
  212.          this.field_2.setColor(((Component)this).getForeground());
  213.          int var5 = 1;
  214.          int var6 = this.Bounds.height / 2 + this.StringHeight() / 3;
  215.          int var7 = (this.Bounds.height - 20) / 2;
  216.          if (var7 < 1) {
  217.             var7 = 1;
  218.          }
  219.  
  220.          byte var8 = 0;
  221.          if (this.buttonPressed) {
  222.             var8 = 1;
  223.             ++var6;
  224.             ++var7;
  225.          }
  226.  
  227.          if (this.alignment == 0) {
  228.             var5 = (this.Bounds.width - this.totalWidth()) / 2;
  229.          } else if (this.alignment == 2) {
  230.             var5 = this.Bounds.width - this.totalWidth() - 3;
  231.          }
  232.  
  233.          var5 += var8;
  234.          if (this.buttonIcon >= 0) {
  235.             this.drawIcon(this.buttonIcon, var5 + 1, var7);
  236.             var5 += 22;
  237.          } else if (this.alignment == 1 || this.alignment == 0) {
  238.             var5 += 5;
  239.          }
  240.  
  241.          if (this.buttonText != null) {
  242.             if (((Component)this).isEnabled()) {
  243.                this.field_2.drawString(this.buttonText, var5, var6);
  244.             } else {
  245.                this.field_2.setColor(JDPUtils.brighter(this.back));
  246.                this.field_2.drawString(this.buttonText, var5 + 1, var6 + 1);
  247.                this.field_2.setColor(JDPUtils.darker(this.back));
  248.                this.field_2.drawString(this.buttonText, var5, var6);
  249.             }
  250.          }
  251.  
  252.          int var9 = (this.Bounds.width - 3) / 2 + 1;
  253.          int var10 = (this.Bounds.height - 3) / 2 + 1;
  254.          byte var11 = 0;
  255.          if (this.arrowDirection == 5) {
  256.             var11 = 1;
  257.          }
  258.  
  259.          if (!this.buttonPressed) {
  260.             this.field_2.setColor(JDPUtils.brighter(this.back));
  261.             this.field_2.drawLine(0 + var11 * 2, 0 + var11 * 2, this.Bounds.width - 1 - var11, 0 + var11 * 2);
  262.             this.field_2.drawLine(0 + var11 * 2, 0 + var11 * 2, 0 + var11 * 2, this.Bounds.height - 1 - var11);
  263.             this.field_2.setColor(JDPUtils.darker(this.back));
  264.             this.field_2.drawLine(0 + var11 * 2, this.Bounds.height - 1 - var11, 0 + var11 * 2, this.Bounds.height - 1 - var11);
  265.             this.field_2.drawLine(this.Bounds.width - 1 - var11, 0 + var11 * 2, this.Bounds.width - 1 - var11, 0 + var11 * 2);
  266.             this.field_2.drawLine(1 + var11 * 2, this.Bounds.height - 2 - var11, this.Bounds.width - 2 - var11, this.Bounds.height - 2 - var11);
  267.             this.field_2.drawLine(this.Bounds.width - 2 - var11, 1 + var11 * 2, this.Bounds.width - 2 - var11, this.Bounds.height - 2 - var11);
  268.             this.field_2.setColor(Color.black);
  269.             this.field_2.drawLine(1 + var11 * 2, this.Bounds.height - 1 - var11, this.Bounds.width - 1 - var11, this.Bounds.height - 1 - var11);
  270.             this.field_2.drawLine(this.Bounds.width - 1 - var11, 1 + var11 * 2, this.Bounds.width - 1 - var11, this.Bounds.height - 1 - var11);
  271.             var3 = false;
  272.          } else {
  273.             this.field_2.setColor(Color.black);
  274.             this.field_2.drawLine(0 + var11 * 2, 0 + var11 * 2, this.Bounds.width - 1 - var11, 0 + var11 * 2);
  275.             this.field_2.drawLine(0 + var11 * 2, 0 + var11 * 2, 0 + var11 * 2, this.Bounds.height - 1 - var11);
  276.             this.field_2.setColor(JDPUtils.darker(this.back));
  277.             this.field_2.drawLine(1 + var11 * 2, 1 + var11 * 2, this.Bounds.width - 2 - var11, 1 + var11 * 2);
  278.             this.field_2.drawLine(1 + var11 * 2, 1 + var11 * 2, 1 + var11 * 2, this.Bounds.height - 2 - var11);
  279.             this.field_2.setColor(JDPUtils.brighter(this.back));
  280.             this.field_2.drawLine(1 + var11 * 2, this.Bounds.height - 1 - var11, this.Bounds.width - 1 - var11, this.Bounds.height - 1 - var11);
  281.             this.field_2.drawLine(this.Bounds.width - 1 - var11, 1 + var11 * 2, this.Bounds.width - 1 - var11, this.Bounds.height - 1 - var11);
  282.             var3 = true;
  283.             this.field_2.setColor(Color.black);
  284.             ++var9;
  285.             ++var10;
  286.          }
  287.  
  288.          if (this.arrowDirection == 5) {
  289.             this.field_2.setColor(JDPUtils.brighter(this.back));
  290.             this.field_2.drawLine(0, this.Bounds.height - 1, this.Bounds.width - 1, this.Bounds.height - 1);
  291.             this.field_2.drawLine(this.Bounds.width - 1, 1, this.Bounds.width - 1, this.Bounds.height - 1);
  292.             this.field_2.setColor(JDPUtils.darker(this.back));
  293.             this.field_2.drawLine(0, 0, 0, this.Bounds.height - 2);
  294.             this.field_2.drawLine(0, 0, this.Bounds.width - 1, 0);
  295.             this.field_2.setColor(Color.black);
  296.             this.field_2.drawLine(1, 1, 1, this.Bounds.height - 2);
  297.             this.field_2.drawLine(1, 1, this.Bounds.width - 2, 1);
  298.          }
  299.  
  300.          int var12 = 0;
  301.          if (((Component)this).isEnabled()) {
  302.             this.field_2.setColor(((Component)this).getForeground());
  303.          } else {
  304.             this.field_2.setColor(JDPUtils.brighter(this.back));
  305.             var12 = 1;
  306.          }
  307.  
  308.          for(; var12 >= 0; --var12) {
  309.             var9 += var12;
  310.             var10 += var12;
  311.             if (this.arrowDirection == 2) {
  312.                int[] var13 = new int[]{var9 - 1, var9 + 2, var9 - 1, var9 - 1};
  313.                int[] var14 = new int[]{var10 - 3, var10, var10 + 3, var10 - 2};
  314.                this.field_2.fillPolygon(var13, var14, 3);
  315.             }
  316.  
  317.             if (this.arrowDirection == 1) {
  318.                int[] var20 = new int[]{var9 + 2, var9 - 1, var9 + 2, var9 + 2};
  319.                int[] var23 = new int[]{var10 - 3, var10, var10 + 3, var10 - 3};
  320.                this.field_2.fillPolygon(var20, var23, 3);
  321.             }
  322.  
  323.             if (this.arrowDirection == 3) {
  324.                int[] var21 = new int[]{var9 - 3, var9, var9 + 3, var9 - 3};
  325.                int[] var24 = new int[]{var10 + 2, var10 - 2, var10 + 2, var10 + 2};
  326.                this.field_2.fillPolygon(var21, var24, 3);
  327.             }
  328.  
  329.             if (this.arrowDirection == 4 || this.arrowDirection == 5) {
  330.                int[] var22 = new int[]{var9 - 2, var9, var9 + 3, var9 - 2};
  331.                int[] var25 = new int[]{var10 - 1, var10 + 2, var10 - 1, var10 - 1};
  332.                this.field_2.fillPolygon(var22, var25, 3);
  333.             }
  334.  
  335.             var9 -= var12;
  336.             var10 -= var12;
  337.             if (var12 == 1) {
  338.                this.field_2.setColor(JDPUtils.darker(this.back));
  339.             }
  340.          }
  341.  
  342.          var1.drawImage(this.offscreen, 0, 0, (ImageObserver)null);
  343.          if (this.thisEvent == null || !var3) {
  344.             var4 = true;
  345.          }
  346.  
  347.          if (this.stayOn) {
  348.             var4 = true;
  349.          } else if (this.thisEvent != null) {
  350.             this.buttonPressed = false;
  351.          }
  352.       }
  353.  
  354.       var1.drawImage(this.offscreen, 0, 0, (ImageObserver)null);
  355.       if (this.thisEvent != null) {
  356.          Event var16 = this.thisEvent;
  357.          this.thisEvent = null;
  358.          super.postEvent(var16);
  359.          if (!this.stayOn) {
  360.             this.buttonPressed = false;
  361.          }
  362.       }
  363.  
  364.       if (this.thisEvent1 != null) {
  365.          Event var17 = this.thisEvent1;
  366.          this.thisEvent1 = null;
  367.          super.postEvent(var17);
  368.       }
  369.  
  370.       this.drawnPressed = var3;
  371.    }
  372.  
  373.    public Dimension preferredSize() {
  374.       return this.minimumSize();
  375.    }
  376.  
  377.    public void layout() {
  378.       ((Component)this).repaint();
  379.    }
  380.  
  381.    int StringWidth(String var1) {
  382.       if (this.iconImages == null) {
  383.          this.iconImages = ((Component)this).createImage(20, 20);
  384.          if (this.iconImages == null) {
  385.             return 0;
  386.          }
  387.       }
  388.  
  389.       if (this.field_2 == null) {
  390.          this.field_2 = this.iconImages.getGraphics();
  391.          if (this.field_2 == null) {
  392.             return 0;
  393.          }
  394.  
  395.          this.field_2.setFont(((Component)this).getFont());
  396.       }
  397.  
  398.       if (var1 != null && var1.length() != 0) {
  399.          if (this.field_2.getFont() != this.lastFont) {
  400.             this.getWidths();
  401.             this.lastFont = this.field_2.getFont();
  402.          }
  403.  
  404.          return this.field_3 != null ? this.field_3.stringWidth(var1) : 0;
  405.       } else {
  406.          return 0;
  407.       }
  408.    }
  409.  
  410.    public boolean isIconOnly() {
  411.       return this.iconOnly;
  412.    }
  413.  
  414.    public static int getIconValue(String var0) {
  415.       for(int var1 = 0; var1 < iconNames.length; ++var1) {
  416.          if (var0.equals(iconNames[var1])) {
  417.             return var1 - 1;
  418.          }
  419.       }
  420.  
  421.       return -1;
  422.    }
  423.  
  424.    public void setPressed(boolean var1) {
  425.       this.buttonPressed = var1;
  426.       ((Component)this).repaint();
  427.    }
  428.  
  429.    public void setIconImagePath(String var1) {
  430.       this.setIconImagePath(user, var1);
  431.    }
  432.  
  433.    public String getIconImagePath() {
  434.       return this.thisImageLoc;
  435.    }
  436.  
  437.    public void setIconImagePath(JDPUser var1, String var2) {
  438.       if (this.imageLoader == null) {
  439.          this.thisImageLoc = var2;
  440.          this.imageLoader = new JDPImageLoader(var1, this, var2);
  441.          (new Thread(this.imageLoader)).start();
  442.       }
  443.  
  444.    }
  445.  
  446.    public void paint(Graphics var1) {
  447.       this.update(var1);
  448.    }
  449.  
  450.    public int getIcon() {
  451.       return this.buttonIcon;
  452.    }
  453.  
  454.    public void setIcon(int var1) {
  455.       this.buttonIcon = var1;
  456.       ((Component)this).repaint();
  457.    }
  458.  
  459.    public void setIcon(String var1) {
  460.       this.buttonIcon = -1;
  461.       if (var1 != null) {
  462.          for(int var2 = 0; var2 < iconNames.length; ++var2) {
  463.             if (var1.equals(iconNames[var2])) {
  464.                this.buttonIcon = var2 - 1;
  465.             }
  466.          }
  467.       }
  468.  
  469.       ((Component)this).repaint();
  470.    }
  471.  
  472.    void drawIcon(int var1, int var2, int var3) {
  473.       if (this.iconImage == null) {
  474.          this.iconImage = defaultIconImage;
  475.       }
  476.  
  477.       if (this.iconImage != null) {
  478.          if (this.iconImages == null) {
  479.             this.iconImages = ((Component)this).createImage(20, 20);
  480.          }
  481.  
  482.          byte var4 = 0;
  483.          if (!((Component)this).isEnabled()) {
  484.             var4 = 1;
  485.          }
  486.  
  487.          this.grI = this.iconImages.getGraphics();
  488.          this.grI.setColor(this.back);
  489.          this.grI.fillRect(0, 0, this.Bounds.width, this.Bounds.height);
  490.          this.grI.drawImage(this.iconImage, -var1 * 20, -20 * var4, (ImageObserver)null);
  491.          this.field_2.drawImage(this.iconImages, var2, var3, (ImageObserver)null);
  492.       }
  493.  
  494.    }
  495.  
  496.    public Dimension minimumSize() {
  497.       int var1 = 22;
  498.       if (this.StringHeight() > var1) {
  499.          var1 = this.StringHeight();
  500.       }
  501.  
  502.       int var2 = 21;
  503.       if (this.totalWidth() > var2) {
  504.          var2 = this.totalWidth();
  505.       }
  506.  
  507.       Dimension var3 = new Dimension(var2, var1);
  508.       if (this.arrowDirection >= 0) {
  509.          var3 = new Dimension(12, 12);
  510.       }
  511.  
  512.       if (this.arrowDirection >= 3) {
  513.          var3 = new Dimension(9, 9);
  514.       }
  515.  
  516.       if (this.arrowDirection == 5) {
  517.          var3 = new Dimension(15, 9);
  518.       }
  519.  
  520.       if (!((Component)this).isVisible()) {
  521.          var3 = new Dimension(0, 0);
  522.       }
  523.  
  524.       return var3;
  525.    }
  526.  
  527.    public static String[] getButtonIconList() {
  528.       return iconNames;
  529.    }
  530.  
  531.    void checkIconsLoaded() {
  532.       if (defaultIconImage == null) {
  533.          String var1 = "JDPBUTNS.gif";
  534.          int var2 = JDPUtils.getNumColors();
  535.          if (System.getProperty("java.vendor").startsWith("Microsoft") && var2 <= 8) {
  536.             var1 = "JDPBUTN1.gif";
  537.          }
  538.  
  539.          this.setIconImagePath("Images/" + var1);
  540.       }
  541.  
  542.    }
  543.  
  544.    public void setIconOnly(boolean var1) {
  545.       if (this.iconOnly != var1) {
  546.          if (var1) {
  547.             this.drawButton((String)null, this.buttonIcon, this.alignment, this.returnValue, -1);
  548.          } else {
  549.             this.drawButton(this.returnValue, this.buttonIcon, this.alignment, this.returnValue, -1);
  550.          }
  551.       }
  552.    }
  553.  
  554.    private void drawButton(String var1, int var2, int var3, String var4, int var5) {
  555.       activated = JDPUser.classactivated;
  556.       if (!activated) {
  557.          System.out.println("Software Violation - this class may only be used in conjunction with JDesignerPro.");
  558.       } else {
  559.          this.iconImage = defaultIconImage;
  560.          this.Button = new Button();
  561.          this.buttonText = var1;
  562.          this.buttonIcon = var2;
  563.          this.alignment = var3;
  564.          this.returnValue = var4;
  565.          this.arrowDirection = var5;
  566.          this.iconOnly = false;
  567.          if (var1 == null) {
  568.             this.iconOnly = true;
  569.          }
  570.  
  571.          ((Component)this).show();
  572.          ((Component)this).repaint();
  573.       }
  574.    }
  575.  
  576.    public void setStayOn(boolean var1) {
  577.       this.stayOn = var1;
  578.    }
  579.  
  580.    public boolean getStayOn() {
  581.       return this.stayOn;
  582.    }
  583.  
  584.    int StringHeight() {
  585.       if (this.field_2 == null) {
  586.          return 0;
  587.       } else {
  588.          if (this.field_2.getFont() != this.lastFont) {
  589.             this.getWidths();
  590.             this.lastFont = this.field_2.getFont();
  591.          }
  592.  
  593.          return this.field_3.getHeight();
  594.       }
  595.    }
  596.  
  597.    public int getAlignment() {
  598.       return this.alignment;
  599.    }
  600.  
  601.    public void setAlignment(int var1) {
  602.       if (this.alignment != var1) {
  603.          this.alignment = var1;
  604.          ((Component)this).repaint();
  605.       }
  606.    }
  607.  
  608.    public static int getAlignmentValue(String var0) {
  609.       for(int var1 = 0; var1 < alignmentValues.length; ++var1) {
  610.          if (var0.equals(alignmentValues[var1])) {
  611.             return var1;
  612.          }
  613.       }
  614.  
  615.       return -1;
  616.    }
  617.  
  618.    public boolean handleEvent(Event var1) {
  619.       switch (var1.id) {
  620.          case 202:
  621.          case 205:
  622.             if (this.buttonPressed) {
  623.                if (!this.stayOn) {
  624.                   this.buttonPressed = false;
  625.                }
  626.  
  627.                ((Component)this).repaint();
  628.                return true;
  629.             }
  630.  
  631.             return false;
  632.          case 401:
  633.             if (var1.key == 10) {
  634.                this.thisEvent = new Event(this.Button, var1.when, 1001, var1.x, var1.y, var1.key, var1.modifiers, this.returnValue);
  635.                this.thisEvent.target = this.Button;
  636.                this.thisEvent1 = new Event(this, var1.when, 1001, var1.x, var1.y, var1.key, var1.modifiers, this.returnValue);
  637.                ((Component)this).repaint();
  638.                return true;
  639.             }
  640.  
  641.             return false;
  642.          case 501:
  643.          case 506:
  644.             if (this.buttonRect != null && this.buttonRect.inside(var1.x, var1.y)) {
  645.                if (!((Component)this).isEnabled()) {
  646.                   return true;
  647.                }
  648.  
  649.                this.buttonPressed = true;
  650.                ((Component)this).requestFocus();
  651.                ((Component)this).repaint();
  652.                return true;
  653.             } else {
  654.                if (this.buttonPressed) {
  655.                   if (!this.stayOn) {
  656.                      this.buttonPressed = false;
  657.                   }
  658.  
  659.                   ((Component)this).repaint();
  660.                   return true;
  661.                }
  662.  
  663.                return false;
  664.             }
  665.          case 502:
  666.             if (this.buttonRect != null && this.buttonRect.inside(var1.x, var1.y)) {
  667.                if (!((Component)this).isEnabled()) {
  668.                   return true;
  669.                }
  670.  
  671.                if (this.buttonPressed) {
  672.                   this.thisEvent = new Event(this.Button, var1.when, 1001, var1.x, var1.y, var1.key, var1.modifiers, this.returnValue);
  673.                   this.thisEvent.target = this.Button;
  674.                   this.thisEvent1 = new Event(this, var1.when, 1001, var1.x, var1.y, var1.key, var1.modifiers, this.returnValue);
  675.                   this.update(((Component)this).getGraphics());
  676.                   return true;
  677.                }
  678.             }
  679.  
  680.             return false;
  681.          case 505:
  682.             if (!((Component)this).isEnabled()) {
  683.                return true;
  684.             } else {
  685.                if (this.buttonPressed) {
  686.                   if (!this.stayOn) {
  687.                      this.buttonPressed = false;
  688.                   }
  689.  
  690.                   ((Component)this).repaint();
  691.                   return true;
  692.                }
  693.  
  694.                return false;
  695.             }
  696.          case 1004:
  697.             return false;
  698.          case 1005:
  699.             if (this.buttonPressed) {
  700.                if (!this.stayOn) {
  701.                   this.buttonPressed = false;
  702.                }
  703.  
  704.                ((Component)this).repaint();
  705.                return true;
  706.             }
  707.  
  708.             return false;
  709.          default:
  710.             if (var1.target.equals(this) && !this.stayOn) {
  711.                this.buttonPressed = false;
  712.             }
  713.  
  714.             return false;
  715.       }
  716.    }
  717.  
  718.    public String getLabel() {
  719.       return this.buttonText;
  720.    }
  721.  
  722.    public void setLabel(String var1) {
  723.       this.returnValue = var1;
  724.       if (!this.iconOnly) {
  725.          this.buttonText = var1;
  726.       }
  727.  
  728.       ((Component)this).repaint();
  729.    }
  730. }
  731.