fi.utu.cs.appearance
Interface Shapable

All Known Subinterfaces:
MultiShapable
All Known Implementing Classes:
Circle, CornerBoard, EndBoard, Goal, GoalCrease, GoalPost, Line, Player, Puck, ShapeAdapter, SideBoard, Spot

public interface Shapable

Provides definitions for objects that can be displayed in the Graphics2D context. When an object implementing the Shapable inteface is displayed, the methods are used followingly:

Graphics2D g2;
Shapable s;
...
if (s.isFilled()) {
    g2.setPaint(s.paint());
    g2.fill(s.shape());
}
if (s.isDrawn()) {
    g2.setPaint(s.color());
    g2.setStroke(s.stroke());
    g2.draw(s.shape());
}
For further information on the Graphics2D class, see the trail "2D Graphics" in The Java Tutorial.

See Also:
Graphics2D

Method Summary
 java.awt.Color color()
          Returns a Color object that is used for drawing the outline.
 boolean isDrawn()
          Returns a boolean value indicating whether the outline of the shape is drawn or not.
 boolean isFilled()
          Returns a boolean value indicating whether the shape is filled or not.
 java.awt.Paint paint()
          Returns a Paint object that is used for filling the shape.
 java.awt.Shape shape()
          Returns a Shape object that defines the appearance of the object.
 java.awt.Stroke stroke()
          Returns a Stroke object that is used for drawing the outline.
 

Method Detail

shape

public java.awt.Shape shape()
Returns a Shape object that defines the appearance of the object.

See Also:
Shape

isDrawn

public boolean isDrawn()
Returns a boolean value indicating whether the outline of the shape is drawn or not.

See Also:
stroke(), color()

stroke

public java.awt.Stroke stroke()
Returns a Stroke object that is used for drawing the outline.

See Also:
isDrawn(), Stroke

color

public java.awt.Color color()
Returns a Color object that is used for drawing the outline.

See Also:
isDrawn(), Color

isFilled

public boolean isFilled()
Returns a boolean value indicating whether the shape is filled or not.

See Also:
paint()

paint

public java.awt.Paint paint()
Returns a Paint object that is used for filling the shape.

See Also:
isFilled(), Paint