01: import java.awt.BasicStroke;
02: import java.awt.Stroke;
03: 
04: /**
05:    This enumeration defines line styles of various shapes.
06: */
07: public enum LineStyle
08: {
09:    SOLID, DOTTED;
10: 
11:    /**
12:       Gets a stroke with which to draw this line style.
13:       @return the stroke object that strokes this line style
14:    */
15:    public Stroke getStroke()
16:    {
17:       if (this == DOTTED)
18:          return DOTTED_STROKE;
19:       return SOLID_STROKE;
20:    }
21: 
22:    private static Stroke SOLID_STROKE = new BasicStroke();
23:    private static Stroke DOTTED_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f, new float[] { 3.0f, 3.0f }, 0.0f);
24: }