get Rectangle Top Center - Java 2D Graphics

Java examples for 2D Graphics:Rectangle

Description

get Rectangle Top Center

Demo Code


//package com.java2s;
import java.awt.Point;
import java.awt.Rectangle;

public class Main {
    public static Point getTopCenter(Rectangle bounds) {
        Point pt = bounds.getLocation();
        pt.translate(bounds.width / 2, 0);
        return pt;
    }//  w  w w  .jav a2s  .c o  m
}

Related Tutorials