We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › equator treemap runs as applet only
Page Index Toggle Pages: 1
equator treemap runs as applet only (Read 622 times)
equator treemap runs as applet only
Apr 10th, 2008, 5:17am
 
Should Ben's Simple Treemap Example (page 190-193 Visualizing Data) only run as an applet?  My java skills are barely existent so I could be missing something that should be obvious.  After sorting through various typos (causes overload exception) I could finally "run" my equator program.  It produces a java screen but goes into error.  By accident I discovered that the exported version does work in the browser.  What gives?

What I get when clicking Run at the sketch:
java.lang.RuntimeException: use textFont() before textWidth()

at processing.core.PGraphics.textWidth(PGraphics.java:2404)

at processing.core.PApplet.textWidth(PApplet.java:7650)

at Temporary_641_9467$WordItem.draw(Temporary_641_9467.java:43)

java.lang.RuntimeException: use textFont() before textWidth()


at processing.core.PGraphics.textWidth(PGraphics.java:2404)


at processing.core.PApplet.textWidth(PApplet.java:7650)


at Temporary_641_9467$WordItem.draw(Temporary_641_9467.java:43)


at treemap.Treemap.draw(Treemap.java:47)


at Temporary_641_9467.draw(Temporary_641_9467.java:28)


at processing.core.PApplet.handleDisplay(PApplet.java:1465)


at processing.core.PGraphics.requestDisplay(PGraphics.java:690)


at processing.core.PApplet.run(PApplet.java:1562)


at java.lang.Thread.run(Unknown Source)



at treemap.Treemap.draw(Treemap.java:47)

at Temporary_641_9467.draw(Temporary_641_9467.java:28)

at processing.core.PApplet.handleDisplay(PApplet.java:1465)

at processing.core.PGraphics.requestDisplay(PGraphics.java:690)

at processing.core.PApplet.run(PApplet.java:1562)

at java.lang.Thread.run(Unknown Source)
Re: equator treemap runs as applet only
Reply #1 - Apr 11th, 2008, 7:36pm
 
this is a weird bug that has come up in the last month or two:
http://dev.processing.org/bugs/show_bug.cgi?id=726

the simple workaround is calling textFont() inside draw() (instead of just inside setup()).

i hope to get this fixed for 0136, since it obviously does quirky things to many of the book examples.
Page Index Toggle Pages: 1