final GraphicsModeControl graphicsModeControl = getGraphicsModeControl();
graphicsModeControl.setScaleEnable(true);
graphicsModeControl.setTextureEnable(false);
// Configure display renderer to set colors, box, mouse, keys.
final DisplayRendererJ3D dRenderer = (DisplayRendererJ3D) getDisplayRenderer();
dRenderer.setForegroundColor(Color.black);
dRenderer.setBackgroundColor(Color.white);
dRenderer.setBoxOn(false);
dRenderer.getMouseBehavior().getMouseHelper()
.setFunctionMap(new int[][][]{{{MouseHelper.ROTATE, // left
// mouse
// button
MouseHelper.ZOOM // SHIFT + left mouse button
}, {MouseHelper.ROTATE, // CTRL + left mouse button
MouseHelper.ZOOM // CTRL + SHIFT + left mouse
// button
}}, {{MouseHelper.NONE, // middle mouse button
MouseHelper.NONE // SHIFT + middle mouse button
}, {MouseHelper.NONE, // CTRL + middle mouse button
MouseHelper.NONE // CTRL + SHIFT + middle mouse
// button
}}, {{MouseHelper.TRANSLATE, // right mouse button
MouseHelper.DIRECT // SHIFT + right mouse button
}, {MouseHelper.TRANSLATE, // CTRL + right mouse button
MouseHelper.DIRECT // CTRL + SHIFT + right mouse
// button
}}});
// Set the keyboard behavior.
final KeyboardBehaviorJ3D keyBehavior = new KeyboardBehaviorJ3D(
dRenderer);
keyBehavior.mapKeyToFunction(KeyboardBehaviorJ3D.ROTATE_X_POS,
KeyEvent.VK_DOWN, 0);
keyBehavior.mapKeyToFunction(KeyboardBehaviorJ3D.ROTATE_X_NEG,
KeyEvent.VK_UP, 0);
keyBehavior.mapKeyToFunction(KeyboardBehaviorJ3D.ROTATE_Y_POS,
KeyEvent.VK_LEFT, 0);
keyBehavior.mapKeyToFunction(KeyboardBehaviorJ3D.ROTATE_Y_NEG,
KeyEvent.VK_RIGHT, 0);
keyBehavior.mapKeyToFunction(KeyboardBehaviorJ3D.ROTATE_Z_POS,
KeyEvent.VK_PAGE_UP, 0);
keyBehavior.mapKeyToFunction(KeyboardBehaviorJ3D.ROTATE_Z_NEG,
KeyEvent.VK_PAGE_DOWN, 0);
keyBehavior.mapKeyToFunction(KeyboardBehavior.ZOOM_IN,
KeyEvent.VK_PLUS, 0);
keyBehavior.mapKeyToFunction(KeyboardBehavior.ZOOM_OUT,
KeyEvent.VK_MINUS, 0);
keyBehavior.mapKeyToFunction(KeyboardBehavior.ZOOM_IN, KeyEvent.VK_ADD,
0);
keyBehavior.mapKeyToFunction(KeyboardBehavior.ZOOM_OUT,
KeyEvent.VK_SUBTRACT, 0);
dRenderer.addKeyboardBehavior(keyBehavior);
// Set text control properties.
final TextControl textControl = (TextControl) annotationMap
.getControl();
textControl.setCenter(true);