I currently have a DropShadowBorder class (which extends the javax.swing.border.Border class) from the SwingX library, so this is an instance of a regular Border . I would like to draw this border around my undecorated JFrame . I am currently using the following method inside my JFrame to set the border:
DropShadowBorder b = new DropShadowBorder(Color.BLACK, 0, 10, 0.2f, 10, true, true, true, true); this.getRootPane().setBorder(b);
Note. I use the root panel of the frame to draw the border, because the frame does not support the borders themselves.
The problem is that the borders are drawn inside the component itself, as you can see in the figure below, the shaded border is drawn inside, against the borders of the frame itself:

Note. A (shaded) frame is drawn inside the frame with its borders, not outside the frame.
It doesn't matter which border is used, they are all drawn inside the JFrame itself.
My question is: Can I draw any frame around the frame, and not just inside the borders of the frame?
One of the ways that can be used to solve this problem is to create another transparent transparent full-screen window with a normal window on top of it. This full-screen window is used to draw the shadow, so the shadow does not need to be drawn in the frame itself. This is a solution to get a similar result, it is not what I would like. I want to draw a border outside the frame. Such solutions usually cause other problems.
java swing border jframe shadow
Tim visΓ©e
source share