ItemListener itemListener = new ItemListener() {
public void itemStateChanged(ItemEvent e) {
JRadioButtonMenuItem rb = (JRadioButtonMenuItem) e.getSource();
double rad = Math.PI / 180.;
ImageProcessor imageProcessor = _imageDisplay.getImageProcessor();
if (rb.isSelected()) {
if (rb.getText().equals("No Rotation")) {
imageProcessor.setAngle(0.0);
} else if (rb.getText().equals(" 90 deg")) {
imageProcessor.setAngle(90.0 * rad);
} else if (rb.getText().equals(" 180 deg")) {
imageProcessor.setAngle(180.0 * rad);
} else if (rb.getText().equals(" -90 deg")) {
imageProcessor.setAngle(-90.0 * rad);
}
//else if (rb.getText().equals(" 45 deg (XXX not impl)")) {
// imageProcessor.setAngle(45.0*rad);
//}
imageProcessor.update();
}
}
};
b1.addItemListener(itemListener);