Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » GC - Hows to draw over controls.
GC - Hows to draw over controls. [message #448685] Thu, 13 January 2005 04:38
Steve is currently offline SteveFriend
Messages: 29
Registered: July 2009
Junior Member
Hi there,

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.

i.e.

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);
lbl.setText(tBean.getColumn(i));
}
}

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

Steve
Previous Topic:64bit plans?
Next Topic:Is there a Simple way how to get a sizable dialog.
Goto Forum:
  


Current Time: Fri Nov 22 09:44:57 GMT 2019

Powered by FUDForum. Page generated in 0.01680 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top