All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.samskivert.swing.SmartPolygon Maven / Gradle / Ivy

There is a newer version: 1.9
Show newest version
//
// samskivert library - useful routines for java programs
// Copyright (C) 2001-2012 Michael Bayne, et al.
// http://github.com/samskivert/samskivert/blob/master/COPYING

package com.samskivert.swing;

import java.awt.Polygon;
import java.awt.Rectangle;

/**
 * Extends the AWT polygon class and provides a {@link #getBounds} method
 * that doesn't annoyingly make a copy of the bounds rectangle every time
 * it is returned.
 */
public class SmartPolygon extends Polygon
{
    /**
     * Returns the internally cached bounds rectangle for this polygon.
     * Don't modify it!
     */
    @Override
    @SuppressWarnings("deprecation")
    public Rectangle getBoundingBox ()
    {
        return (bounds == null) ? super.getBoundingBox() : bounds;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy