01: import java.awt.*;
02: import java.io.*;
03: 
04: /**
05:    This class 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) return DOTTED_STROKE;
18:       if (this == SOLID) return SOLID_STROKE;
19:       return null;
20:    }
21: 
22:    private static Stroke SOLID_STROKE = new BasicStroke();
23:    private static Stroke DOTTED_STROKE = new BasicStroke(
24:       1.0f, 
25:       BasicStroke.CAP_SQUARE, 
26:       BasicStroke.JOIN_MITER, 
27:       10.0f, 
28:       new float[] { 3.0f, 3.0f }, 
29:       0.0f);
30: }