Java Utililty Methods Draw Round Rectangle

List of utility methods to do Draw Round Rectangle

Description

The list of methods to do Draw Round Rectangle are organized into topic(s).

Method

voiddrawRoundRect(Graphics g, int x, int y, int w, int h)
draw Round Rect
drawRoundRect(g, x, y, w, h, 4, 4);
voiddrawRoundRect3D(Graphics2D g, int x, int y, int width, int height, int radius)
draw Round Rect D
height -= 1;
width -= 1;
g.drawLine(x + radius, y, x + width - radius, y);
g.drawLine(x + radius, y + height, x + width - radius, y + height);
g.drawLine(x, y + radius, x, y + height - radius);
g.drawLine(x + width, y + radius, x + width, y + height - radius);
g.drawArc(x, y, radius * 2, radius * 2, 90, 90);
g.drawArc(x + width - 2 * radius, y, radius * 2, radius * 2, 0, 90);
...
voiddrawRoundedRect(Graphics g, int left, int top, int right, int bottom)
draw Rounded Rect
Graphics2D g2d = (Graphics2D) g;
g.drawLine(left + cornerSize, top, right - cornerSize, top);
g.drawLine(left + cornerSize, bottom, right - cornerSize, bottom);
g.drawLine(left, top + cornerSize, left, bottom - cornerSize);
g.drawLine(right, top + cornerSize, right, bottom - cornerSize);
final Object previousAntiAliasingHint = g2d.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
final Stroke previousStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
...
voiddrawRoundSelectorCorner(Graphics g, Color outline, Color body, int x, int y, int size)
draw Round Selector Corner
g.setColor(outline);
g.fillOval(x - size, y - size, size * 2 + 1, size * 2 + 1);
g.setColor(body);
g.drawOval(x - (size - 1), y - (size - 1), (size - 1) * 2, (size - 1) * 2);