Control size of JGoEllipse of JBasicNode

Following is my code to control the size of Ellipse in the JBasicNode. I use setWidth to control the size of ellipse to be fixed size of ellipse. It is almost perfect to use default font and size 12. I test different size of string such as “New York”. The ellipse most time will be 1 or 2 pix different.
If I use “couier new”, the ellipse will be perfect since each char has same size and length of setWidth will make ellipse same width and height. The problem is that “courier new” not not good looking. The default font can not get fond length since it is not fixed char.
So my question is that is any kind method in the JGoBasicNode to control the size of Ellipse?
public class MyNode2 extends JGoBasicNode {
Color cc =;
Image im = null;
JGoPen pen = null;
public MyNode2(String text) {
int width = text.length()12 + 22;

public void setColor(Color newColor,int style,boolean filledColor) {
cc = newColor;
pen = new JGoPen(style,2,newColor);
if (filledColor)
public void setIcon(Image im) { = im;
public void paint(java.awt.Graphics2D g,JGoView view) {
super.paint(g, view);
Point loc = this.getLocation();
g.drawImage(im,loc.x - 15 ,loc.y - 15,null);


You probably shouldn’t be trying to set the Height or Width of the whole node, but only of the individual parts.
You should let JGoText figure out the width and/or height of the text. So you probably want to do something like:

Thanks. It is really fix my problem.