Finding a way to be notified when ENTER is pressed in a JTextPane
I want to be able to do some processing when the ENTER key is pressed in JTextPane. However I also want the key to do what it is supposed to do - begin a new line. I can map the ENTER key to do processing, and I can map it to insert a newline. But I can't seem to do both. There has to be a way to be notified when the ENTER key is pressed so that I can use the notification to initiate other processing.
This could involve being able to read each character as it is input to the JTextPane and when the ENTER key is pressed or newline is entered, an if statement could be used.But I'm at a lost as to how to get the script to read each character.
Any help would be greatly appreciated.
Thanks

