示例#1
0
 private void initDefaults() {
   int divSize;
   int iconSize = IconMgr.getInstance().getSizeForLabel();
   switch (iconSize) {
     case 24:
       divSize = 10;
       break;
     case 32:
       divSize = 14;
       break;
     default:
       divSize = 8;
   }
   this.setDividerSize(divSize);
   this.setBorder(WbSwingUtilities.EMPTY_BORDER);
   this.setContinuousLayout(true);
   expander = new SplitPaneExpander(this);
 }
  private void initSize() {
    Font f = getFont();
    FontMetrics fm = null;
    if (f != null) fm = getFontMetrics(f);

    int height;
    int width;
    int borderHeight = 6;

    if (fm != null) {
      height = (int) (fm.getHeight() * 1.2) + borderHeight;
      width = fm.charWidth('W');
      height = Math.max(22, height);
      width = width * 10;
    } else {
      int size = (int) (IconMgr.getInstance().getSizeForLabel() * 1.2) + borderHeight;
      width = size;
      height = size;
    }
    Dimension d = new Dimension(width, height);
    setMinimumSize(d);
    setPreferredSize(d);
  }