I have a JButton, which has a setActionCommand and setActionListener. When I click on the button the event is generated and is handled by the actionListener. How can I generate the event programmatically as if the button is really pressed?
Joined: Jun 09, 2003
an alternative is to move the code from actionPerformed into a separate method and call the method from actionPerformed(). You can then call the same method from other parts of the program.
Joined: Jun 23, 2004
My actual problem was, to access the local file system in an applet. I found the code on the net, signed it and it works fine. But when I do the equivalent of what the code si doing in my own public method, creating new file and all, I get a permission denied exception. Any pointers regarding this?
doClick is raising the event. However, the security system is somehow aware of the execution comes to the actionPerformed().
When I do a click on the browser, the file is accessed fine. But when I do it thru a doClick call in my public method, I get a permission denied exception. Smart!! But what is the workaround??