|GC - Hows to draw over controls. [message #448685]
||Thu, 13 January 2005 04:38
Registered: July 2009
I wish, at certain points of my application, to draw a line, say connecting
two labels. The canvas I wish to draw on contains a number of smaller
canvases with labels as their children.
Canvas tCanvas = new Canvas(shell, SWT.NONE);
.... setLayout etc ...
for(int i = 0; i < tables.size(); i++)
Canvas cnv = new Canvas(tCanvas, SWT.NONE);
cnv.setLayout(new GridLayout(1, false));
TableBean tBean = (TableBean) tables.get(i);
for(int j = 0; j < tBean.columns(); j++)
Label lbl = new Label(cnv, SWT.NONE);
This is a rough example to demonstrate what I am doing.
Now if I drag and drop from one of these label to another in a different
canvas (cnv) but still within tCanvas, I want to be able to use the GC of
tCanvas, in a Paintlistener instance, to draw a line from one of the labels
to the other. I succesfully get the Paintlistenre to do this, but the line
is behind the child controls in the canvas (tCanvas), is there a way to get
the GC to draw the lines above the child controls??
is there a better approach for this?
any help would be appreciated
Powered by FUDForum
. Page generated in 0.01680 seconds