use of artisynth.core.driver.Main.SelectionMode in project artisynth_core by artisynth.
the class SelectionToolbar method setSelectionButtons.
public void setSelectionButtons() {
// create an array of all the selection buttons
ArrayList<JButton> selectionButtons = new ArrayList<JButton>();
selectionButtons.add(selectButton);
selectionButtons.add(ellipticSelectButton);
selectionButtons.add(scaleButton);
selectionButtons.add(transrotateButton);
selectionButtons.add(translateButton);
selectionButtons.add(rotateButton);
selectionButtons.add(constrainedTranslateButton);
selectionButtons.add(pullButton);
// selectionButtons.add (articulatedTransformButton);
// selectionButtons.add(addMarkerButton);
// get the button that is currently selected
SelectionMode mode = main.getSelectionMode();
JButton selectedButton = null;
switch(mode) {
case Select:
{
selectedButton = selectButton;
break;
}
case EllipticSelect:
{
selectedButton = ellipticSelectButton;
break;
}
case Scale:
{
selectedButton = scaleButton;
break;
}
case Translate:
{
selectedButton = translateButton;
break;
}
case Transrotate:
{
selectedButton = transrotateButton;
break;
}
case Rotate:
{
selectedButton = rotateButton;
break;
}
case ConstrainedTranslate:
{
selectedButton = constrainedTranslateButton;
break;
}
case Pull:
{
selectedButton = pullButton;
break;
}
default:
{
throw new InternalErrorException("unimplemented mode " + mode);
}
}
// remove the button that is currently selected from the array list
selectionButtons.remove(selectedButton);
// set the decoration on the selected button
selectedButton.setBorder(bevelBorder);
selectedButton.setBackground(Color.LIGHT_GRAY);
// set the decoration on the unselected buttons
for (JButton b : selectionButtons) {
b.setBorder(border);
b.setBackground(background);
}
}
Aggregations