draw Square Point - Java 2D Graphics

Java examples for 2D Graphics:Point

Description

draw Square Point

Demo Code


//package com.java2s;
import java.awt.*;

import java.awt.geom.*;

public class Main {
    public static void drawSquarePoint(Graphics2D g2, Point2D.Double pt,
            int ptSize, Color color) {
        Color origColor = g2.getColor();
        g2.setColor(color);//w  w w .  j a  v  a2  s.  co  m
        Rectangle2D.Double ptRect = new Rectangle2D.Double(pt.x - 4
                * ptSize, pt.y - 4 * ptSize, 8 * ptSize, 8 * ptSize);
        g2.fill(ptRect);
        g2.draw(ptRect);
        g2.setColor(origColor);
    }
}

Related Tutorials