We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
I try to install the PApplet in eclypse for make bigger and cleaner project, the installation work : i can launch a window and add content. But, i want create external class who call methods like rect(float, float, float, float) or other.
My first tab :
package fr.hyper_mïko.gereform;
import processing.core.PApplet;
public class GereForm extends PApplet{
protected byte nPage;
public static void main(String[] args) {
PApplet.main("fr.hyper_mïko.gereform.GereForm");
}
public void settings() {
fullScreen(2);
}
public void setup() {
background(0);
}
public void draw() {
rect(mouseX, mouseY, 10, 10); //It's working
}
}
My second tab :
package fr.hyper_mïko.gereform.util.IO;
import processing.core.*;
public class Button extends Inputs{
public Object interact() {
if(PApplet.mouseX > this.posX) //Here i tried to read mouseX like in processing ide
return null;
}
public void process() {}
public void display() {
PApplet.rect(posX, posY, sizeX, sizeY); //Here i tried to call rect() like in processing ide
}
}
Of course i have the abstract superclass Inputs with posX, posY, sizeX, sizeY
on PApplet.mouseX and PApplet.rect() in have the error "Cannot make a static reference to the non-static field PApplet.mouseX" and "Cannot make a static reference to the non-static method rect(float, float, float, float) from the type PApplet"
I understand the error but i don't know how to fix it.
Someone call tell me what is wrong with my code (or with me) ?
Answers
Either your Button class or its parent Inputs need to request the PApplet instance reference from your GereForm class. :-B
Best place to request that PApplet reference is straight from your class' constructor: *-:)