Showing posts with label draw triangle. Show all posts
Showing posts with label draw triangle. Show all posts

Friday, July 19, 2013

How to draw complex shapes in java?

Java Graphics 2D API provides the basic shapes like Rectangle, Rounded Rectangle, Ellipse etc, but is not enough. Your java applications or components may require more custom shapes like Rounded Corner Buttons, Oblong, Stars,Folders etc. You know that it requires lots of time and energy to calculate coordinates and draw custom shapes. JShapes library provides an elegant solution for drawing these custom shapes requirements.

JShapes provides basic and complex shapes often used in Java GUI applications and Components. The shapes library is self contained and no dependencies on other framework or components. So you can easily integrate with your Java Applications or Components. It definitely saves your time and money.

The following code shows a simple example of how to create a shape from this library. The shape can be filled and stroked with custom paints such as Gradient Paint, Texture Paint etc.

    // 1. Create a Diamond Shape
    Diamond shape = new Diamond(bounds);

    // 2. Fill Shape
    g2.fill( shape ) ;

    // 3. Draw Shape
    g2.draw( shape ) ;


Examples of Geometric Shapes in JShapes Library



For more information, please visit http://www.jshapes.com.

Resources
Download jshapes library

About Java Shapes Library
JShapes library provides basic and complex shapes often used in Java GUI applications and Components.

For more information, please visit http://www.jshapes.com