Javascript mode producing weird PDE bugs? 2.2.1

edited November 2014 in JavaScript Mode

Java mode works fine, however Javascript mode has no toolbar, running the sketch doesn't do anything, and resizing the console (forcing it to repaint) causes it to explode with some red errors. Computer slows to a crawl.

Image

Halp?

the error is:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at processing.app.EditorToolbar.loadImages(EditorToolbar.java:152)
    at de.bezier.mode.javascript.JavaScriptToolbar.init(Unknown Source)
    at processing.app.EditorToolbar.paintComponent(EditorToolbar.java:177)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JSplitPane.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JLayeredPane.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paintToOffscreen(Unknown Source)
    at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
    at javax.swing.RepaintManager.paint(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
    at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
    at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
    at java.awt.Container.paint(Unknown Source)
    at java.awt.Window.paint(Unknown Source)
    at javax.swing.RepaintManager$3.run(Unknown Source)
    at javax.swing.RepaintManager$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.access$1100(Unknown Source)
    at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

Answers

  • Okay I fixed it (sort of) - the Javascript mode that shipped with the PDE was broken, I downloaded the other one (there were 2?) from the mode manager and it sort of works. Still farts out a lot of red error text to the console.

    ...and it isn't working anymore. It worked once. Here's the new error

    Exception in thread "Processing.BasicServer" java.lang.NoSuchMethodError: processing.app.Base.showWarning(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
        at de.bezier.mode.javascript.JavaScriptBuild.build(Unknown Source)
        at de.bezier.mode.javascript.JavaScriptBuild.export(Unknown Source)
        at de.bezier.mode.javascript.JavaScriptMode.handleExport(Unknown Source)
        at de.bezier.mode.javascript.JavaScriptEditor.handleExport(Unknown Source)
        at de.bezier.mode.javascript.JavaScriptEditor.serverStarted(Unknown Source)
        at de.bezier.mode.javascript.BasicServer.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
    
  • Fixed it (again) - there were variables in size(). This is for a size-limited competition dammit :)

  • edited November 2014 Answer ✓

    For a long time JS Mode stopped being bundled in Processing 2.
    I advise you to make sure you got latest Processing 2.2.1 and delete all modes installed in "<sketchbook_folder>/modes/" w/ all Processing windows closed! Only then, reinstall your fav modes! (*)

  • edited June 2015

    Here's 1 CoffeeScript game from http://forum.processing.org/two/discussion/3580/flappy-code: B-)

    p=[];I=S=e=j=q=0;x=25;y=40;h=10;n=20;k=14;t=-1
    setup:->
      size 500,800;p[j]=new P j++ while j<3;strokeWeight .2;textSize 3
    draw:->background 0;scale h;stroke t;noFill();ellipse x,y,2,2;f.d() for f in p;fill 0;if e>0 then y+=q+=.04;rect 2,2,h,5;fill t;text S,3,6;else rect k,h,n,5;rect k,n,n,5;fill t;text(`I>t?"Flappy Code\n\n\nClick to Play":"Game Over\n\n\nScore: "+S`,16,k)
    mousePressed:->@keyPressed()
    keyPressed:->q=I=t;if e<1 then f.c=f.a+=55 for f in p;S=0;y=e=40
    class P
      constructor:(i)->@a=0;@a=i*n-@r()
      d:->@a=@r() if @a<0;e=0 if y>80|x==~~@a&&y<@b-h|y>@b+h;@c=-S++ if @a<25&@c>0;@a-=.4 if e>0;line @a,0,@a,@b-h;line @a,@b+h,@a,80
      r:->@c=@b=h+random 60;@a+=60
    
    
  • That's impressive, I wish I could use Coffee mode but the contest rules say it has to work in standard Java mode too :( (KTByte fall 5k)

Sign In or Register to comment.