2010-12-21 3 views
1

그래서 처리 IDE를 사용하고 계속이 이상한 널 포인터 예외가 발생합니다. 글프로세싱 및 널 포인터 예외가 발생합니다

예외 "메인"java.lang.NullPointerException이 processing.core.PApplet.displayable에서
(PApplet.java:9944) processing.core.PApplet.main에서
(PApplet.java:7425)

그게 내가 얻을 수있는 모든 정보입니다. 그래서 그것이 어디서 발생하는지 추적 할 수도 없습니다. 여기 내 코드는

import TUIO.*; 

TuioProcessing tuioClient; 
Vector tuioCursorList; 
Point cols[][]; 


void setup(){ 
    size(1440,900); 
    tuioClient = new TuioProcessing(this); 
    tuioCursorList = tuioClient.getTuioCursors(); 
    init(); 
} 

void draw(){ 
    background(0); 


} 

void init(){ 
    cols = new Point[width][height]; 
    for(int i = 0; i<width;i++){ 
    for(int x = 0; x<height;x++){ 
     cols[i][x] = new Point(i,x); 
    } 
    } 
} 

class Point{ 

    int x, y; 
    boolean alive; 
    int life; 
    int pointColor; 

    Point(int _x, int _y){ 
    x = _x; 
    y = _y; 
    pointColor = 0; 
    alive = false; 
    fill(pointColor); 
    point(x, y); 

    } 

    void checkStatus(){ 
    if(alive = true){ 
     isAlive(); 
    } 
    else{ 
     isDead(); 
    } 
    } 

    void isDead(){ 
    pointColor = 0; 
    life = 0; 
    } 

    void isAlive(){ 
    pointColor = 255; 
    life = 100; 
    } 

    void kill(){ 
    life--; 
    } 

} 

// called when an object is added to the scene 
void addTuioObject(TuioObject tobj) { 
    println("add object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+"  "+tobj.getY()+" "+tobj.getAngle()); 
} 

// called when an object is removed from the scene 
void removeTuioObject(TuioObject tobj) { 
    println("remove object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")"); 
} 

// called when an object is moved 
void updateTuioObject (TuioObject tobj) { 
    println("update object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")  "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle() 
    +" "+tobj.getMotionSpeed()+" "+tobj.getRotationSpeed()+" "+tobj.getMotionAccel()+"  "+tobj.getRotationAccel()); 
} 


// called when a cursor is added to the scene 
void addTuioCursor(TuioCursor tcur) { 
    println(tcur.getX()+", "+tcur.getY()); 
} 

// called when a cursor is moved 
void updateTuioCursor (TuioCursor tcur) { 
    println(tcur.getSessionID() + " - " + tcur.getX()+", "+tcur.getY()); 
} 

// called when a cursor is removed from the scene 
void removeTuioCursor(TuioCursor tcur) { 
} 

// called after each message bundle 
// representing the end of an image frame 
void refresh(TuioTime bundleTime) { 
    redraw(); 
} 

누군가가이 이상한 오류를 알아낼 수 있습니다. 어떤 도움을 많이 주시면 감사하겠습니다.

+4

그건 컴파일 할 수있는 것이 아닙니다. – Falmarri

+0

이 이상한 오류는 무엇이 잘못되었는지를 명확하게 보여주는 문서를 가지고 있습니다. 게다가 - "9000 개가 넘는"줄이있는 애플릿? 그건 좋은 것 같지 않아. – Bozho

+0

@Falmarri : "순수한"Java 코드가 아닙니다. [Processing] (http://processing.org/)은이 코드를 취하여 뒤에서 편집 가능한 Java 코드로 변환합니다. –

답변

3

init()의 기능을 다른 이름으로 바꿉니다. Processing의 내장 클래스의 init() 함수를 효과적으로 오버라이드하고 있습니다.

+0

그게 도움이 답변을 주셔서 감사합니다 – Joe