drawing a tree

I'm attempting to draw a tree. Here's my code for it:

publicvoid draw(Graphics2D g, Dimension d)

{

g.drawString(key.toString(), (int)d.getWidth()/2, d.height);// problem here?!?!?

int size = children.size();

for (int c = 0; c < size; ++c)

children.get(c).draw(g,new Dimension(d.width*c/size, d.height + 10));

}

But the problem is that setting the width in [ g.drawString(key.toString(), (int)d.getWidth()/2, d.height/2);] doesn't seem to have any affect. Everything is displayed as though that the x parameter is set to 0.

[900 byte] By [rdevaa] at [2007-11-27 7:25:13]
# 1
Print out the d.getWidth() value to see what it actually is.
hunter9000a at 2007-7-12 19:07:08 > top of Java-index,Java Essentials,New To Java...