Skip to main content

switch the MouseBehavior

2 replies [Last post]
Anonymous

First I want to use the MouseBehavior for my drawing and after this for the PointLight. How can I switch the MouseBehavior? Do I have to create the new BranchGroup, SimpleUniverse?

objRoot = new BranchGroup();

TransformGroup drawing = new TransformGroup();
TransformGroup light = new TransformGroup();

objRoot.addChild(drawing);

Shape3D shape = new …;
drawing.addChild(shape);

// Mouse Rotate
MouseRotate m_rot = new MouseRotate();
m_rot.setTransformGroup(drawing);
m_rot.setSchedulingBounds(allBounds);
objRoot.addChild(m_rot);

// Mouse Translate
MouseTranslate m_trans = new MouseTranslate();
m_trans.setTransformGroup(drawing);
m_trans.setSchedulingBounds(allBounds);
objRoot.addChild(m_trans);

public void swithOfMause()
{
what do I have to write here?

// Mouse Rotate

MouseRotate m_rot = new MouseRotate();
m_rot.setTransformGroup(light);
m_rot.setSchedulingBounds(allBounds);
objRoot.addChild(m_rot);

// Mouse Translate
MouseTranslate m_trans = new MouseTranslate();
m_trans.setTransformGroup(light);
m_trans.setSchedulingBounds(allBounds);
objRoot.addChild(m_trans);

}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Gilson Laurent

Hello

On Sunday 21 November 2004 16:36, java3d-interest@javadesktop.org wrote:
> First I want to use the MouseBehavior for my drawing and after this for the
> PointLight.

Create 2 Mousebehaviors at launchTime. Switch them on and off with
behavior.setEnable(false/true), just when you like. (don't switch them all on
at the same time.... it's looking funny, but not really useful)

cu
[att1.dat]

Anonymous

thank you very much