PickingCallback myPickingCallback = new myPickingCallbackClass();
which needs a class called "myPickingCallbackClass".
You either don't have it or aren't able to get to it which is why you get the error:
Error num 300 class myPickingCallbackClass not found in class Objetos
If you have a separate file with this class, you need to use an import statement.
Or you can just use an inner class (Which is what I did) in the class that you have the line:
PickingCallback myPickingCallback = new myPickingCallbackClass();
Here is an example of mine with nothing in it.
It doesn't actually have to do anything, but you need to have the class with the "transformChanged()" method.
I would just copy this code and put it in the bottom of your "class Objetos{}" class.
If you look at Sun's examples of picking behaviors, there is an example with the callback and it is basically the same as what I have here.
As for the last part of your message, where you comment out the callback line, I am not sure why you are having a problem. Do you get an error, or do they just not work?
Actually, I think the problem is with the PickTranslateBehavior(). Looking at the fields that you are passing to this class, it is obvious that you are using the methods on my web page. The question is how you are importing them. Are you sure you aren't importing Sun's PickTranslateBehavior()? You did copy my behaviors into your own directory structure and compile them?
Under the directory for where my application sits, I have a directory called "mybehaviors" with the "mouse" and "picking" subdirectories under it. I then use the import statements "import mybehaviors.picking.*;"
and "import mybehaviors.mouse.*;"
So again it is:
import mybehaviors.picking.*;
import mybehaviors.mouse.*;
Good luck.
At 10:06 AM 12/19/2000 +0000, you wrote:
Hello,
I�ve tried use your behavior, but I can�t because when I put:
PickingCallback myPickingCallback = new myPickingCallbackClass();
PickTranslateBehavior pickTranslate = new PickTranslateBehavior(obj, canvas, behaveBounds, VPTG, behaviorfix);
obj.addChild(pickTranslate);
pickTranslate.setupCallback(myPickingCallback);
Give me:
Error num 300 class myPickingCallbackClass not found in class Objetos
Objetos is a class where I create a box:
I send you the code, can you help me?????
class Objetos{
public static BranchGroup crear_prisma(float altura,float anchura, float profundidad, Canvas3D canvas,SimpleUniverse simpleU)
{
//Creamos un branch Group
BranchGroup obj = new BranchGroup();
//Creamos la apariencia
Appearance appear_prisma = new Appearance();
TransformGroup objTrans = null;
TransformGroup VPTG = new TransformGroup();
VPTG = simpleU.getViewingPlatform().getMultiTransformGroup().getTransformGroup(0);
BoundingSphere behaveBounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 10000.0);
//Iniclaizamos el comportamiento
PickRotateBehavior behaviorPickRotacion = null;
PickTranslateBehavior behaviorPickTranslacion = null;
PickZoomBehavior behaviorPickZoom = null;
//Creamos una transformacion 3D y lo transladamos a un vector del espacio
Transform3D transform = new Transform3D();
transform.setTranslation(new Vector3f(-0.6f, 0.0f, -0.6f));
objTrans = new TransformGroup(transform);
//Habilito los comportamientos
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
objTrans.setCapability(TransformGroup.ENABLE_PICK_REPORTING);
obj.addChild(objTrans);
//Asigno los atributos de color a un nuevo prisma
Color3f blue = new Color3f(0f,0f,255f);
ColoringAttributes color = new ColoringAttributes();
color.setColor(blue);
appear_prisma.setColoringAttributes(color);
Box Caja = new Box();
Caja = new Box(altura,anchura,profundidad,Box.GENERATE_TEXTURE_COORDS|Box.GENERATE_NORMALS,appear_prisma);
behaviorPickRotacion = new PickRotateBehavior(obj,canvas,behaveBounds);
behaviorPickRotacion.setTolerance(0.1f);
obj.addChild(behaviorPickRotacion);
boolean behaviorfix=true;
PickingCallback myPickingCallback = new myPickingCallbackClass();
PickTranslateBehavior pickTranslate = new PickTranslateBehavior(obj, canvas, behaveBounds, VPTG, behaviorfix);
obj.addChild(pickTranslate);
pickTranslate.setupCallback(myPickingCallback);
behaviorPickZoom = new PickZoomBehavior(obj,canvas,behaveBounds);
obj.addChild(behaviorPickZoom);
//Le a�ado al objeto la nueva caja azul
objTrans.addChild(Caja);
return obj;
}
}
If I put this, the translation don�t work.
//PickingCallback myPickingCallback = new myPickingCallbackClass();
PickTranslateBehavior pickTranslate = new PickTranslateBehavior(obj, canvas, behaveBounds, VPTG, behaviorfix);
obj.addChild(pickTranslate);
//pickTranslate.setupCallback(myPickingCallback);
Thanks
Silvia Villanueva
[EMAIL PROTECTED]
[EMAIL PROTECTED]
P.D If you can�t see my code �can you send my a project with the behaviors working?
Thanks.
***********************************************************************
Eric Reiss -
http://www.sigda.acm.org/Eric/
Email: [EMAIL PROTECTED]
SIGDA Internet Server Manager -
http://www.sigda.acm.org/
Assistant Systems Manager - School of Engineering
University of Pittsburgh
***********************************************************************
