You may build your own RenderedMessageListener to be notified of arbitrary messages you add to measures, staves, and notes
This example only recognizes messages beginning with "drawline", "setcolor", and "drawarc"
You can of course make up your own graphics command set and respond to messages however you like
Note that this callback happens as the last step of notrre rendering
Source follows: