title: Painting over the top of components in Swing?
body: <p>I have a <code>JPanel</code> added to a <code>JViewport</code>, and the panel has several other panels added to it. I'm trying to implement a dragging selection, where you can select more than one component by dragging the mouse. The only problem I'm facing is that the selection rectangle is being painted behind the components added to the main <code>JPanel</code>. How can I paint over the top of them?</p>
  
  <p>My structure is as follows: <br><code>JFrame</code> -> <code>ContentPane</code> -> <code>JLayeredPane</code> -> <code>JScrollPane</code> -> <code>JPanel</code> -> <code>JPanel []</code>.</p>
  
  <p><em>Design draft for college assignment:</em><br>
  <em>As you can see, the rectangle is behind the other panels.</em></p>
  
  <p><img src="https://i.stack.imgur.com/tMO5C.png" alt="Design draft for college assignment."></p>