petite/src/wombat/scheme/libraries/types/TreeData.java
private void drawThing(Object thing, Graphics2D g, int x, int y, boolean isNode) {
		String s = thing.toString();
		FontMetrics fm = g.getFontMetrics();
		int w = fm.stringWidth(s);

		// This would be much cleaner with first order functions. :)
		g.setColor(Color.WHITE);
		if (isNode)
			g.fillOval(x - w / 2 - 5, y - 10, w + 10, 20);
		else
			g.fillRect(x - w / 2 - 5, y - 10, w + 10, 20);
		g.setColor(Color.BLACK);
		if (isNode)
			g.drawOval(x - w / 2 - 5, y - 10, w + 10, 20);
		else
			g.drawRect(x - w / 2 - 5, y - 10, w + 10, 20);

		g.drawString(thing.toString(), x - fm.stringWidth(s) / 2, y + fm.getAscent() / 2);
	}
/**
	 * Split this out to either draw my node or non-tree children.
	 * @param thing Something to draw. Either a node or it's contents. 
	 * @param g The graphics object to use to draw.
	 * @param x The x-coordinate to center at.
	 * @param y The y-coordinate to center at. 
	 */
Split this out to either draw my node or non-tree children.
@param thing Something to draw. Either a node or it's contents.
@param g The graphics object to use to draw.
@param x The x-coordinate to center at.
@param y The y-coordinate to center at.
Split this out to either draw my node or non - tree children . @param thing Something to draw . Either a node or it ' s contents . @param g The graphics object to use to draw . @param x The x - coordinate to center at . @param y The y - coordinate to center at .
private void drawThing(Object thing, Graphics2D g, int x, int y, boolean isNode) {
		String s = thing.toString();
		FontMetrics fm = g.getFontMetrics();
		int w = fm.stringWidth(s);
		g.setColor(Color.WHITE);
		if (isNode)
			g.fillOval(x - w / 2 - 5, y - 10, w + 10, 20);
		else
			g.fillRect(x - w / 2 - 5, y - 10, w + 10, 20);
		g.setColor(Color.BLACK);
		if (isNode)
			g.drawOval(x - w / 2 - 5, y - 10, w + 10, 20);
		else
			g.drawRect(x - w / 2 - 5, y - 10, w + 10, 20);
		g.drawString(thing.toString(), x - fm.stringWidth(s) / 2, y + fm.getAscent() / 2);
	}
private void drawThing ( Object thing , Graphics2D g , int x , int y , boolean isNode ) { String s = thing . toString ( ) ; FontMetrics fm = g . getFontMetrics ( ) ; int w = fm . stringWidth ( s ) ; g . setColor ( Color . WHITE ) ; if ( isNode ) g . fillOval ( x - w / 2 - 5 , y - 10 , w + 10 , 20 ) ; else g . fillRect ( x - w / 2 - 5 , y - 10 , w + 10 , 20 ) ; g . setColor ( Color . BLACK ) ; if ( isNode ) g . drawOval ( x - w / 2 - 5 , y - 10 , w + 10 , 20 ) ; else g . drawRect ( x - w / 2 - 5 , y - 10 , w + 10 , 20 ) ; g . drawString ( thing . toString ( ) , x - fm . stringWidth ( s ) / 2 , y + fm . getAscent ( ) / 2 ) ; }
Split this out to either draw my node or non-tree children.
Split this out to either draw my node or non - tree children .
// This would be much cleaner with first order functions. :)