Question: I know how to draw a rectangle onto a JPanel, but how can I paint a rectangle to the screen so that the rectangle appears to be floating? More specifically, a non-filled rectangle. My thought is to use a transparent JFrame with a rectangle drawn on it; however, this makes all of the content in the JFrame transparent. 

**My Solution**
So I think there are many ways of going about this, some more complex than others, some more practical than others. 

I tried the splash screen. The problem with that is you need to pass VM parameters "-splash " when you run. I created a manifest file to automate this/put the parameters into eclipse; but then the code is dependent on the .gif file and I can't change the size/position of the rectangle easily. Similar problems occur while faking it via screen screenshot. Good suggestions though, I learned some pretty cool stuff.

So, back to what I did. I used a JFrame, got the content pane and set the background to red (what ever color you want), then set the frame undecorated which removes the titlebar and border of the window. This created a floating rectangle which I could easily change the size and location of (frame.setSize, .setLocation). I have yet to make this a non filled rectangle, I tried internal frames and layeredpanes, but no success.

Answer: 
JFrame is a heavyweight component, and those were always opaque for the longest time. However, since Java 6u10, there is an [inofficial API](http://www.pushing-pixels.org/?p=260) for transparent windows in the class `com.sun.awt.AWTUtilities`, which will most likely become official in Java 7. In earlier versions, the only way to simulate this kind of thing was to [fake it via screenshots](http://www.onjava.com/pub/a/onjava/excerpt/swinghks_hack41/index.html) taken with `java.awt.Robot`
You might want to look at [JLayeredPane](http://java.sun.com/docs/books/tutorial/uiswing/components/layeredpane.html). The demo on this page shows partially what you want, however when painting your rectangle you'll need to set your paint to transparent:

```
AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f);
g2d.setComposite(ac);
g2d.drawImage(image, x, y, this);

```