title: Fully functional drawing outside component bounds? setClip() usage and other
body: <p>I have designed simple <code>JPanel</code> extension which I was expecting will able to draw outside it's bounds:</p>
  
  <pre><code>public class JGlassPanel extends JPanel {
  
  @Override
  protected void paintBorder(Graphics g) {
  }
  
  @Override
  protected void paintComponent(Graphics g) {
      if( getParent() != null ) {
          g.setClip(-getX(), -getY(), getX() + getWidth(), getY() + getHeight());
      }
      super.paintComponent(g);
  }
  }
  </code></pre>
  
  <p>The test of this class showed it works only partially (code below). For example, the button is drawn outside a panel, while background felt inside bounds and button visual effects also felt inside bounds.</p>
  
  <p>Is it possible to extend all visual features to arbitrary area?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I found that overriding <code>contains</code> made button also function outside a panel (react on clicks). Meanwhile, visual effects and background are still inside component bounds.</p>
  
  <p><strong>USAGE CODE</strong></p>
  
  <pre><code>public class Tester_JGlassPanel_01 {
  
  
  public static void main(String[] args) {
  
      SwingUtilities.invokeLater(new Runnable() {
  
          @Override
          public void run() {
  
  
              JButton button = new JButton("my button");
              button.setBounds(-50, -20, 100, 40);
  
  
              JGlassPanel panel = new JGlassPanel();
              //JPanel panel = new JPanel();
              panel.setLayout(null);
              panel.setBackground(Color.RED);
              panel.setBounds(100, 100, 100, 100);
              panel.add(button);
  
              JFrameEx frame = new JFrameEx();
              frame.setLayout(null);
  
  
              frame.add(panel);
              frame.setSize(0.5);
              frame.center();
  
  
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
              frame.setVisible(true);
  
  
          }
  
      });
  
  }
  }
  </code></pre>