Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

JTextField (Java... obvious maby)

  • 04-05-2006 03:42PM
    #1
    Closed Accounts Posts: 521 ✭✭✭


    Is there a way to add an actionlistener to a JTextArea?
    e.g.
    exampleArea.addActionListener(this);

    The above doesnt work though....

    Any help please.


Comments

  • Registered Users, Registered Users 2 Posts: 821 ✭✭✭Dr Pepper


    Not an ActionListener but you could add a KeyListener just as easily which could respond to the 'Enter' key being pressed (which is the same thing as an ActionListener essentially). Only problem with that is the enter key is usually used in a text area to add a newline!! So perhaps you could use ctrl-Enter or alt-Enter to fire your event instead.
    Let me know if you want an example and I'll write some code for you!

    Brian


  • Closed Accounts Posts: 521 ✭✭✭EOA_Mushy


    Cheers man, but no need to write the code. I have seen some thing similar done with the tab key. (Next rather then tab character) Im sure ill be able to modify that.


Advertisement