I'm
having some trouble with a very simple app: I have a couple of shapes on the
screen and need to change the colour of one of them by clicking on it with the
mouse. Unfortunately I keep getting a
CapabilityNotSetException:
Exception occurred during Behavior execution:
javax.media.j3d.CapabilityNotSetException:
Shape3D: no capability to get appearance
at
javax.media.j3d.Shape3D.getAppearance(Shape3D.java:430)
at
ids.java3d.HatColourBehavior.updateScene(HatColourBehavior.java:55)
at
com.sun.j3d.utils.picking.behaviors.PickMouseBehavior.processStimulus(PickMouseBehavior.java:153)
at
javax.media.j3d.BehaviorScheduler.doWork(BehaviorScheduler.java:167)
at
javax.media.j3d.J3dThread.run(J3dThread.java:256)
The
failure occurs when trying to execite the getAppearance() method. The thing is,
as far as I know, I *have* set the capability. The code I'm using to create the
object is:
MagicHat hat = new
MagicHat();
hat.setPickable(true);
hat.setCapability(Node.ENABLE_PICK_REPORTING);
hat.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
hat.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
hat.setPickable(true);
hat.setCapability(Node.ENABLE_PICK_REPORTING);
hat.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
hat.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
I
even went into the MagicHat class (which extends Shape3D and consists of two
Cylinders) and set ENABLE_APPEARANCE_MODIFY on the two
Cylinders.
Any
ideas what I'm doing wrong? Am I missing something really
obvious?
Thanks,
Matt
