Beispiel #1
0
 /** This draws the "Flush 3D Border" which is used throughout the Metal L&F */
 static void drawFlush3DBorder(Graphics g, int x, int y, int w, int h) {
   g.translate(x, y);
   g.setColor(MetalLookAndFeel.getControlDarkShadow());
   g.drawRect(0, 0, w - 2, h - 2);
   g.setColor(MetalLookAndFeel.getControlHighlight());
   g.drawRect(1, 1, w - 2, h - 2);
   g.setColor(MetalLookAndFeel.getControl());
   g.drawLine(0, h - 1, 1, h - 2);
   g.drawLine(w - 1, 0, w - 2, 1);
   g.translate(-x, -y);
 }
Beispiel #2
0
 static void drawDefaultButtonBorder(Graphics g, int x, int y, int w, int h, boolean active) {
   drawButtonBorder(g, x + 1, y + 1, w - 1, h - 1, active);
   g.translate(x, y);
   g.setColor(MetalLookAndFeel.getControlDarkShadow());
   g.drawRect(0, 0, w - 3, h - 3);
   g.drawLine(w - 2, 0, w - 2, 0);
   g.drawLine(0, h - 2, 0, h - 2);
   g.translate(-x, -y);
 }
Beispiel #3
0
 static void drawDefaultButtonPressedBorder(Graphics g, int x, int y, int w, int h) {
   drawPressed3DBorder(g, x + 1, y + 1, w - 1, h - 1);
   g.translate(x, y);
   g.setColor(MetalLookAndFeel.getControlDarkShadow());
   g.drawRect(0, 0, w - 3, h - 3);
   g.drawLine(w - 2, 0, w - 2, 0);
   g.drawLine(0, h - 2, 0, h - 2);
   g.setColor(MetalLookAndFeel.getControl());
   g.drawLine(w - 1, 0, w - 1, 0);
   g.drawLine(0, h - 1, 0, h - 1);
   g.translate(-x, -y);
 }
  /** 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);
        }
      }
    }
  }
Beispiel #5
0
  protected void paintFocus(
      Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {

    Rectangle focusRect = new Rectangle();
    String text = b.getText();
    boolean isIcon = b.getIcon() != null;

    // If there is text
    if (text != null && !text.equals("")) {
      if (!isIcon) {
        focusRect.setBounds(textRect);
      } else {
        focusRect.setBounds(iconRect.union(textRect));
      }
    }
    // If there is an icon and no text
    else if (isIcon) {
      focusRect.setBounds(iconRect);
    }

    g.setColor(getFocusColor());
    g.drawRect((focusRect.x - 1), (focusRect.y - 1), focusRect.width + 1, focusRect.height + 1);
  }
Beispiel #6
0
 static void drawDisabledBorder(Graphics g, int x, int y, int w, int h) {
   g.translate(x, y);
   g.setColor(MetalLookAndFeel.getControlShadow());
   g.drawRect(0, 0, w - 1, h - 1);
   g.translate(-x, -y);
 }