How to add ActionListener to JMenuItem?

<>

This question already has an answer here:

Answers


One way that you can add an ActionListener to your container is :

public class JMenuClass extends JFrame implements ActionListener

Then, for each JMenuItem that you need a listener, you would do

item.addActionListener(this)

At the bottom of your class, you would need to add your actionPerformed methods, or however you want to implement it.

Cheers


Need Your Help

Windows 8 App Store development - Library Reference Behaviour

c# windows-8 microsoft-metro .net-4.5

I am new to Windows 8 App Store development and have bumped into something strange.

Aligning issue

html css

I'm having a few alignment issues with Tumblr.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.