protected void drawText ( Graphics2D g , String text ) { // top left corner int x = getAbsoluteContentX ( ) ; int y = getAbsoluteContentY ( ) ; //Align Y with baseline FontMetrics fm = g . getFontMetrics ( ) ; Rectangle2D rect = fm . getStringBounds ( text , g ) ; int ofs = getFirstInlineBoxBaseline ( ) ; if ( ofs == - 1 ) ofs = ctx . getBaselineOffset ( ) ; //use the font baseline // Draw the string g . drawString ( text , x + ( ( int ) rect . getX ( ) ) - ( ( int ) Math . round ( rect . getWidth ( ) ) ) , y + ofs ) ; }
Draws a text marker