public static BasicStroke toStroke ( final String style ) { BasicStroke result = null ; if ( style != null ) { float lineWidth = STROKE_DEFAULT_LINE_WIDTH ; float [ ] dash = { STROKE_DEFAULT_DASH_WIDTH } ; float [ ] dot = { lineWidth } ; if ( style . equalsIgnoreCase ( STYLE_LINE ) ) { result = new BasicStroke ( lineWidth ) ; } else if ( style . equalsIgnoreCase ( STYLE_DASH ) ) { result = new BasicStroke ( lineWidth , BasicStroke . CAP_BUTT , BasicStroke . JOIN_MITER , STROKE_MITER_LIMIT_STYLE_DASH , dash , STROKE_DEFAULT_DASHPHASE ) ; } else if ( style . equalsIgnoreCase ( STYLE_DOT ) ) { result = new BasicStroke ( lineWidth , BasicStroke . CAP_BUTT , BasicStroke . JOIN_MITER , STROKE_MITER_LIMIT_STYLE_DOT , dot , STROKE_DEFAULT_DASHPHASE ) ; } } return result ; }
Convert style string to stroke object .