Пример #1
0
 protected void setButtonsSize() {
   int nMaxWidth = 0, nMaxHeight = 0;
   Dimension objSize;
   Iterator objIterator = buttons.values().iterator();
   while (objIterator.hasNext()) {
     JButton objButton = (JButton) objIterator.next();
     objButton.setPreferredSize(null);
     objSize = objButton.getPreferredSize();
     nMaxWidth = Math.max(nMaxWidth, objSize.width);
     nMaxHeight = Math.max(nMaxHeight, objSize.height);
   }
   objSize = new Dimension(nMaxWidth, nMaxHeight);
   d = objSize;
   objIterator = buttons.values().iterator();
   while (objIterator.hasNext()) {
     ((JButton) objIterator.next()).setPreferredSize(objSize);
   }
 }
  public void tabRemoveHighlight(int tabIndex) {
    Iterator<Integer> highlightedIter = highlightedTabs.iterator();

    while (highlightedIter.hasNext()) {
      if (highlightedIter.next().intValue() == tabIndex) {
        highlightedIter.remove();
        break;
      }
    }
  }
Пример #3
0
 public void setShowNames(boolean b) {
   if (shownames == b) return;
   shownames = b;
   Iterator it = buttons.keySet().iterator();
   while (it.hasNext()) {
     String command = (String) it.next();
     JButton button = (JButton) buttons.get(command);
     button.setText((shownames) ? command : "");
     button.setToolTipText((!shownames) ? command : "");
   }
   setButtonsSize();
 }
  /** special paint handler for merged cell regions */
  protected void paintSpans(Graphics g, int rowMin, int rowMax, int colMin, int colMax) {
    Rectangle clip = g.getClipBounds();
    Iterator cell = grid.getSpanModel().getSpanIterator();
    while (cell.hasNext()) {
      CellSpan span = (CellSpan) cell.next();
      Rectangle cellBounds = grid.getCellBounds(span.getRow(), span.getColumn());

      // Only paint cell if visible
      if (span.getLastRow() >= rowMin
          && span.getLastColumn() >= colMin
          && span.getFirstRow() <= rowMax
          && span.getFirstColumn() <= colMax) {
        paintCell(g, cellBounds, span.getRow(), span.getColumn());
        // Paint grid line around cell
        if (grid.getShowGrid()) {
          g.setColor(grid.getGridColor());
          g.drawRect(cellBounds.x, cellBounds.y, cellBounds.width, cellBounds.height);
        }
      }
    }
  }