After copying and pasting your Processing code into a subclass of JProcessing.Processing, There will be a few changes that is required to make for your code to run in Java IDE:
1. Decimal Precisions
Java's default decimal precision is double, while Processing's use float as its default. When assigning values to float numbers, change: float n = 0.5; to: float n = 0.5f;
2. Variable Casting
Processing uses different variable casting syntax compared to Java. In Processing, variable casting using the following syntax: m = int(0.5); n=char(27); p=float(PI); needs to be changed to: m = (int)0.5; n=(char)27; p=(float)Math.PI; in Java IDE.
3. Method Modifier
All event methods in JProcessing.Processing have scope modifiers protected. They will have to be also assigned with protected or public when you override them. For example:
change void setup(){ } to public/protected void setup(){ } ,
change void draw(){ } to public/protected void draw(){ } ,
change void mousePressed(){ } to public/protected void mousePressed(){ } etc.
After copying and pasting your Processing code into a subclass of
JProcessing.Processing
, There will be a few changes that is required to make for your code to run in Java IDE:1. Decimal Precisions
Java's default decimal precision is
double
, while Processing's usefloat
as its default. When assigning values to float numbers, change:float n = 0.5;
to:float n = 0.5f;
2. Variable Casting
Processing uses different variable casting syntax compared to Java. In Processing, variable casting using the following syntax:
m = int(0.5); n=char(27); p=float(PI);
needs to be changed to:m = (int)0.5; n=(char)27; p=(float)Math.PI;
in Java IDE.3. Method Modifier
All event methods in
JProcessing.Processing
have scope modifiersprotected
. They will have to be also assigned withprotected
orpublic
when you override them. For example:change
void setup(){ }
topublic/protected void setup(){ }
,change
void draw(){ }
topublic/protected void draw(){ }
,change
void mousePressed(){ }
topublic/protected void mousePressed(){ }
etc.