We are about to switch to a new forum software. Until then we have removed the registration on this forum.
How do I put this code into different tabs by making it into an object; Separate class and my main body of code into different tabs.
void setup(){
size(200,200);
ellipseMode(CENTER);
rectMode(CENTER);}
void draw(){
background(0);
translate(X,Y);
rotate(r=(r+(t?.1:0))%TWO_PI);
stroke(39,242,29);
fill(255);
triangle(0,0,30,80,-30,80);
fill(39,242,29);
ellipse(0,5,60,60);
stroke(127);
line(10,20,-10,20);
fill(mouseX,0,mouseY);
ellipse(-19,0,16,25);
ellipse(19,0,16,25);
stroke(255);
line(-10,80,-20,100);
line(-20,100,-10,60);
line(10,80,20,100);
line(20,100,10,50);}
void keyPressed(){
if(key==CODED)
{if(keyCode==UP)Y--;
if(keyCode==DOWN)Y++;
if(keyCode==RIGHT)X++;
if(keyCode==LEFT)X--;}if(key=='t'){t=!t;}}
float X=100,Y=100,r;
boolean t;
Answers
ControlP5
You don't need tabs to make objects (classes), methods or functions. Tabs are for code organization basically. Read about them here But I think you are more interested in make an object than a tab, right? This is a good start: http://processing.org/tutorials/objects/
And another:
http://wiki.processing.org/w/From_several_arrays_to_classes
And here a little sample. To properly handle the keys with the objects, you will need some kind of selection, which one to move? Right now they move all together. This is your code fast wrapped in a class, as an illustration. You will learn better from the articles than from this code.