if it helps you, here the three tabs:
main tab:
Code:import napplet.*;
NAppletManager nappletManager;
void setup() {
size(600, 600);
nappletManager = new NAppletManager(this);
nappletManager.createNApplet("Menu", 0,0);
nappletManager.createNApplet("Zeichnen", 0,100);
}
void draw()
{ background(0);
}
menu:
Code:
void setup() { size(600, 100);
}
void draw() {
background(0, 100, 0);
stroke(255); fill(255);
}
zeichnen: (a bit long, not really important, didn't know whether "void draw()" or "public void draw()")
Code:
float rotx=-.02, roty=-.04;
int achl=600;
int a=100, offx=0, offy=0,offz=0;
int transx, transy, transz=-300;
int lastWidth, lastHeight;
int pfeil=6;
void setup() { size(600, 500,P3D);
stroke(0);
strokeWeight(1);
strokeJoin(MITER);
transx=width/2;
transy=height/2;
}
void draw() {
background(255);
pushMatrix();
translate(transx,transy,transz);
rotateX(rotx);
rotateY(roty);
koordinatensystem();
popMatrix();
}
void koordinatensystem(){
strokeWeight(1.5);
beginShape(LINES);
stroke(255,0,0); //z-achse rot
vertex(0,0,-achl);
vertex(0,0,achl);
vertex(0,0,-achl); // Pfeil 1
vertex(pfeil,0,-achl+pfeil);
vertex(0,0,-achl);
vertex(-pfeil,0,-achl+pfeil);
vertex(0,0,achl); //Pfeil 2
vertex(pfeil,0,achl-pfeil);
vertex(0,0,achl);
vertex(-pfeil,0,achl-pfeil);
stroke(0,255,0); //y-achse grün
vertex(0,-achl,0);
vertex(0,achl,0);
vertex(0,achl,0); // Pfeil 1
vertex(0,achl-pfeil,pfeil);
vertex(0,achl,0);
vertex(0,achl-pfeil,-pfeil);
vertex(0,-achl,0); // Pfeil 2
vertex(pfeil,-achl+pfeil,0);
vertex(0,-achl,0);
vertex(-pfeil,-achl+pfeil,0);
stroke(0,0,255); //x-achse blau
vertex(-achl,0,0);
vertex(achl,0,0);
vertex(-achl,0,0); // Pfeil 1
vertex(-achl+pfeil,0,pfeil);
vertex(-achl,0,0);
vertex(-achl+pfeil,0,-pfeil);
vertex(achl,0,0); // Pfeil 2
vertex(achl-pfeil,0,pfeil);
vertex(achl,0,0);
vertex(achl-pfeil,0,-pfeil);
endShape();
}
void mouseDragged() { float factor = 0.01;
if (key==CODED){ // Alt + Maus --> Rotation
if(keyCode==ALT){
rotx += (pmouseY-mouseY) * factor;
roty += (mouseX-pmouseX) * factor;
}
if(keyCode==CONTROL){ // Ctrl + Maus --> Translation
transx+=(mouseX-pmouseX); transy+=(mouseY-pmouseY); } }}
void keyPressed(){
if(key!=CODED){
if (key=='1'){
rotx=0;
roty=0;
transx=width/2;
transy=height/2;
transz=-300;
}
if (key=='3'){
rotx=0;
roty=radians(-90);
transx=width/2;
transy=height/2;
transz=-300;
}
if (key=='7'){
rotx=radians(-90);
roty=0;
transx=width/2;
transy=height/2;
transz=-300;
}
}
if (key == CODED) {
if(keyCode==CONTROL){
if(key=='1'){
rotx=0;
roty=PI;
}
if(key=='3'){
rotx=0;
roty=radians(90);
}
if(key=='7'){
rotx=radians(90);
roty=0;
}
}
}
}
}
And I've also tried (when I had only one tab with other classes) to place a button (controlp5) in one napplet and to do something in the second napplet if the button is pressed.. but it also doesn't work.. don't know what I forgot.. thanks for your help..