draw Bounding Box - Java java.awt

Java examples for java.awt:Graphics2D

Description

draw Bounding Box

Demo Code


//package com.java2s;

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

public class Main {
    public static void drawBoundingBox(Color c, Graphics g, int x1, int y1,
            int x2, int y2) {
        g.setColor(c);/*from w w w .ja  v a 2  s .c o  m*/
        g.drawLine(x1, y1, x2, y1);
        g.drawLine(x1, y1, x1, y2);
        g.drawLine(x1, y2, x2, y2);
        g.drawLine(x2, y1, x2, y2);
    }
}

Related Tutorials