public void paintComponent(Graphics g)
    {
        // base
        g.setColor(Color.black);
        g.drawLine(centerX - width/2, centerY, centerX + width/2, centerY);
        g.drawLine(centerX, centerY, centerX, centerY - height);
        g.drawString(name, centerX - 5, centerY + 15);

        for (int i = 0; i < disks.size(); i++) {
            try {
                int diskNo = getDiskNo(i);
                int diskWidth = DISK_WIDTH_DELTA * diskNo;
                int x = centerX - diskWidth/2;
                int y = centerY - DISK_HEIGHT * (i + 1);

                g.setColor(getColorForDisk(disks.elementAt(i)));
                g.fillRect(x, y, diskWidth, DISK_HEIGHT);

                g.setColor(Color.black);
                g.drawString(String.valueOf(diskNo), x, y + DISK_HEIGHT - 1);
            }
            catch (ArrayIndexOutOfBoundsException ex) {
            }
        }
    }