001package horstmann.ch08_umleditor;
002import java.awt.BasicStroke;
003import java.awt.Stroke;
004
005/**
006   This enumeration defines line styles of various shapes.
007 */
008public enum LineStyle
009{
010        SOLID, DOTTED;
011
012        /**
013      Gets a stroke with which to draw this line style.
014      @return the stroke object that strokes this line style
015         */
016        public Stroke getStroke()
017        {
018                if (this == DOTTED)
019                        return DOTTED_STROKE;
020                return SOLID_STROKE;
021        }
022
023        private static Stroke SOLID_STROKE = new BasicStroke();
024        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);
025}