I'd like to have a main tab that contains two napplets.
The upper napplet has a height of 100 and a width like the main tab (is resizable). The under napplet should take the other space..
so we have a upper napplet "menu" with the height: 100 and the width: lastWidth and the under napplet "zeichnen" with the height: lastHeight- 100 and the width: lastWidth.. The problem is, that when I initialize lastWidth/lastHeight in the main tab, they have another "number" in the other tabs.. so how should I do, that I can resize the main window and the other change with it..?
MAIN TAB:
Code:
int lastWidth, lastHeight;
import napplet.*;
NAppletManager nappletManager;
void setup() {
size(600, 600);
nappletManager = new NAppletManager(this);
nappletManager.createNApplet("Menu", 0,0);
nappletManager.createNApplet("Zeichnen", 0,100);
frame.setResizable(true);
lastWidth = width;
lastHeight = height;
registerPre(this);
}
void pre(){
if(width != lastWidth || height != lastHeight){
int deltaX = transx - lastWidth/2;
int deltaY = transy - lastHeight/2;
transx = deltaX + width/2;
transy = deltaY + height/2;
lastWidth = width;
lastHeight = height;
}
}
void draw()
{ background(0);
}
MENU:
Code:public class Menu extends NApplet {
void setup() { registerPre(this);
size(100, 100);
}
void draw() {
background(0, 100, 0);
stroke(255); fill(255);
println(lastWidth);
println(lastHeight);
}
void pre(){
if(width != lastWidth || height != lastHeight){
int deltaX = transx - lastWidth/2;
int deltaY = transy - lastHeight/2;
transx = deltaX + width/2;
transy = deltaY + height/2;
lastWidth = width;
lastHeight = height;
}
}
}
and with the third tab (zeichnen) it should be the same, so it doesn't matter how the code looks...
thanks for every help!!