Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Display, Graphics and GTK
Display, Graphics and GTK [message #444641] Mon, 18 October 2004 12:51 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:java spider help
Next Topic:browser widget - remove border
Goto Forum:
  


Current Time: Wed Jul 23 11:03:38 EDT 2025

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

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

Back to the top