public void setIndex(int index) {
    if (index == myIndex) {
      return;
    }
    myIndex = index;
    String s = String.valueOf(index);
    myChars = s.toCharArray();
    myIndexWidth = getFontMetrics(getFont()).charsWidth(myChars, 0, myChars.length);
    setPreferredSize(new Dimension(myDiameter, myDiameter));
    invalidate();
  }
public void setIndex(int index)