1: import java.awt.BasicStroke;
2: import java.awt.Stroke;
4: /**
5: This enumeration defines line styles of various shapes.
6: */
7: public enum LineStyle
8: {
9: SOLID, DOTTED;
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: }
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: }