Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

action listener help in Java?

http://pastebin.com/hAPBUs2E

my compiler doesn't like line 23, and I don't know what's wrong with it. help?

3 Answers

Relevance
  • Silent
    Lv 7
    9 years ago
    Favorite Answer

    You're trying to declare a method called run() inside a method called actionPerformed(). You cannot declare a method inside another method.

  • 9 years ago

    It will probably run fine if you

    Delete line 25

    then

    delete line 23

    (this will let the JOptionPane pop up in the ActionPerformed method directly.)

  • hice
    Lv 4
    4 years ago

    action Listeners are training that you'll upload to particular different training. at the same time as an action takes position to that different type, the ActionListener it truly is further executes the "actionPerformed" approach. regularly, you should have a form that extends ActionListener for you to administration what takes position contained in the "actionPerformed" approach by overriding it. Then once you're including the ActionListener to the object you want to hearken to for, you in simple terms upload a clean social gathering of the kind you created. The listener might want to probable be in a quite a few type.

Still have questions? Get your answers by asking now.