-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetMenu.java
More file actions
30 lines (26 loc) · 823 Bytes
/
SetMenu.java
File metadata and controls
30 lines (26 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import javax.swing.*;
import java.awt.event.*;
/** @author Gergwly Kota
SetMenu lumps and a ValueMenuItem another JMenuItem "set as default" into a JMenu. The
"set as default" JMenuItem writes the ValueMenuItem's current value to the config file.
*/
public class SetMenu extends JMenu
{
/** @param title the name of the JMenu
@param item the ValueMenuItem to lump
@param key the key value to use when writing to the config file
*/
public SetMenu(String title, final ValueMenuItem item, final String key)
{
super(title);
add(item);
JMenuItem jmi = new JMenuItem("Set as Default");
jmi.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
// add ConfigWriter here ...
Config.write(key, item.value());
}
});
add(jmi);
}
}