I am so sorry I have been busy as hell.
Case is i have a class that I want to do some instances of, i want do draw them in one applet and access varibles in another.
So, i have what inside processing was an inner class.
Quote:
class slider {
int sliderWidth = 50;
int sliderHeight = 10;
int sliderYMin;
int sliderYMax;
int TextSize = 26;
boolean activeSlider = false;
boolean sliderOver = false;
int sliderOffsetX;
int sliderOffsetY;
boolean mouseSliderDown;
PFont orator;
int sliderX;
int sliderY;
String description;
slider (int x, int y, int defaultY, int Max, String d) {
sliderX = x;
sliderY = defaultY;
description = d;
sliderYMin = y;
sliderYMax = Max;
orator = loadFont("OratorStd-48.vlw");
if(defaultY < y){
print("Default y value exeeds the minimum y position.");
exit();
}
}
void updateMouse(int x, int y)
{
if ( overSlider(sliderX, sliderY, sliderWidth, sliderHeight) ) {
sliderOver = true;
}
else {
sliderOver = false;
}
}
boolean overSlider(int x, int y, int width, int height)
{
if (mouseX >= x && mouseX <= x+width &&
mouseY >= y && mouseY <= y+height) {
return true;
}
else {
return false;
}
}
void update() {
fill(255);
smooth();
textFont(orator);
textSize(TextSize);
text((sliderY-height+(height-sliderYMax))*-1,sliderX,sliderYMax+TextSize+5);
textSize(12);
text(description,sliderX,sliderYMax+TextSize+15,45,999);
if(mouseSliderDown){
sliderY= constrain(mouseY, sliderYMin+sliderOffsetY, sliderYMax+sliderOffsetY)-sliderOffsetY;
activeSlider = true;
}
if((sliderOver) | (activeSlider)){
fill(0,255,142);
}
else {
fill(255);
}
noStroke();
rect(sliderX, sliderY, sliderWidth, sliderHeight);
}
void pressed()
{
if(sliderOver){
sliderOffsetX = mouseX - sliderX;
sliderOffsetY = mouseY - sliderY;
mouseSliderDown = true;
}
}
void released() {
mouseSliderDown = false;
activeSlider = false;
}
}
As these are varibles that change, as it is a slider, i have to put myObject.updateMouse(x,y) and myObject.Update() in the applet that draws the slider. If i do this class as an innerclass the this applet I cant seem to access them in other applet where i want to access the variable. If I do a public class i get nullPointerExeptions when putting myObject.updateMouse(x,y) and myObject.Update(). Basically i need to be tld what to do.
I have a slider class that i want do draw i one app, and another app where i can access he varibles of the objects of the class.
Again sorry for the delay.