aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes No event generating after clicking button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "No event generating after clicking button" Watch "No event generating after clicking button" New topic
Author

No event generating after clicking button

Prince khurana
Greenhorn

Joined: Mar 30, 2013
Posts: 6
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

Joined: Aug 07, 2007
Posts: 2405
    
  50
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

Joined: Mar 30, 2013
Posts: 6
Can someone help me with this please ??
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2405
    
  50
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

Joined: Apr 06, 2010
Posts: 4490
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: No event generating after clicking button