How to draw over child elements of a Composite in SWT?

Viewed 5790

I understand to draw on a Composite, you can add a paint listener, but that results in drawing under the children. What if I want to draw over the top of children?

The following draws a line, but subc is drawn over it.

Composite c = new Composite(shell, 0);
c.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLUE));
c.setBounds(100, 100, 800, 600);

c.addPaintListener(new PaintListener() {
    public void paintControl(PaintEvent e) {
        e.gc.drawLine(0, 0, 500, 1000);
    }
});

final Composite subc = new Composite(c, 0);
subc.setLayout(null);
subc.setBounds(10, 10, 600, 400);
2 Answers
Related