Display, Graphics and GTK [message #444641] |
Mon, 18 October 2004 16:51 |
Stef van Dijk Messages: 31 Registered: July 2009 |
Member |
|
|
Sorry if this is a dumb question, but I'm relatively new to working with
GTK.
Is it actually possible to create a graphics on the display and draw to it?
That is, can I draw directly to the desktop?
I tried writing the following very simple app, but nothing appears on the
screen. Am I missing something?
Note that the same app works fine on WinXP.
Stef
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Display;
public class TestDisplayGraphics {
public static void main(String[] args) {
Display d = new Display();
GC gc = new GC(d);
gc.setBackground(d.getSystemColor(SWT.COLOR_GREEN));
gc.fillRectangle(100,100,200,200);
gc.setBackground(d.getSystemColor(SWT.COLOR_RED));
gc.fillRectangle(400,400,200,200);
gc.dispose();
System.out.println("Test complete");
}
}
|
|
|
Re: Display, Graphics and GTK [message #444676 is a reply to message #444641] |
Wed, 20 October 2004 13:22 |
Stef van Dijk Messages: 31 Registered: July 2009 |
Member |
|
|
Does anyone know the answer to this please?
Stef
"Stef van Dijk" <not-me@not-here.com> wrote in message
news:cl0s0u$utc$1@eclipse.org...
> Sorry if this is a dumb question, but I'm relatively new to working with
> GTK.
> Is it actually possible to create a graphics on the display and draw to
it?
> That is, can I draw directly to the desktop?
>
> I tried writing the following very simple app, but nothing appears on the
> screen. Am I missing something?
> Note that the same app works fine on WinXP.
>
> Stef
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.graphics.GC;
> import org.eclipse.swt.widgets.Display;
>
> public class TestDisplayGraphics {
>
> public static void main(String[] args) {
> Display d = new Display();
> GC gc = new GC(d);
>
> gc.setBackground(d.getSystemColor(SWT.COLOR_GREEN));
> gc.fillRectangle(100,100,200,200);
> gc.setBackground(d.getSystemColor(SWT.COLOR_RED));
> gc.fillRectangle(400,400,200,200);
>
> gc.dispose();
>
> System.out.println("Test complete");
> }
> }
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02386 seconds