JFace forms provide this in FormToolkit. See here .
The private BorderPainter class (lines 106-165) does what Mario already described in his answer: custom border painting around your widget. To make it work, you must add a BorderPainter, which is PaintListener, to your widget parent, see paintBordersFor(.)line 798.
I would not recommend adding jface forms as a dependency if you only need a border guard artist - too heavy. But this code should help you.
source
share