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 & HelpIntegration › class troubles
Page Index Toggle Pages: 1
class troubles (Read 670 times)
class troubles
Apr 3rd, 2006, 1:56am
 
Ok, here is my example class...
import processing.core.*;
import java.util.*;
public class Drawable extends PGraphics {
   private PApplet parent;
   private Random r;
   public Drawable(int a,int b, int c, int d, PApplet p) {
       parent = p;
       r = new Random();
       parent.line(a,b,c,d);
   }
   
   public void poynt() {
       parent.point(r.nextInt(600),r.nextInt(600));
   }
   
}

It works fine when defined within the processing environment, but when I try to instantiate it from the .class file in the code folder for my project, I get the following scary exception list...

java.lang.NullPointerException


at java.util.Hashtable.put(Unknown Source)


at processing.app.Compiler.packageListFromFolder(Compiler.java:522)


at processing.app.Compiler.packageListFromClassPath(Compiler.java:445)


at processing.app.Sketch.build(Sketch.java:1312)


at processing.app.Sketch.handleRun(Sketch.java:1239)


at processing.app.Editor.handleRun(Editor.java:1159)


at processing.app.EditorButtons.mousePressed(EditorButtons.java:317)


at java.awt.Component.processMouseEvent(Unknown Source)


at java.awt.Component.processEvent(Unknown Source)


at java.awt.Container.processEvent(Unknown Source)


at java.awt.Component.dispatchEventImpl(Unknown Source)


at java.awt.Container.dispatchEventImpl(Unknown Source)


at java.awt.Component.dispatchEvent(Unknown Source)


at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)


at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)


at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)


at java.awt.Container.dispatchEventImpl(Unknown Source)


at java.awt.Window.dispatchEventImpl(Unknown Source)


at java.awt.Component.dispatchEvent(Unknown Source)


at java.awt.EventQueue.dispatchEvent(Unknown Source)


at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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)

any help would be greatly appreciated.
Re: class troubles
Reply #1 - Aug 4th, 2006, 4:48pm
 
I was having some problems with that as well...
As a work around, I found that I only made instances of Java files, and it worked fine. Instances of .pde files I was having trouble with.  And the java files, if you take out the extends PApplet from your class definition, it should be ok.
I'm also having trouble with the mixing of Java and Processing.
Page Index Toggle Pages: 1