de.erichseifert.gral
Class AbstractDrawable

java.lang.Object
  extended by de.erichseifert.gral.AbstractDrawable
All Implemented Interfaces:
Drawable
Direct Known Subclasses:
DrawableContainer, Label, PlotArea

public abstract class AbstractDrawable
extends Object
implements Drawable

Abstract implementation of the Drawable interface. Implemented functionality includes getting and setting the bounding rectangle in different ways.

See Also:
Drawable

Constructor Summary
AbstractDrawable()
          Creates an AbstractDrawable.
 
Method Summary
 Rectangle2D getBounds()
          Returns the bounds of this Drawable.
 double getHeight()
          Returns the height of the bounds.
 Dimension2D getPreferredSize()
          Returns the preferred size of the Drawable.
 double getWidth()
          Returns the width of the bounds.
 double getX()
          Returns the x-position of the bounds.
 double getY()
          Returns the y-position of the bounds.
 void setBounds(double x, double y, double width, double height)
          Sets the bounds to the specified coordinates, width and height.
 void setBounds(Rectangle2D bounds)
          Sets the bounds to the specified bounding rectangle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.erichseifert.gral.Drawable
draw
 

Constructor Detail

AbstractDrawable

public AbstractDrawable()
Creates an AbstractDrawable.

Method Detail

getBounds

public Rectangle2D getBounds()
Description copied from interface: Drawable
Returns the bounds of this Drawable.

Specified by:
getBounds in interface Drawable
Returns:
a bounding rectangle

getHeight

public double getHeight()
Description copied from interface: Drawable
Returns the height of the bounds.

Specified by:
getHeight in interface Drawable
Returns:
vertical extent

getWidth

public double getWidth()
Description copied from interface: Drawable
Returns the width of the bounds.

Specified by:
getWidth in interface Drawable
Returns:
horizontal extent

getX

public double getX()
Description copied from interface: Drawable
Returns the x-position of the bounds.

Specified by:
getX in interface Drawable
Returns:
horizontal position of the upper-left corner of the bounding rectangle

getY

public double getY()
Description copied from interface: Drawable
Returns the y-position of the bounds.

Specified by:
getY in interface Drawable
Returns:
vertical position of the upper-left corner of the bounding rectangle

setBounds

public void setBounds(Rectangle2D bounds)
Description copied from interface: Drawable
Sets the bounds to the specified bounding rectangle.

Specified by:
setBounds in interface Drawable
Parameters:
bounds - rectangle containing the component.

setBounds

public void setBounds(double x,
                      double y,
                      double width,
                      double height)
Description copied from interface: Drawable
Sets the bounds to the specified coordinates, width and height.

Specified by:
setBounds in interface Drawable
Parameters:
x - horizontal position of the upper-left corner
y - vertical position of the upper-left corner
width - horizontal extent
height - vertical extent

getPreferredSize

public Dimension2D getPreferredSize()
Description copied from interface: Drawable
Returns the preferred size of the Drawable.

Specified by:
getPreferredSize in interface Drawable
Returns:
horizontal and vertical extent that wants to be reached


Copyright © 2009-2010. All Rights Reserved.