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 & HelpSyntax Questions › Processing / Eclipse code trouble
Page Index Toggle Pages: 1
Processing / Eclipse code trouble (Read 290 times)
Processing / Eclipse code trouble
Mar 30th, 2009, 6:50am
 
Hello,

i'm about to try working with Eclipse and so I wrote my code in Processing and then tried it inside of Eclipse.
I've read trough the tutorial on this site, and there is basically no error given in the Eclipse debugger. (the code is copied from Eclipse that's why there are some slight changes to Processing)

Code:

import processing.core.*;
public class Processing extends PApplet {

StringBuffer buffer1;
String string1;
public int int1;
String[] lines;
public int counter;
public void setup() {

size (500,500);
 smooth();
 noStroke();
 buffer1 = new StringBuffer();
}
public void draw() {
}
public void keyReleased() {
 if (counter == 0 && key != ENTER) {
   buffer1.append(key);    
   string1 = buffer1.toString();
   int1 = Integer.valueOf(string1).intValue();
 }
 if (key == ENTER) {
   counter ++;
 }
 if (counter == 1) {
 analyze();
 }
 if (key == TAB) {
   setup();
   int1 = 0;
   counter = 0;
 }
}
void analyze() {
   Farbe();
   rect (mouseX, mouseY, 100,100);
}
void Farbe() {
 String[] lines = loadStrings("colors.txt");
 int[] colorList = new int[lines.length];
 for (int i = 0; i < lines.length; i++) {
   int tab = lines[i].indexOf(TAB);
   String stuff = lines[i].substring(tab + 2);  
   int c = unhex(stuff);
   colorList[i] = 0xFF000000 | c;
   fill (colorList [int1-1]);
 }
}
}


In Processing the code works perfectly fine. In Eclipse this code only works, when I delete the method "analyze()" and put the two lines of code inside of this:
Code:

if (counter == 1) {
analyze();
}


Does anyone has an idea why Eclipse does not accept the method "analyze"? I don't have a slightest idea.....
The debugger marks this line of code as the reason for the error:
Code:

int1 = Integer.valueOf(string1).intValue();


Thank you so very much!
Page Index Toggle Pages: 1