summaryrefslogtreecommitdiff
path: root/src/tesseract/generators/MenuItem.java
blob: 2990cea5105dc50c6f3a9685f3b6553ec5be6e84 (plain)
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
31
32
33
34
35
36
37
38
package tesseract.generators;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenuItem;

import tesseract.World;

/**
 * Parent class for generator menus.
 * 
 * @author jesse
 */
public abstract class MenuItem extends JMenuItem {

	/**
	 * Serial UID.
	 */
	private static final long serialVersionUID = 5591914377175098868L;

	protected MenuItem(final String label, final World theWorld) {
		super(label);
		
		addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				generate(theWorld);
			}
		});
	}
	
	/**
	 * Generate.
	 * 
	 * @param World the world to put it in.
	 */
	public abstract void generate(final World theWorld);
}