debug Point - Java 2D Graphics

Java examples for 2D Graphics:Point

Description

debug Point

Demo Code


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

import java.awt.Font;
import java.awt.Color;

import java.awt.geom.Point2D;

public class Main {
    public static void debugPoint(Graphics2D graphics2D, Point2D point) {
        double x = point.getX();
        double y = point.getY();
        System.out.println("x: " + x + " y: " + y);
        graphics2D.setFont(new Font("Dialog", Font.BOLD, 13));
        graphics2D.setPaint(Color.red);
        graphics2D.drawString(//from w ww .  jav  a  2  s . com
                String.valueOf(Math.round(x) + "/" + Math.round(y)),
                (float) x, (float) y);
    }
}

Related Tutorials