Sign in to follow this  

[java] ActionListeners

Recommended Posts

I'm looking for a quick explanation on how I should handle menus in my RTS. When I right click on a cell, I want a menu customized for that cell to show.
public final class xMenuCreator{
	private static JPopupMenu popup_menu;		
	private static JMenuItem properties;
	private static JMenuItem move_to;
	public static void init(){
		popup_menu = new JPopupMenu();
		properties = new JMenuItem();
		move_to = new JMenuItem();
	public static JPopupMenu getMenuFor(xCell c){
		// movement
			move_to = new JMenuItem("Move here."){
				public void actionPerformed(ActionEvent e){
		// contents properties

		// properties
		properties.setText("Cell Properties: " + c);
		return popup_menu;
How do I make the highlighted portion work?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this