Custom Styles Tutorial

GetBounds

This step shows how to override getBounds() of NodeStyleBase.

Also, NodeStyleBase#getOutline is implemented, so that implementations of NodeStyleBase#getIntersection, NodeStyleBase#isInside and NodeStyleBase#isHit won't be necessary any more.

Things to Try

  • Take a look at MySimpleNodeStyle.getBounds().
  • Zoom in until the horizontal scrollbar appears. Scroll to the right end of the graph. You will notice that the shadow of the right node is completely visible.
  • Now, comment in the first line in MySimpleNodeStyle.getBounds() so that the implementation of the base class is called and do the same thing again. Now, the viewport will end at the right side of the node without taking the shadow into account.

Left to Do

  • Find a way to draw a well-performing drop shadow.
  • Draw edges from nodes to their labels.
  • Create a custom label style.
  • Create a custom edge style.
  • Create a custom port style for nodes.
  • Create a custom group node style.