de.erichseifert.gral
Interface Drawable

All Known Implementing Classes:
AbstractDrawable, BarPlot, DrawableContainer, Label, Legend, PiePlot, PiePlot.PiePlotArea2D, Plot, PlotArea, XYPlot, XYPlot.XYLegend, XYPlot.XYPlotArea2D

public interface Drawable

Interface providing functions for a lightweight component that can be drawn on the screen.

Functions include:


Method Summary
 void draw(DrawingContext context)
          Draws the Drawable with the specified Graphics2D object.
 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.
 

Method Detail

getBounds

Rectangle2D getBounds()
Returns the bounds of this Drawable.

Returns:
a bounding rectangle

setBounds

void setBounds(Rectangle2D bounds)
Sets the bounds to the specified bounding rectangle.

Parameters:
bounds - rectangle containing the component.

setBounds

void setBounds(double x,
               double y,
               double width,
               double height)
Sets the bounds to the specified coordinates, width and height.

Parameters:
x - horizontal position of the upper-left corner
y - vertical position of the upper-left corner
width - horizontal extent
height - vertical extent

getX

double getX()
Returns the x-position of the bounds.

Returns:
horizontal position of the upper-left corner of the bounding rectangle

getY

double getY()
Returns the y-position of the bounds.

Returns:
vertical position of the upper-left corner of the bounding rectangle

getWidth

double getWidth()
Returns the width of the bounds.

Returns:
horizontal extent

getHeight

double getHeight()
Returns the height of the bounds.

Returns:
vertical extent

getPreferredSize

Dimension2D getPreferredSize()
Returns the preferred size of the Drawable.

Returns:
horizontal and vertical extent that wants to be reached

draw

void draw(DrawingContext context)
Draws the Drawable with the specified Graphics2D object.

Parameters:
context - Environment used for drawing


Copyright © 2009-2010. All Rights Reserved.