Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drawing outside a component's bounds

I'm making a component (extending JComponent) which will have some decoration drawn over the top of it and partly outside its bounds.

I would like to know if there's a way of drawing outside the component using self-contained code (I don't want to have to do any drawing in the parent container, for example).

like image 905
Tharwen Avatar asked Nov 05 '22 11:11

Tharwen


1 Answers

AFAIK, there is no easy solution. One way to achieve this is to draw on the container's GlassPane, as shown here. IMHO, I would just modify the Graphics object of the component to change the "apparent" bounds, which will enable you to draw stuff that's "outside the bounds" on the component itself.

like image 138
mre Avatar answered Nov 15 '22 11:11

mre