SWT painting
From: it-inkom (it_inkom_at_hotmail.com)
Date: 01/25/05
- Next message: it-inkom: "SWT painting"
- Previous message: Frank Liu: "Re: logic in one thread and swing in another"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 24 Jan 2005 18:41:40 -0800
Hello!
I need a help.
I can't draw a line over a SWT control component as canvas.
Is it impossible? or i wrote a wrong code.
Take care
Alexander
display=new Display();
Shell shell=new Shell(display);
shell.setLayout(new RowLayout());
Canvas canvas=new Canvas(shell,SWT.NONE);
RowData data=new RowData(100,50);
canvas.setBackground(display.getSystemColor(SWT.COLOR_CYAN));
canvas.setLayoutData(data);
shell.addListener(SWT.Paint,new Listener(){
public void handleEvent(Event event) {
event.gc.setForeground(new Color(display,new RGB(255,0,0)));
event.gc.drawLine(0,0,500,500);// try to draw a line over canvas
}
});
shell.pack();
shell.open();
while(!shell.isDisposed()){
if(!display.readAndDispatch()) display.sleep();
}
display.dispose();
- Next message: it-inkom: "SWT painting"
- Previous message: Frank Liu: "Re: logic in one thread and swing in another"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|