Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

JMenuItem ActionListiner problem

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting jMenuItem ActionListiner problem in MainMenu jFrame for DeleteCustomer jFrame

I want to perform multiple jMenuIteam Listiner operation for multiple JMenuItem given in the MainMenu Jframe. I am successfull for New Customer jFrame but unable to
perform same operation for anothers jMainItem.
So this is the code
Login jFrame



MainMenu COde:





New Customer Code:


Delete Customer :




can any one help me...
thank for the help who want to help me in the advance.
 
Sheriff
Posts: 21817
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please refrain from using colours unnecessarily in the future? I couldn't read your yellow text at all, so I have removed the yellow.
 
Deva Devaa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok.. but help me
 
Saloon Keeper
Posts: 10785
231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Deva, welcome to CodeRanch!

A quick look makes me question it should perform any actions at all. I don't see where you actually add any action listeners to the menu items. Maybe you should try that first.

It's a very bad idea to make your frames into huge action listeners for all the items though. A much better approach is to create an individual Action for each action (sounds logical, doesn't it?) and then you can add the Actions to menus and toolbars. This has the added benefit that you can reuse actions, and easily disable them if needed. Here's an example:
 
Deva Devaa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for New Customer jFrame i added ActionListiner and its works for it, but whenever i tried to do the same thing for Delete Customer from MainMenu its does not work,i got the error.. then how to solve it
 
Stephan van Hulst
Saloon Keeper
Posts: 10785
231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What error?

Please post the stack trace you're getting, and the line number in which you're adding the listener.
 
You don't like waffles? Well, do you like this tiny ad?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!