Java examples for 2D Graphics:Shape
Creating a Shape from a Stroked Shape
import java.awt.BasicStroke; import java.awt.Rectangle; import java.awt.Shape; public class Main { public static void main(String[] args) { float strokeThickness = 5.0f; BasicStroke stroke = new BasicStroke(strokeThickness); Shape shape = new Rectangle(); Shape newShape = stroke.createStrokedShape(shape); }/* w ww . j a v a 2s. c om*/ }