Package java.awt

Examples of java.awt.Graphics2D.drawRoundRect()


  private void paintBorder(Graphics g, Dimension size) {
    Graphics2D g2d = createGraphics(g);
    try {
      g2d.setStroke(new BasicStroke(2f));
      g2d.setColor(BORDER_COLOR);
      g2d.drawRoundRect(0, 0, size.width-1, size.height-1, 9, 9);
    } finally {
      g2d.dispose();
    }
  }
View Full Code Here


    public void paintBorder(final Component c, final Graphics g, final int x, final int y,
        final int width, final int height) {
      final Graphics2D g2 = (Graphics2D) g;
      g2.setColor(Color.darkGray);
      final int arc = 10;
      g2.drawRoundRect(x, y, width - 1, height - 1, arc, arc);
    }
  }
}
View Full Code Here

            // Draw 'held' text rectangle and outline
            //g2d.setColor(Color.green);
            g2d.setColor(new Color(0, 120, 0));
            g2d.fillRoundRect(heldRectX, heldRectY, heldRectWidth, heldRectHeight, heldRectRadius, heldRectRadius);
            g2d.setColor(Color.white);
            g2d.drawRoundRect(heldRectX, heldRectY, heldRectWidth, heldRectHeight, heldRectRadius, heldRectRadius);

            // Draw 'held' text
            g2d.setFont(heldFont);
            g2d.setColor(Color.white);
            g2d.drawString(heldText, heldTextX, heldTextY);
View Full Code Here

            BasicStroke b_stroke = new BasicStroke(stroke_width);
            graphics.setColor(ColorMapper.getColorByName(stroke));
            graphics.setStroke(b_stroke);

            if ((arcwidth != 0) || (archeight != 0)) {
                graphics.drawRoundRect(0, 0, width, height, arcwidth, archeight);
            } else {
                graphics.drawRect(0, 0, width, height);
            }
        }
View Full Code Here

    g2.setColor(GENERAL_BACKGROUND_COLOR);
    g2.fillRoundRect(5, 5, getWidth() - 10, getHeight() - 10, 5, 5);
    g2.setColor(Color.BLACK);
    g2.setStroke(new BasicStroke(2));
    g2.drawRoundRect(5, 5, getWidth() - 10, getHeight() - 10, 5, 5);

    super.paint(g2);
  }

  private class LabelResult extends JLabel {
View Full Code Here

      g2.setFont(g2.getFont().deriveFont(Font.BOLD));
      g2.setColor(TOTAL_BACKGROUND_COLOR);
      g2.fillRoundRect(5, 5, getWidth() - 10, getHeight() - 10, 5, 5);
      g2.setColor(Color.BLACK);
      g2.setStroke(new BasicStroke(2));
      g2.drawRoundRect(5, 5, getWidth() - 10, getHeight() - 10, 5, 5);

      g.setColor(TEXT_COLOR);

      FontMetrics metrics = g.getFontMetrics();
      int textWidth = metrics.stringWidth(txt);
View Full Code Here

      // Draw border
      if ((xMin < xMax) && (yMin < yMax)) {
        g2.setColor(textBackground);
        g2.fillRoundRect((int) xMin, (int) yMin, (int) (xMax - xMin), (int) (yMax - yMin), 10, 10);
        g2.setColor(textBorder);
        g2.drawRoundRect((int) xMin, (int) yMin, (int) (xMax - xMin), (int) (yMax - yMin), 10, 10);
      }

      // Draw text
      g2.setColor(getForeground());
      if (layoutApplication != null) {
View Full Code Here

                RenderingHints.VALUE_ANTIALIAS_ON);
       
        Color color = Utilities.deriveColorHSB(c.getBackground(), 0, 0, -.3f);
//        Color color = Color.RED;
        g2.setColor(ColorUtil.setAlpha(color, 40));       
        g2.drawRoundRect(x, y + 2, width - 1, height - 3, cornerRadius, cornerRadius);
        g2.setColor(ColorUtil.setAlpha(color, 90));       
        g2.drawRoundRect(x, y + 1, width - 1, height - 2, cornerRadius, cornerRadius);
        g2.setColor(ColorUtil.setAlpha(color, 255));       
        g2.drawRoundRect(x, y, width - 1, height - 1, cornerRadius, cornerRadius);
View Full Code Here

        Color color = Utilities.deriveColorHSB(c.getBackground(), 0, 0, -.3f);
//        Color color = Color.RED;
        g2.setColor(ColorUtil.setAlpha(color, 40));       
        g2.drawRoundRect(x, y + 2, width - 1, height - 3, cornerRadius, cornerRadius);
        g2.setColor(ColorUtil.setAlpha(color, 90));       
        g2.drawRoundRect(x, y + 1, width - 1, height - 2, cornerRadius, cornerRadius);
        g2.setColor(ColorUtil.setAlpha(color, 255));       
        g2.drawRoundRect(x, y, width - 1, height - 1, cornerRadius, cornerRadius);

        g2.dispose();           
    }
View Full Code Here

        g2.setColor(ColorUtil.setAlpha(color, 40));       
        g2.drawRoundRect(x, y + 2, width - 1, height - 3, cornerRadius, cornerRadius);
        g2.setColor(ColorUtil.setAlpha(color, 90));       
        g2.drawRoundRect(x, y + 1, width - 1, height - 2, cornerRadius, cornerRadius);
        g2.setColor(ColorUtil.setAlpha(color, 255));       
        g2.drawRoundRect(x, y, width - 1, height - 1, cornerRadius, cornerRadius);

        g2.dispose();           
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.