Display, Graphics and GTK [message #444641] |
Mon, 18 October 2004 12:51  |
Eclipse User |
|
|
|
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 09:22   |
Eclipse User |
|
|
|
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");
> }
> }
>
>
|
|
|
Re: Display, Graphics and GTK [message #444689 is a reply to message #444676] |
Wed, 20 October 2004 10:34  |
Eclipse User |
|
|
|
Hi Stef,
1. We released a fix in HEAD for GTK. It should work in the next nigthly
build N20041021
2. Your example needs to run the event loop
With 1. and 2. you should be able to get going...
Chris
|
|
|
Powered by
FUDForum. Page generated in 0.45118 seconds