Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No event generating after clicking button

 
Prince khurana
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a JButton in my code as "encode" but no event occurs after pressing it.Like I have added a JOptionPane but the pop up is not showing ?? I have added it to the listener and also to the screen.Please correct me where am I doing wrong ?

Here is my code:



Here is the main class

 
Tony Docherty
Bartender
Posts: 2965
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use Java naming standards ie class names should start with a capital letter. Also, it is advisable to give classes meaningful names, if a class is a listener then call it XXXListener. Finally don't use one listener to handle the events from lots of different components (unless they all require the same basic action to be taken), give each component it's own Listener.

There is a JButton in my code as "encode" but no event occurs after pressing it

How do you know? Have you added print statements so you can see the flow of code execution.
 
Prince khurana
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone help me with this please ??
 
Tony Docherty
Bartender
Posts: 2965
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to help you. Answer my question or better still add some print statements and let us know what happens.
 
Matthew Brown
Bartender
Posts: 4567
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me just support Tony's statement. This would be a lot easier to follow if you we consistent in using conventions and particularly in your indentation. As things stand we'd have to reformat your code to try and work out where the problem is. It would also be far easier to follow if you had a separate event handler for each event rather than one massive event handler to handle all of them. The way you're doing it at the moment isn't a good design.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic