I have a JTextArea and I have a menu which allows you to cut, copy and paste information through the cut()
, copy()
and paste()
methods. However, I want these methods to get the highlighted text from the text area and use that in the methods. Is this possible and how would you go about achieving this?
Use JTextArea.getSelectedText()