final Group group = new Group(shell, SWT.NONE);
group.setLayoutData(new GridData(GridData.FILL_BOTH));
group.setText("my caption");
group.addPaintListener(new PaintListener(){
public void paintControl(PaintEvent e) {
e.gc.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLUE));
int h = group.getBounds().height;
int w = group.getBounds().width;
int txtW = e.gc.stringExtent(group.getText()).x;
int line[] = { 5, 7, 2, 7,
2, 7, 0, 9,
0, 9, 0, h-3,
0, h-3,2, h-1,
2, h-1,w-3,h-1,
w-3,h-1,w-1,h-3,
w-1,h-3,w-1,9,
w-1,9, w-3,7,
w-3,7, txtW+12 /*text length + spacing*/,7};
e.gc.drawPolyline(line);
}
});