Java Graphics Draw Border paintBorder(Rectangle r, Graphics2D g2d)

Here you can find the source of paintBorder(Rectangle r, Graphics2D g2d)

Description

paint Border

License

Open Source License

Declaration

protected static void paintBorder(Rectangle r, Graphics2D g2d) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.*;

public class Main {
    private static final Color BORDER_DARK_COLOR = Color.BLACK;
    private static final Color BORDER_LIGHT_COLOR = Color.LIGHT_GRAY;

    protected static void paintBorder(Rectangle r, Graphics2D g2d) {
        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);//from w ww. ja v a 2s  .  c  o  m
        g2d.drawLine(x2, r.y + 1, x2, y2);
    }
}

Related

  1. drawDirectionalTriangle(Graphics2D bbg, double heading, double x, double y, double sideLength, Color fillColor, Color borderColor)
  2. drawEtchedBorder(Graphics g, int x, int y, int width, int height, Color dark, Color bright)
  3. drawHighlightBorder(Graphics g, int x, int y, int width, int height, boolean raised, Color shadow, Color highlight)
  4. drawSquareBorder(Graphics2D g, int x, int y, int width, int height, int rounding, Color color, float strokeWidth)
  5. paintBorder(Graphics g, int borderType, Insets insets, Color[] colors, int width, int height)
  6. paintBorderDebugInfo(final Graphics g, final JComponent c, final Color color)
  7. paintBorderGlow(final Graphics2D g2, final Shape shape, final int glowWidth)
  8. paintBorderGlow(Graphics2D g2, int glowWidth, Shape clipShape, Color glowOuterHigh, Color glowOuterLow)
  9. paintSequenceMatrix(Graphics2D g2, Rectangle2D rect, String sequence, Function coloring, Function border)