public void updateForGraphics ( NodeData style , Graphics2D g ) { if ( style != null ) update ( style ) ; updateGraphics ( g ) ; fm = g . getFontMetrics ( ) ; //update the width units //em has been updated in update() FontRenderContext frc = new FontRenderContext ( null , false , false ) ; TextLayout layout = new TextLayout ( "x" , font , frc ) ; ex = layout . getBounds ( ) . getHeight ( ) ; ch = fm . charWidth ( ' ' ) ; }
Updates this context according to the given style . Moreover given Graphics is updated to this style and used for taking the font metrics .