FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   67 splitStrings not working inside void setup
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: 67 splitStrings not working inside void setup  (Read 218 times)
jkeirstead

WWW
67 splitStrings not working inside void setup
« on: Apr 20th, 2004, 11:19pm »

Hi,  
 
I've written some code using splitStrings that works fine in a static mode program (i.e. no setup or loop).  But when I place the code in setup I get the following error:
 
java.lang.NullPointerException
 at PdeRuntime.start(PdeRuntime.java:345)
 at PdeEditor.doRun(PdeEditor.java:801)
 at PdeEditorButtons.mouseReleased(PdeEditorButtons.java:41
 at java.awt.Component.processMouseEvent(Component.java:5134)
 at java.awt.Component.processEvent(Component.java:4931)
 at java.awt.Container.processEvent(Container.java:1566)
 at java.awt.Component.dispatchEventImpl(Component.java:3639)
 at java.awt.Container.dispatchEventImpl(Container.java:1623)
 at java.awt.Component.dispatchEvent(Component.java:3480)
 at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
 at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
 at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
 at java.awt.Container.dispatchEventImpl(Container.java:1609)
 at java.awt.Component.dispatchEvent(Component.java:3480)
 at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
 at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThrea d.java:197)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread. java:150)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
 at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
</div>
-----------------------
Here's the code, :
 
String lines[] = loadStrings("dinner.txt");
String words[];
 
void setup() {
    // load in the data
  for (int i=0; i<lines.length; i++) {
    words=splitStrings(lines[i], '\t');
    println(words.length);
  }
}
 
-------------
PS - how do I use the code and quote formatting?  I tried div tags but it didn't work.  Thanks!
« Last Edit: Apr 20th, 2004, 11:22pm by jkeirstead »  
fry


WWW
Re: 67 splitStrings not working inside void setup
« Reply #1 on: Apr 21st, 2004, 12:16am »

the problem is with the laodStrings(), which needs to be inside setup() as well.
 
Pages: 1 

« Previous topic | Next topic »