title: Painting a rounded border onto a JScrollPane
body: <p>I am trying to paint a rounded rectangle around a <code>JScrollPane</code>. For the life of me I can't figure out how to do this! No matter what I try, the border is not visible. I have figured out that it is drawing <em>BEHIND</em> the contents and not over them. The only thing inside the scroll pane is a <code>JPanel</code> with some graphics painted onto it.  Does anyone know how to fix this? </p>
  
  <p>Here is the code I have tried to paint the border on the scroll pane: </p>
  
  <pre><code>public void paintComponent(Graphics g) {
      super.paintComponent(g);
  
      Graphics2D g2 = (Graphics2D) g;
      g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
      g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  
      g2.setColor(Color.black);
      g2.setStroke(new BasicStroke(1));
      g2.draw(new RoundRectangle2D.Double(0, 0, getWidth() - 1, getHeight() - 1, 10, 10));
  }
  </code></pre>
  
  <p>I have also tried using <code>paint</code> instead of <code>paintComponent</code> but with no such luck!</p>