public void paintIcon( Component c, Graphics g, int x, int y ){ g.setColor( c.getForeground() ); drawArrow( g, x+1, y+1 ); drawArrow( g, x+4, y+1 ); String text; if( size > 100 ){ text = "+"; } else{ text = String.valueOf( size ); } Font font = g.getFont(); GenericFontModifier modifier = new GenericFontModifier(); modifier.setSizeDelta( false ); modifier.setSize( 8 ); g.setFont( modifier.modify( font ) ); TextLayout layout = new TextLayout( text, g.getFont(), ((Graphics2D)g).getFontRenderContext() ); Rectangle2D bounds = layout.getBounds(); layout.draw( (Graphics2D)g, (float)(x + getIconWidth() - bounds.getWidth() - bounds.getX() - 1), (float)(y + getIconHeight() - bounds.getHeight() - bounds.getY() - 1 )); g.setFont( font ); }
GenericFontModifier modifier = new GenericFontModifier(); for( String modification : modifications ){ String[] entry = split( modification );
public void paintIcon( Component c, Graphics g, int x, int y ){ g.setColor( c.getForeground() ); drawArrow( g, x+1, y+1 ); drawArrow( g, x+4, y+1 ); String text; if( size > 100 ){ text = "+"; } else{ text = String.valueOf( size ); } Font font = g.getFont(); GenericFontModifier modifier = new GenericFontModifier(); modifier.setSizeDelta( false ); modifier.setSize( 8 ); g.setFont( modifier.modify( font ) ); TextLayout layout = new TextLayout( text, g.getFont(), ((Graphics2D)g).getFontRenderContext() ); Rectangle2D bounds = layout.getBounds(); layout.draw( (Graphics2D)g, (float)(x + getIconWidth() - bounds.getWidth() - bounds.getX() - 1), (float)(y + getIconHeight() - bounds.getHeight() - bounds.getY() - 1 )); g.setFont( font ); }
GenericFontModifier modifier = new GenericFontModifier(); for( String modification : modifications ){ String[] entry = split( modification );