Creating a Shape from a Stroked Shape - Java 2D Graphics

Java examples for 2D Graphics:Shape

Description

Creating a Shape from a Stroked Shape

Demo Code

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*/
}

Related Tutorials