title: Java: How to draw a border around an undecorated JFrame?
body: <p>I currently have the <code>DropShadowBorder</code> class (which extends the <code>javax.swing.border.Border</code> class) from the <code>SwingX</code> library, so this is an instance of a regular <code>Border</code>. I would like to draw this border around my undecorated <code>JFrame</code>. I'm currently using the following method inside my <code>JFrame</code> to set the border:</p>
  
  <pre><code>DropShadowBorder b = new DropShadowBorder(Color.BLACK, 0, 10, 0.2f, 10, true, true, true, true);
  this.getRootPane().setBorder(b);
  </code></pre>
  
  <p><em>Note: I'm using the root pane of the frame to draw the border on, because the frame doesn't support borders itself.</em></p>
  
  <p>The problem is that the borders are drawn inside the component itself, as you can see in the picture bellow, the shadowed border is drawn inside, against the bounds of the frame itself:</p>
  
  <p><img src="https://i.stack.imgur.com/ZyYp0.png" alt="enter image description here"></p>
  
  <p><em>Note: The (shadowed) border is drawn inside the frame against it's bounds, instead of outside the frame.</em></p>
  
  <p>It doesn't matter what kind of border is used, all of them are drawn inside the <code>JFrame</code> itself.</p>
  
  <p><strong>My question is:</strong> Is it possible to draw any border around the frame, not just inside against the bounds of the frame?</p>
  
  <hr>
  
  <p>One way that could be used to solve this problem, is to create a different undecorated full screen window which is transparent, the normal window is put on top of this one. This full screen window is used to draw the shadow on, so the shadow doesn't need to be drawn in the frame itself. This is a solution to get a similar result, this is <strong>not</strong> what I would like though. I want to draw a border outside the frame. These kind of solutions usually cause other problems.</p>