incorporate Mode fix from Joel (issue #2615)

This commit is contained in:
Ben Fry
2014-07-26 10:25:10 -04:00
parent aef416d36f
commit d20a9de361
3 changed files with 13 additions and 2 deletions
+7 -2
View File
@@ -389,8 +389,13 @@ public abstract class Editor extends JFrame implements RunnerListener {
JRadioButtonMenuItem item = new JRadioButtonMenuItem(m.getTitle());
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
base.changeMode(m);
if (sketch.isModified()) {
if (!sketch.isModified()) {
base.changeMode(m);
} else {
// Re-select the old checkbox, because it was automatically
// updated by Java, even though the Mode could not be changed.
// https://github.com/processing/processing/issues/2615
for (Component c : modeMenu.getPopupMenu().getComponents()) {
if (c instanceof JRadioButtonMenuItem) {
if (((JRadioButtonMenuItem)c).getText() == mode.getTitle()) {