Results 1 to 4 of 4
  1. #1
    aserothbw is offline Member
    Join Date
    Aug 2009
    Posts
    9
    Rep Power
    0

    Default exception error in a ActionListener class

    I am having an issue with one of the GUIs I am currently working on. The GUI itself works fine, but the actionlistener tied to it, keeps coming up with exception errors.

    The listener is used to create an instance of a seperate class that connects to, accesses, and returns data from a database. All of the database functions are kept within the class, and all its exceptions are handled, etc. However, when I try to code the listener on the gui side, I keep getting compile errors asking for the exceptions being handled in the db class to be added to the actionlistener. If I add them, I get more compiler errors stating that they are not compatible with actionlistener.actionperformed. Can anyone shed some light on this problem?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    28

    Default

    I'm a bit confused. Are you getting compile-time errors or run-time errors? It seems like you might have to post some code and the error messages themselves.

  3. #3
    gancio is offline Member
    Join Date
    Aug 2009
    Posts
    11
    Rep Power
    0

    Default

    I guess you trying to handle those exceptions with throws.. well you can't due to overriding.
    Just try to use try and catch.

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    10

    Default

    ActionListeners are not allowed to throw checked exceptions so you have to handle them yourself.

Similar Threads

  1. exception error in a ActionListener class
    By aserothbw in forum AWT / Swing
    Replies: 6
    Last Post: 09-04-2009, 03:07 PM
  2. Exception error
    By Rose88 in forum New To Java
    Replies: 8
    Last Post: 07-06-2009, 10:22 PM
  3. Exception error
    By jaiminparikh in forum New To Java
    Replies: 0
    Last Post: 03-20-2009, 10:06 PM
  4. ActionListener Error
    By blackstormattack in forum New To Java
    Replies: 1
    Last Post: 03-05-2009, 09:36 AM
  5. JSF error+exception
    By Peter in forum SWT / JFace
    Replies: 1
    Last Post: 07-04-2007, 06:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •