public void dropAccept(final DropTargetEvent event)
{
if (TextTransfer.getInstance().isSupportedType(event.currentDataType))
{
final String d=(String)TextTransfer.getInstance().nativeToJava(event.CurrentDataType);
GC gc = new(text);
//text is the name assigned to the Canvas
text.addPaintListener(new PaintListener()
{
public void paintControl(PaintEvent e)
{
int x= event.x- shell.getBounds().x - text.getBounds().x;
int y=event.y - shell.getBounds().y - text.getBounds().y;
e.gc.drawString(d, x, y);
}
}); } }
此代码片段是实现将文本拖放到画布上的更大类的一部分。问题是,在我删除它之后,在画布上看不到实际的文本删除,但只有在我最小化外壳然后再次最大化它之后。谁能告诉我如何通过修改此代码使删除操作立即可见?