home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VCafe / main.bin / BaseTabbedPanel.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-08-04  |  12.3 KB  |  688 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.awt.Canvas;
  4. import java.awt.Color;
  5. import java.awt.Component;
  6. import java.awt.Container;
  7. import java.awt.Dimension;
  8. import java.awt.Event;
  9. import java.awt.Font;
  10. import java.awt.FontMetrics;
  11. import java.awt.Graphics;
  12. import java.awt.Insets;
  13. import java.awt.LayoutManager;
  14. import java.awt.Panel;
  15. import java.awt.Polygon;
  16. import java.awt.Rectangle;
  17. import java.util.Vector;
  18.  
  19. public abstract strictfp class BaseTabbedPanel extends Panel {
  20.    public static final int TOP = 0;
  21.    public static final int BOTTOM = 1;
  22.    public static final int ROUNDED = 0;
  23.    public static final int SQUARE = 1;
  24.    private int TF_LEFT;
  25.    private int TF_RIGHT;
  26.    private int TF_TOP;
  27.    private int TF_BOTTOM;
  28.    private int TF_BTN_HEIGHT;
  29.    private Vector vLabels;
  30.    private Vector vEnabled;
  31.    private Vector vPolys;
  32.    protected int curIndex;
  33.    private Font fReg;
  34.    private Font fSel;
  35.    private Component userPanel;
  36.    private int iTabsPosition;
  37.    private int iTabsStyle;
  38.    private int osAdjustment;
  39.    private int firstVisibleTab;
  40.    private DirectionButton dbLeft;
  41.    private DirectionButton dbRight;
  42.    private Polygon nullPoly;
  43.    private int lastWidth;
  44.    private Insets btpInsets;
  45.  
  46.    public BaseTabbedPanel() {
  47.       this(0, 0);
  48.    }
  49.  
  50.    public BaseTabbedPanel(boolean bTabsOnTop) {
  51.       this(bTabsOnTop ? 0 : 1, bTabsOnTop ? 0 : 1);
  52.    }
  53.  
  54.    public BaseTabbedPanel(int tabsPostion, int tabsStyle) {
  55.       this.TF_LEFT = 9;
  56.       this.TF_RIGHT = -9;
  57.       this.TF_TOP = 30;
  58.       this.TF_BOTTOM = -9;
  59.       this.TF_BTN_HEIGHT = 20;
  60.       this.curIndex = -1;
  61.       this.iTabsPosition = 0;
  62.       this.iTabsStyle = 0;
  63.       this.lastWidth = -1;
  64.       this.vLabels = new Vector();
  65.       this.vEnabled = new Vector();
  66.       this.vPolys = new Vector();
  67.       this.btpInsets = new Insets(0, 0, 0, 0);
  68.       this.setTabsInfo(tabsPostion, tabsStyle);
  69.       this.fReg = new Font("Helvetica", 0, 12);
  70.       this.fSel = new Font("Helvetica", 1, 12);
  71.       if (System.getProperty("os.name").startsWith("S")) {
  72.          this.osAdjustment = -1;
  73.       } else {
  74.          this.osAdjustment = 0;
  75.       }
  76.  
  77.       super.setLayout((LayoutManager)null);
  78.       this.dbLeft = new DirectionButton(0);
  79.       this.dbRight = new DirectionButton(1);
  80.       this.dbLeft.setShowFocus(false);
  81.       this.dbRight.setShowFocus(false);
  82.       this.dbLeft.shrinkTriangle(1, 1, 0, 1);
  83.       this.dbRight.shrinkTriangle(1, 1, 0, 1);
  84.       super.add(this.dbLeft, -1);
  85.       super.add(this.dbRight, -1);
  86.       this.nullPoly = new Polygon();
  87.       this.nullPoly.addPoint(0, 0);
  88.       this.nullPoly.addPoint(1, 1);
  89.       this.nullPoly.addPoint(0, 0);
  90.    }
  91.  
  92.    public void setTabsPosition(int tabsPosition) {
  93.       if (this.iTabsPosition != tabsPosition) {
  94.          this.setTabsInfo(tabsPosition, this.iTabsStyle);
  95.       }
  96.  
  97.    }
  98.  
  99.    public int getTabsPosition() {
  100.       return this.iTabsPosition;
  101.    }
  102.  
  103.    public void setTabsStyle(int tabsStyle) {
  104.       if (this.iTabsStyle != tabsStyle) {
  105.          this.setTabsInfo(this.iTabsPosition, tabsStyle);
  106.       }
  107.  
  108.    }
  109.  
  110.    public int getTabsStyle() {
  111.       return this.iTabsStyle;
  112.    }
  113.  
  114.    public void setTabsInfo(int tabsPosition, int tabsStyle) {
  115.       this.iTabsPosition = tabsPosition;
  116.       if (this.iTabsPosition == 0) {
  117.          this.iTabsStyle = 0;
  118.       } else {
  119.          this.iTabsStyle = tabsStyle;
  120.       }
  121.  
  122.       if (this.iTabsStyle == 0) {
  123.          this.TF_BTN_HEIGHT = 20;
  124.       } else {
  125.          this.TF_BTN_HEIGHT = 17;
  126.       }
  127.  
  128.       ((Component)this).repaint();
  129.    }
  130.  
  131.    public void setPanel(Component p) {
  132.       this.removeAll();
  133.       this.userPanel = p;
  134.       if (this.userPanel != null) {
  135.          super.add(this.userPanel, -1);
  136.          this.userPanel.requestFocus();
  137.       }
  138.  
  139.    }
  140.  
  141.    public void showPanel(Component p) {
  142.       if (this.userPanel != null) {
  143.          this.userPanel.hide();
  144.       }
  145.  
  146.       this.userPanel = p;
  147.       if (this.userPanel != null) {
  148.          Component[] comps = ((Container)this).getComponents();
  149.          int l = comps.length;
  150.  
  151.          int x;
  152.          for(x = 0; x < l && comps[x] != this.userPanel; ++x) {
  153.          }
  154.  
  155.          if (x == l) {
  156.             super.add(this.userPanel, -1);
  157.          }
  158.  
  159.          this.userPanel.show();
  160.          this.userPanel.requestFocus();
  161.          ((Container)this).validate();
  162.          ((Component)this).repaint();
  163.       }
  164.  
  165.    }
  166.  
  167.    public int addTab(String sLabel, boolean bEnabled) {
  168.       this.vLabels.addElement(sLabel);
  169.       this.vEnabled.addElement(new Boolean(bEnabled));
  170.       int index = this.vLabels.size() - 1;
  171.       if (this.curIndex == -1 && bEnabled) {
  172.          this.showTab(index);
  173.       }
  174.  
  175.       return index;
  176.    }
  177.  
  178.    public synchronized void setTab(String sLabel, boolean bEnabled, int index) {
  179.       if (index >= 0 && index < this.vLabels.size()) {
  180.          if (index != this.curIndex || bEnabled) {
  181.             try {
  182.                this.vLabels.setElementAt(sLabel, index);
  183.                this.vEnabled.setElementAt(new Boolean(bEnabled), index);
  184.                ((Component)this).repaint();
  185.             } catch (ArrayIndexOutOfBoundsException var4) {
  186.             }
  187.          }
  188.       }
  189.    }
  190.  
  191.    public synchronized void setLabel(String sLabel, int index) {
  192.       if (index >= 0 && index < this.vLabels.size()) {
  193.          try {
  194.             this.vLabels.setElementAt(sLabel, index);
  195.             ((Component)this).repaint();
  196.          } catch (ArrayIndexOutOfBoundsException var3) {
  197.          }
  198.       }
  199.    }
  200.  
  201.    public synchronized String getLabel(int index) {
  202.       if (index >= 0 && index < this.vLabels.size()) {
  203.          try {
  204.             return (String)this.vLabels.elementAt(index);
  205.          } catch (ArrayIndexOutOfBoundsException var2) {
  206.             return "";
  207.          }
  208.       } else {
  209.          return "";
  210.       }
  211.    }
  212.  
  213.    public synchronized void setEnabled(boolean bEnabled, int index) {
  214.       if (index >= 0 && index < this.vLabels.size()) {
  215.          if (index != this.curIndex || bEnabled) {
  216.             try {
  217.                this.vEnabled.setElementAt(new Boolean(bEnabled), index);
  218.                ((Component)this).repaint();
  219.             } catch (ArrayIndexOutOfBoundsException var3) {
  220.             }
  221.          }
  222.       }
  223.    }
  224.  
  225.    public void showTab(int index) {
  226.       if (index >= 0 && index < this.vLabels.size() && index != this.curIndex) {
  227.          if (this.tabIsEnabled(index)) {
  228.             this.curIndex = index;
  229.             ((Container)this).invalidate();
  230.             ((Container)this).validate();
  231.             ((Component)this).repaint();
  232.             ((Component)this).postEvent(new Event(this, 1001, (Object)null));
  233.          }
  234.  
  235.       }
  236.    }
  237.  
  238.    public boolean tabIsEnabled(int index) {
  239.       if (index >= 0 && index < this.vLabels.size()) {
  240.          try {
  241.             Boolean bool = (Boolean)this.vEnabled.elementAt(index);
  242.             if (bool) {
  243.                return true;
  244.             }
  245.          } catch (ArrayIndexOutOfBoundsException var3) {
  246.          }
  247.  
  248.          return false;
  249.       } else {
  250.          return false;
  251.       }
  252.    }
  253.  
  254.    public int currentTabIndex() {
  255.       return this.curIndex;
  256.    }
  257.  
  258.    public void enableTab(boolean bEnable, int index) {
  259.       if (index >= 0 && index < this.vEnabled.size() && index != this.curIndex) {
  260.          try {
  261.             this.vEnabled.setElementAt(new Boolean(bEnable), index);
  262.             ((Component)this).repaint();
  263.          } catch (ArrayIndexOutOfBoundsException var3) {
  264.          }
  265.       }
  266.    }
  267.  
  268.    public void removeTab(int index) {
  269.       if (index >= 0 && index < this.vEnabled.size() && index != this.curIndex) {
  270.          try {
  271.             this.vLabels.removeElementAt(index);
  272.             this.vEnabled.removeElementAt(index);
  273.             ((Component)this).repaint();
  274.          } catch (ArrayIndexOutOfBoundsException var2) {
  275.          }
  276.       }
  277.    }
  278.  
  279.    public void removeAllTabs() {
  280.       this.vLabels = new Vector();
  281.       this.vEnabled = new Vector();
  282.       this.vPolys = new Vector();
  283.       this.curIndex = -1;
  284.       this.firstVisibleTab = 0;
  285.       this.lastWidth = -1;
  286.       this.removeAll();
  287.       ((Component)this).repaint();
  288.    }
  289.  
  290.    public void layout() {
  291.       Rectangle r = ((Component)this).bounds();
  292.       int width = r.width - this.TF_LEFT + this.TF_RIGHT;
  293.       if (width >= 0) {
  294.          int height = r.height - this.TF_TOP + this.TF_BOTTOM;
  295.          if (height >= 0) {
  296.             int col = this.TF_LEFT;
  297.             int row = 0;
  298.             if (this.iTabsPosition == 0) {
  299.                row = this.TF_TOP;
  300.             } else {
  301.                row = this.TF_TOP - this.TF_BTN_HEIGHT;
  302.             }
  303.  
  304.             if (this.userPanel != null) {
  305.                this.userPanel.reshape(col + 3, row + 3, width - 6, height - 5);
  306.                this.userPanel.invalidate();
  307.                this.userPanel.validate();
  308.                if (this.userPanel instanceof Canvas || this.userPanel instanceof Panel) {
  309.                   this.userPanel.repaint();
  310.                   return;
  311.                }
  312.  
  313.                ((Component)this).repaint();
  314.             }
  315.  
  316.          }
  317.       }
  318.    }
  319.  
  320.    public synchronized void paint(Graphics g) {
  321.       Rectangle r = ((Component)this).bounds();
  322.       int width = r.width - this.TF_LEFT + this.TF_RIGHT;
  323.       if (width >= 0) {
  324.          int height = r.height - this.TF_TOP + this.TF_BOTTOM;
  325.          if (height >= 0) {
  326.             if (r.width > this.lastWidth) {
  327.                this.firstVisibleTab = 0;
  328.             }
  329.  
  330.             this.lastWidth = r.width;
  331.             int col = this.TF_LEFT;
  332.             Color c = g.getColor();
  333.             g.setColor(((Component)this).getBackground());
  334.             g.fillRect(0, 0, r.width, r.height);
  335.             int row;
  336.             if (this.iTabsPosition == 0) {
  337.                row = this.TF_TOP;
  338.             } else {
  339.                row = this.TF_TOP - this.TF_BTN_HEIGHT;
  340.             }
  341.  
  342.             g.setColor(Color.white);
  343.             g.drawLine(col, row, col + width - 1, row);
  344.             g.drawLine(col, row, col, row + height - 1);
  345.             g.setColor(Color.gray);
  346.             g.drawLine(col + 2, row + height - 2, col + width - 2, row + height - 2);
  347.             g.drawLine(col + width - 2, row + 2, col + width - 2, row + height - 2);
  348.             g.setColor(Color.black);
  349.             g.drawLine(col + 1, row + height - 1, col + width - 1, row + height - 1);
  350.             g.drawLine(col + width - 1, row + 1, col + width - 1, row + height - 1);
  351.             int x2 = this.TF_LEFT + 8;
  352.             int x3 = 0;
  353.             int x4 = this.TF_LEFT;
  354.             int sze = this.vLabels.size();
  355.             this.vPolys.removeAllElements();
  356.             Font f = g.getFont();
  357.             FontMetrics fm = ((Component)this).getFontMetrics(this.fReg);
  358.             FontMetrics fms = ((Component)this).getFontMetrics(this.fSel);
  359.             int labelWidth = 0;
  360.  
  361.             int w;
  362.             for(w = 0; w < this.firstVisibleTab; ++w) {
  363.                this.vPolys.addElement(this.nullPoly);
  364.             }
  365.  
  366.             if (w > 0) {
  367.                x4 += 2;
  368.             }
  369.  
  370.             for(; w < sze; ++w) {
  371.                Polygon p = new Polygon();
  372.  
  373.                try {
  374.                   String sLabel = (String)this.vLabels.elementAt(w);
  375.                   if (w == this.curIndex) {
  376.                      labelWidth = fms.stringWidth(sLabel);
  377.                   } else {
  378.                      labelWidth = fm.stringWidth(sLabel);
  379.                   }
  380.  
  381.                   int y1;
  382.                   int y2;
  383.                   if (this.iTabsPosition == 0) {
  384.                      y1 = this.TF_TOP - this.TF_BTN_HEIGHT;
  385.                      y2 = this.TF_TOP - 1;
  386.                   } else {
  387.                      y1 = r.height + this.TF_BOTTOM + 1;
  388.                      y2 = r.height + this.TF_BOTTOM - this.TF_BTN_HEIGHT;
  389.                   }
  390.  
  391.                   int x1;
  392.                   if (this.iTabsStyle == 0) {
  393.                      x1 = x4 + 2;
  394.                      x2 = x1 + labelWidth + 13;
  395.                   } else {
  396.                      x1 = x2 - 7;
  397.                      x2 = x1 + labelWidth + 28;
  398.                   }
  399.  
  400.                   if (x2 + 36 - this.TF_RIGHT > r.width) {
  401.                      break;
  402.                   }
  403.  
  404.                   if (this.iTabsPosition == 0) {
  405.                      if (w == this.curIndex) {
  406.                         y1 -= 3;
  407.                         x1 -= 2;
  408.                      }
  409.  
  410.                      g.setColor(Color.white);
  411.                      if (this.curIndex == w + 1) {
  412.                         g.drawLine(x1 + 2, y1, x2 - 2, y1);
  413.                      } else {
  414.                         g.drawLine(x1 + 2, y1, x2, y1);
  415.                      }
  416.  
  417.                      if (this.curIndex != w - 1) {
  418.                         g.drawLine(x1, y1 + 2, x1, y2);
  419.                         x3 = x1;
  420.                      } else {
  421.                         x3 = x1 + 1;
  422.                      }
  423.  
  424.                      g.drawLine(x1 + 1, y1 + 1, x1 + 1, y1 + 1);
  425.                      if (this.curIndex != w + 1) {
  426.                         g.setColor(Color.gray);
  427.                         g.drawLine(x2, y1, x2, y2);
  428.                         g.setColor(Color.black);
  429.                         g.drawLine(x2 + 1, y1 + 2, x2 + 1, y2);
  430.                         x4 = x2;
  431.                      } else {
  432.                         x4 = x2 - 1;
  433.                      }
  434.                   } else if (this.iTabsStyle != 1) {
  435.                      if (w == this.curIndex) {
  436.                         y1 += 3;
  437.                         x1 -= 2;
  438.                      }
  439.  
  440.                      g.setColor(Color.white);
  441.                      if (this.curIndex == w + 1) {
  442.                         g.drawLine(x1 + 2, y1, x2 - 2, y1);
  443.                      } else {
  444.                         g.drawLine(x1 + 2, y1, x2, y1);
  445.                      }
  446.  
  447.                      if (this.curIndex != w - 1) {
  448.                         g.drawLine(x1, y1 - 2, x1, y2);
  449.                         x3 = x1;
  450.                      } else {
  451.                         x3 = x1 + 1;
  452.                      }
  453.  
  454.                      g.drawLine(x1 + 1, y1 - 1, x1 + 1, y1 - 1);
  455.                      if (this.curIndex != w + 1) {
  456.                         g.setColor(Color.gray);
  457.                         g.drawLine(x2, y1, x2, y2);
  458.                         g.setColor(Color.black);
  459.                         g.drawLine(x2 + 1, y1 - 2, x2 + 1, y2);
  460.                         x4 = x2;
  461.                      } else {
  462.                         x4 = x2 - 1;
  463.                      }
  464.                   } else {
  465.                      g.setColor(Color.gray);
  466.                      g.drawLine(x1 + 9, y1, x2 - 9, y1);
  467.                      g.setColor(Color.black);
  468.                      if (w != 0 && w != this.curIndex) {
  469.                         g.drawLine(x1 + 4, y1 - 9, x1 + 9, y1);
  470.                         p.addPoint(x1 + 9, y2);
  471.                         p.addPoint(x1 + 4, y1 - 9);
  472.                      } else {
  473.                         g.drawLine(x1, y2, x1 + 9, y1);
  474.                         p.addPoint(x1, y2);
  475.                      }
  476.  
  477.                      p.addPoint(x1 + 9, y1);
  478.                      p.addPoint(x2 - 9, y1);
  479.                      if (w + 1 == this.curIndex) {
  480.                         g.drawLine(x2 - 5, y1 - 9, x2 - 9, y1);
  481.                         p.addPoint(x2 - 5, y1);
  482.                         p.addPoint(x2 - 9, y2);
  483.                      } else {
  484.                         g.drawLine(x2, y2, x2 - 9, y1);
  485.                         p.addPoint(x2, y2);
  486.                      }
  487.  
  488.                      if (w != 1 && w != this.curIndex) {
  489.                         p.addPoint(x1 + 9, y2);
  490.                      } else {
  491.                         p.addPoint(x1, y2);
  492.                      }
  493.                   }
  494.  
  495.                   if (w == this.curIndex) {
  496.                      if (this.iTabsPosition == 0) {
  497.                         ++y2;
  498.                      } else {
  499.                         --y2;
  500.                      }
  501.  
  502.                      g.setColor(((Component)this).getBackground());
  503.                      g.drawLine(x1 + 1, y2, x2, y2);
  504.                      if (this.iTabsPosition == 1) {
  505.                         g.drawLine(x1 + 1, y2 - 1, x2, y2 - 1);
  506.                      }
  507.  
  508.                      g.setFont(this.fSel);
  509.                   } else {
  510.                      g.setFont(this.fReg);
  511.                   }
  512.  
  513.                   if (this.iTabsStyle == 0) {
  514.                      p.addPoint(x3, y2);
  515.                      p.addPoint(x4, y2);
  516.                      p.addPoint(x4, y1);
  517.                      p.addPoint(x3, y1);
  518.                      p.addPoint(x3, y2);
  519.                   }
  520.  
  521.                   this.vPolys.addElement(p);
  522.                   Boolean bool = (Boolean)this.vEnabled.elementAt(w);
  523.                   if (bool) {
  524.                      g.setColor(Color.black);
  525.                   } else {
  526.                      g.setColor(Color.gray);
  527.                   }
  528.  
  529.                   if (this.iTabsPosition == 0) {
  530.                      g.drawString(sLabel, x1 + 8, y1 + 15 + this.osAdjustment);
  531.                   } else if (this.iTabsStyle == 0) {
  532.                      g.drawString(sLabel, x1 + 8, y1 - 6 + this.osAdjustment);
  533.                   } else {
  534.                      g.drawString(sLabel, x1 + 14, y1 - 4 + this.osAdjustment);
  535.                   }
  536.                } catch (ArrayIndexOutOfBoundsException var23) {
  537.                }
  538.             }
  539.  
  540.             if (this.firstVisibleTab <= 0 && w >= sze) {
  541.                this.dbLeft.hide();
  542.                this.dbRight.hide();
  543.             } else {
  544.                this.dbLeft.show();
  545.                this.dbRight.show();
  546.                if (this.firstVisibleTab > 0) {
  547.                   this.dbLeft.enable();
  548.                } else {
  549.                   this.dbLeft.disable();
  550.                }
  551.  
  552.                if (w < sze) {
  553.                   this.dbRight.enable();
  554.                } else {
  555.                   this.dbRight.disable();
  556.                }
  557.  
  558.                if (this.iTabsPosition == 0) {
  559.                   this.dbLeft.reshape(r.width - 33 + this.TF_RIGHT, this.TF_TOP - 16, 16, 15);
  560.                   this.dbRight.reshape(r.width - 16 + this.TF_RIGHT, this.TF_TOP - 16, 16, 15);
  561.                } else {
  562.                   this.dbLeft.reshape(r.width - 33 + this.TF_RIGHT, r.height + this.TF_BOTTOM - this.TF_BTN_HEIGHT, 16, 15);
  563.                   this.dbRight.reshape(r.width - 16 + this.TF_RIGHT, r.height + this.TF_BOTTOM - this.TF_BTN_HEIGHT, 16, 15);
  564.                }
  565.             }
  566.  
  567.             while(w < sze) {
  568.                this.vPolys.addElement(this.nullPoly);
  569.                ++w;
  570.             }
  571.  
  572.             g.setFont(f);
  573.             g.setColor(c);
  574.          }
  575.       }
  576.    }
  577.  
  578.    public boolean handleEvent(Event evt) {
  579.       switch (evt.id) {
  580.          case 501:
  581.             int sizeR = this.vPolys.size();
  582.  
  583.             for(int x = 0; x < sizeR; ++x) {
  584.                try {
  585.                   Polygon p = (Polygon)this.vPolys.elementAt(x);
  586.                   if (p != this.nullPoly && p.inside(evt.x, evt.y)) {
  587.                      this.showTab(x);
  588.                      return true;
  589.                   }
  590.                } catch (ArrayIndexOutOfBoundsException var5) {
  591.                }
  592.             }
  593.             break;
  594.          case 1001:
  595.             if (evt.target == this.dbLeft) {
  596.                if (--this.firstVisibleTab < 0) {
  597.                   this.firstVisibleTab = 0;
  598.                } else {
  599.                   ((Component)this).repaint();
  600.                }
  601.  
  602.                return true;
  603.             }
  604.  
  605.             if (evt.target == this.dbRight) {
  606.                int sze = this.vLabels.size();
  607.                if (++this.firstVisibleTab == sze) {
  608.                   --this.firstVisibleTab;
  609.                } else {
  610.                   ((Component)this).repaint();
  611.                }
  612.  
  613.                return true;
  614.             }
  615.       }
  616.  
  617.       return super.handleEvent(evt);
  618.    }
  619.  
  620.    public Component add(Component comp) {
  621.       return comp;
  622.    }
  623.  
  624.    public synchronized Component add(Component comp, int pos) {
  625.       return comp;
  626.    }
  627.  
  628.    public synchronized Component add(String name, Component comp) {
  629.       return comp;
  630.    }
  631.  
  632.    public synchronized void remove(Component comp) {
  633.       if (comp != this.dbLeft && comp != this.dbRight) {
  634.          super.remove(comp);
  635.          if (comp == this.userPanel) {
  636.             this.userPanel = null;
  637.          }
  638.  
  639.       }
  640.    }
  641.  
  642.    public synchronized void removeAll() {
  643.       super.removeAll();
  644.       super.add(this.dbLeft, -1);
  645.       super.add(this.dbRight, -1);
  646.       this.userPanel = null;
  647.    }
  648.  
  649.    public void setLayout(LayoutManager mgr) {
  650.    }
  651.  
  652.    public Insets insets() {
  653.       this.btpInsets = super.insets();
  654.       Insets var10000 = this.btpInsets;
  655.       var10000.left += this.TF_LEFT + 3;
  656.       var10000 = this.btpInsets;
  657.       var10000.right += 6 - this.TF_RIGHT;
  658.       if (this.iTabsPosition == 0) {
  659.          var10000 = this.btpInsets;
  660.          var10000.top += this.TF_TOP + 3;
  661.          var10000 = this.btpInsets;
  662.          var10000.bottom += 5 - this.TF_BOTTOM;
  663.       } else {
  664.          var10000 = this.btpInsets;
  665.          var10000.top += this.TF_TOP - this.TF_BTN_HEIGHT + 3;
  666.          var10000 = this.btpInsets;
  667.          var10000.bottom += this.TF_BTN_HEIGHT + 5 - this.TF_BOTTOM;
  668.       }
  669.  
  670.       return this.btpInsets;
  671.    }
  672.  
  673.    public Dimension preferredSize() {
  674.       Dimension s = ((Component)this).size();
  675.       Dimension m = this.minimumSize();
  676.       return new Dimension(Math.max(s.width, m.width), Math.max(s.height, m.height));
  677.    }
  678.  
  679.    public Dimension minimumSize() {
  680.       if (this.userPanel != null) {
  681.          Dimension s = this.userPanel.minimumSize();
  682.          return new Dimension(s.width + this.btpInsets.left + this.btpInsets.right, s.height + this.btpInsets.top + this.btpInsets.bottom);
  683.       } else {
  684.          return new Dimension(100, 100);
  685.       }
  686.    }
  687. }
  688.