Example usage for java.awt BasicStroke createStrokedShape

List of usage examples for java.awt BasicStroke createStrokedShape

Introduction

In this page you can find the example usage for java.awt BasicStroke createStrokedShape.

Prototype

public Shape createStrokedShape(Shape s) 

Source Link

Document

Returns a Shape whose interior defines the stroked outline of a specified Shape .

Usage

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    BasicStroke stroke = new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0.1F);

    g2.setPaint(Color.black);/*w ww. jav  a2s  .  co  m*/
    g2.draw(stroke.createStrokedShape(new Rectangle2D.Float(10, 10, 20, 20)));
}