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"); } } }
1 Answer
+ 5
You could also use area.setText(null); but it is equivalent to area.setText("");