mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
use ButtonGroup for Mode menu (#2545)
This commit is contained in:
@@ -384,20 +384,18 @@ public abstract class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
protected void initModeMenu() {
|
||||
modeMenu = new JMenu();
|
||||
ButtonGroup modeGroup = new ButtonGroup();
|
||||
for (final Mode m : base.getModeList()) {
|
||||
JRadioButtonMenuItem item = new JRadioButtonMenuItem(m.getTitle());
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
base.changeMode(m);
|
||||
}
|
||||
});
|
||||
modeMenu.add(item);
|
||||
modeGroup.add(item);
|
||||
if (mode == m) {
|
||||
JRadioButtonMenuItem item = new JRadioButtonMenuItem(m.getTitle());
|
||||
// doesn't need a listener, since it doesn't do anything
|
||||
item.setSelected(true);
|
||||
modeMenu.add(item);
|
||||
} else {
|
||||
JMenuItem item = new JMenuItem(m.getTitle());
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
base.changeMode(m);
|
||||
}
|
||||
});
|
||||
modeMenu.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
0228 pde
|
||||
X increase heap size to 256m (-Xmx256) per Manindra request
|
||||
X use a ButtonGroup so that the current Mode cannot be de-selected
|
||||
X https://github.com/processing/processing/issues/2545
|
||||
|
||||
_ color selector for the pref
|
||||
_ https://github.com/processing/processing/pull/2568
|
||||
|
||||
Reference in New Issue
Block a user