Java Utililty Methods Graphics Draw Border

List of utility methods to do Graphics Draw Border

Description

The list of methods to do Graphics Draw Border are organized into topic(s).

Method

voiddrawBevel3DBorder(Graphics g, int x, int y, int w, int h, Color highlight, Color shadow, Color innerHighlight, Color innerShadow)
Draws a bevel 3d border with the specified colors.
g.translate(x, y);
g.setColor(highlight);
g.drawLine(0, 0, w - 2, 0);
g.drawLine(0, 1, 0, h - 1);
g.setColor(shadow);
g.drawLine(w - 1, 0, w - 1, h - 2);
g.drawLine(1, h - 1, w - 1, h - 1);
x++;
...
voiddrawBorder(Graphics g, Color c, int x, int y, int w, int h)
draw Border
g.setColor(c);
g.drawRect(x, y, w - 1, h - 1);
voiddrawBorder(Graphics2D g2d, Color borderColor, int x, int y, int width, int height)
draw Border
g2d.setColor(borderColor);
g2d.drawRect(0, 0, width, height);
voiddrawButtonBorder(Graphics g, int x, int y, int w, int h, Color backgroundColor, Color edgeColor, Color cornerColor)
Draws a button border for an xp button with the given colors.
g.translate(x, y);
g.setColor(edgeColor);
drawRect(g, 0, 0, w - 1, h - 1);
g.setColor(cornerColor);
g.fillRect(0, 0, 2, 2);
g.fillRect(0, h - 2, 2, 2);
g.fillRect(w - 2, 0, 2, 2);
g.fillRect(w - 2, h - 2, 2, 2);
...
voiddrawDirectionalTriangle(Graphics2D bbg, double heading, double x, double y, double sideLength, Color fillColor, Color borderColor)
Draws a directional triangle on a graphics 2D
Polygon triangle = new Polygon();
triangle.addPoint(0, (int) (1.5 * sideLength));
triangle.addPoint((int) (sideLength / 2), 0);
triangle.addPoint((int) (-sideLength / 2), 0);
bbg.translate(x, y);
bbg.rotate(heading);
bbg.setColor(fillColor);
bbg.fill(triangle);
...
voiddrawEtchedBorder(Graphics g, int x, int y, int width, int height, Color dark, Color bright)
draw Etched Border
g.translate(x, y);
g.setColor(dark);
g.drawRect(0, 0, width - 2, height - 2);
g.setColor(bright);
g.drawLine(1, height - 3, 1, 1);
g.drawLine(1, 1, width - 3, 1);
g.drawLine(0, height - 1, width - 1, height - 1);
g.drawLine(width - 1, height - 1, width - 1, 0);
...
voiddrawHighlightBorder(Graphics g, int x, int y, int width, int height, boolean raised, Color shadow, Color highlight)
Draws a single-line highlight border rectangle.
final Color oldColor = g.getColor();
g.translate(x, y);
g.setColor(raised ? highlight : shadow);
g.drawLine(0, 0, width - 2, 0);
g.drawLine(0, 1, 0, height - 2);
g.setColor(raised ? shadow : highlight);
g.drawLine(width - 1, 0, width - 1, height - 1);
g.drawLine(0, height - 1, width - 2, height - 1);
...
voiddrawSquareBorder(Graphics2D g, int x, int y, int width, int height, int rounding, Color color, float strokeWidth)
draw Square Border
Stroke stroke = g.getStroke();
g.setColor(color);
g.setStroke(new BasicStroke(strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
g.drawRect(x, y, width, height);
g.setStroke(stroke);
voidpaintBorder(Graphics g, int borderType, Insets insets, Color[] colors, int width, int height)
_more_
paintBorder(g, borderType, insets, colors, 0, 0, width, height);
voidpaintBorder(Rectangle r, Graphics2D g2d)
paint Border
final int x2 = r.x + r.width - 1;
final int y2 = r.y + r.height - 1;
g2d.setColor(BORDER_DARK_COLOR);
g2d.drawLine(r.x, r.y, r.x, y2 - 1);
g2d.drawLine(r.x, r.y, x2, r.y);
g2d.setColor(BORDER_LIGHT_COLOR);
g2d.drawLine(r.x, y2, x2, y2);
g2d.drawLine(x2, r.y + 1, x2, y2);
...