Results 1 to 2 of 2
  1. #1
    AmyHill is offline Member
    Join Date
    Oct 2009
    Posts
    1
    Rep Power
    0

    Default ActionListener new user

    I have an address applet that I have an actionlistener and I'm having a problem getting the syntax correct to convert a long to a int. I'm very new so here we go... the errors are in the try statement. Any ideas?

    jbtSearch.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {

    try {Long searchPosition = raf.seek(2);
    String seek = jtfSearch.getText();
    Integer seek = Integer.parseInt(seek.trim())-1;
    jtfSeek.getText();


    readAddress(searchPosition - 2 * RECORD_SIZE);
    if (searchPosition < 0)
    readAddress(searchPosition);
    }
    catch (IOException ex) {
    ex.printStackTrace();
    }
    }
    });

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

    Default

    You've got two different variables, seek, with the same name, and this may be causing your error.

    I recommend that you post your error messages with your question in the next go-around.

Similar Threads

  1. How to access the ActionListener
    By jboy in forum New To Java
    Replies: 3
    Last Post: 10-15-2009, 07:04 PM
  2. NullPointerException by ActionListener
    By YouGina in forum AWT / Swing
    Replies: 8
    Last Post: 07-10-2009, 12:08 PM
  3. Demonstrating the ActionListener
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 04-23-2008, 09:20 PM
  4. How to use KeyListener and ActionListener
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 04-23-2008, 09:19 PM
  5. ActionListener interface
    By tsantana in forum New To Java
    Replies: 2
    Last Post: 03-30-2008, 11:24 PM

Posting Permissions

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