0

how do i remove slected item from jtextarea?

this is my code i replaced selected string with empty string but i want to delete selected item please can anyone help? private class Listener2 implements ActionListener { @Override public void actionPerformed(ActionEvent ae) { string=area.getSelectedText(); if(string!=" "){ area.replaceSelection(" "); }else{ JOptionPane.showMessageDialog(null,"Select something"); } } }

26th Feb 2017, 3:37 PM
Milada Aliosmanova
Milada Aliosmanova - avatar
1 Answer
+ 5
You could also use area.setText(null); but it is equivalent to area.setText("");
26th Feb 2017, 5:12 PM
Tashi N
Tashi N - avatar