• Advertisement
Sign in to follow this  

[java] ActionListeners

This topic is 2893 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement