javax.swing.SwingUtilities.paintComponent(g, label, null, label.getBounds());
SwingUtilities.paintComponent(g, label, null, label.getBounds());
  protected void paintHorizontalLabel(Graphics g, int value, Component label)  {    // This relies on clipping working properly or we'll end up    // painting all over the place. If our preferred size is ignored, then    // the labels may not fit inside the slider's bounds. Rather than mucking     // with font sizes and possible icon sizes, we'll set the bounds for    // the label and let it get clipped.    Dimension dim = label.getPreferredSize();    int w = (int) dim.getWidth();    int h = (int) dim.getHeight();    int max = slider.getMaximum();    int min = slider.getMinimum();    if (value > max || value < min)      return;    //           value    //             |    //        ------------    //        |          |    //        |          |    //        |          |    //  The label must move w/2 to the right to fit directly under the value.    int xpos = xPositionForValue(value) - w / 2;    int ypos = labelRect.y;    // We want to center the label around the xPositionForValue    // So we use xpos - w / 2. However, if value is min and the label     // is large, we run the risk of going out of bounds. So we bring it back    // to 0 if it becomes negative.    if (xpos < 0)      xpos = 0;    // If the label + starting x position is greater than    // the x space in the label rectangle, we reset it to the largest    // amount possible in the rectangle. This means ugliness.    if (xpos + w > labelRect.x + labelRect.width)      w = labelRect.x + labelRect.width - xpos;    // If the label is too tall. We reset it to the height of the label    // rectangle.    if (h > labelRect.height)      h = labelRect.height;    label.setBounds(xpos, ypos, w, h);    javax.swing.SwingUtilities.paintComponent(g, label, null, label.getBounds());  }