title: Can I draw outside the component boundaries in swing?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7970938/drawing-outside-a-components-bounds">Drawing outside a component&#39;s bounds</a>  </p>
  </blockquote>
  
  
  
  <p>I'd like to make "good looking" interface using Swing (and SwingX) and i'm still struggling with creating nice shadows. I found that there is already a border do what i want (partially) in SwingX, <a href="http://download.java.net/javadesktop/swinglabs/releases/0.8/docs/api/org/jdesktop/swingx/border/DropShadowBorder.html" rel="nofollow noreferrer">DropShadowBorder</a>. </p>
  
  <p>I have also found <a href="http://www.curious-creature.org/2005/07/07/fast-or-good-drop-shadows/" rel="nofollow noreferrer">this</a>, the shadows are really nice but it works with images. But i'm sure you can make it works with <code>JComponent</code>. I have already modified the code to generate an empty <code>BufferedImage</code> with the size of the component (it only works for rectangular components but i don't really care) and create the shadow from this image.</p>
  
  <p>The shadow generation works but my problem is that i can only render the shadow within the boundaries of the swing component but i have to render the shadow with an offset on both axis. </p>
  
  <p><strong>Can i avoid this and render outside the component boundaries? For example, can i draw anything at (0, 100) in the paintComponent method of a component that have a size of (50, 50) ?</strong></p>
  
  <p>Thanks.</p>
  
  <p><strong>EDIT</strong>: Here is an example of what i'd like to avoid. The shadow exceed the size of the component of both axis (the component is not rendered to let you see the shadow).</p>
  
  <p><img src="https://i.stack.imgur.com/8RyL4.png" alt="enter image description here"></p>
  
  <p><strong>EDIT2</strong>: i'm not sure if i was clear enough (if it's the case i'm sorry) so here graphical representation of what i want to do.</p>
  
  <p><img src="https://i.stack.imgur.com/JT6x8.png" alt="enter image description here"></p>