GraphicsBuilder: more shapes - No Fluff Just Stuff

GraphicsBuilder: more shapes

Posted by: Andres Almiray on January 6, 2008

Pondering on how to add a custom shape to GraphicsBuilder I decided that donut should be included in GraphicsBuilder. But the good news doesn't end there, there are more shapes available now.

Let's start with regularPolygon, a shape that will let you draw a circle-inscribed polygon, starting at 3 sides



The circle-inscribed nature of these polygons will probably entice you to create a non-circular donut, either by using Area.add (or the overloaded shape operators), there is no need for that as donut also supports regular polygons by just configuring a sides property



The Swingx extension provides access to Morph2D and Star2D, but stars are a little bit hard to configure, specially when rotating. Not anymore, the new star shape is easier to configure and its also available in the core package



rays is another centric-based shape, think of it as the group of even facets of a regular polygon



Other useful and common shapes are arrow and cross. Arrows will let you configure how big/small the arrow head should be and how much space it takes from the body. Crosses may be angular or rounded.





All these shapes (except donut) have a quick way to be rotated thanks to an angle property.

Keep on Groovying!
Andres Almiray

About Andres Almiray

Andres is a Java/Groovy developer and a Java Champion with more than 20 years of experience in software design and development. He has been involved in web and desktop application development since the early days of Java. Andres is a true believer in open source and has participated on popular projects like Groovy, Griffon, and DbUnit, as well as starting his own projects (Json-lib, EZMorph, GraphicsBuilder, JideBuilder). Founding member of the Griffon framework and Hackergarten community event. https://ch.linkedin.com/in/aalmiray

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 8
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 4
  • Cloud
  • Automation Tools: Gradle, Git, Jenkins, Sonar
  • HTML5, CSS3, AngularJS, jQuery, Usability
  • Mobile Apps - iPhone and Android
  • More...
Learn More »