Re: [Java-gnome-developer] Assertion failure while drawing on DrawingArea
Brought to you by:
afcowie
From: Jeff M. <ku...@gm...> - 2004-12-12 14:53:36
|
What version of java-gnome are you using? Are you using cvs HEAD? On Sun, 12 Dec 2004 14:08:57 +0000, Jaime <re...@sa...> wrote: > Hi folks. > > I've tried to write a simple little program to draw on a DrawingArea, > but without success. I get the following assertion failure at runtime: > > (java-gnome:2393): Gdk-CRITICAL **: file gdkdraw.c: line 338 > (gdk_draw_point): assertion `GDK_IS_DRAWABLE (drawable)' failed > > Could anyone please tell me where I'm going wrong? In fact, a pointer to > any example code which successfully draws onto a DrawingArea would be > just as good! Thank you, > > Jaime :-) > > <snip> > package drawingAreaTest; > > import org.gnu.gtk.DrawingArea; > import org.gnu.gtk.Gtk; > import org.gnu.gtk.Window; > import org.gnu.gtk.WindowType; > import org.gnu.gtk.event.ExposeEvent; > import org.gnu.gtk.event.ExposeListener; > import org.gnu.gtk.event.LifeCycleEvent; > import org.gnu.gtk.event.LifeCycleListener; > > public class Test { > > DrawingArea area = null; > > Window window; > > Test() { > window = new Window(WindowType.TOPLEVEL); > window.setTitle("Drawing Area Example"); > window.addListener(new LifeCycleListener() { > public void lifeCycleEvent(LifeCycleEvent event) { > } > public boolean lifeCycleQuery(LifeCycleEvent event) { > if (event.isOfType(LifeCycleEvent.Type.DESTROY) > || event.isOfType(LifeCycleEvent.Type.DELETE)) { > Gtk.mainQuit(); > } > return true; > } > }); > area=new DrawingArea(); > window.add(area); > area.addListener(new ExposeListener() { > public boolean exposeEvent(ExposeEvent event) { > System.out.println("Expose event: "+window.getWindow()); > window.getWindow().drawPoint(20, 20); > return false; > } > }); > window.showAll(); > System.out.println("Should be printed before expose event"); > } > > public static void main(String[] args) { > Gtk.init(args); > new Test(); > Gtk.main(); > } > > } > </snip> > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > -- Jeffrey Morgan "The highest reward for a man's toil is not what he gets for it, but what he becomes by it" - Jon Ruskin |