Java Graphics Draw Border drawEtchedBorder(Graphics g, int x, int y, int width, int height, Color dark, Color bright)

Here you can find the source of drawEtchedBorder(Graphics g, int x, int y, int width, int height, Color dark, Color bright)

Description

draw Etched Border

License

Apache License

Declaration

public static final void drawEtchedBorder(Graphics g, int x, int y,
            int width, int height, Color dark, Color bright) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;

public class Main {
    public static final void drawEtchedBorder(Graphics g, int x, int y,
            int width, int height, Color dark, Color bright) {
        g.translate(x, y);/*from www  .  j  a v a  2 s  .  c  o m*/

        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);

        g.translate(-x, -y);
    }

    public static final void drawEtchedBorder(Graphics g, Rectangle r,
            Color dark, Color bright) {
        drawEtchedBorder(g, r.x, r.y, r.width, r.height, dark, bright);
    }
}

Related

  1. drawBevel3DBorder(Graphics g, int x, int y, int w, int h, Color highlight, Color shadow, Color innerHighlight, Color innerShadow)
  2. drawBorder(Graphics g, Color c, int x, int y, int w, int h)
  3. drawBorder(Graphics2D g2d, Color borderColor, int x, int y, int width, int height)
  4. drawButtonBorder(Graphics g, int x, int y, int w, int h, Color backgroundColor, Color edgeColor, Color cornerColor)
  5. drawDirectionalTriangle(Graphics2D bbg, double heading, double x, double y, double sideLength, Color fillColor, Color borderColor)
  6. drawHighlightBorder(Graphics g, int x, int y, int width, int height, boolean raised, Color shadow, Color highlight)
  7. drawSquareBorder(Graphics2D g, int x, int y, int width, int height, int rounding, Color color, float strokeWidth)
  8. paintBorder(Graphics g, int borderType, Insets insets, Color[] colors, int width, int height)
  9. paintBorder(Rectangle r, Graphics2D g2d)