I am writing a text editor application. Right now its really basic with just a JTextArea, and a JMenuBar in a JDialog. The problem I have is if I highlight some text in the JTextArea, when I click on the menu bar the highlighting dissappears. I know it is a focus problem, but is there anything I can do to fix it or get around it? Maybe I am going about this all wrong, any ideas??
posted 14 years ago
Hi, Just a shot in the dark here. How about adding a MouseListener to the JTextArea and onMousePressed() try something like this:
I don't have time to test it right now - it's 1am over here in Europe. Hope that helps,