In The Name OF Allah
Al-Salam Alekum
Hi guys, in Java Swing we don't have a direct method for copying a text as we have in JavaFX so we will use this method today to copy a text from (TextArea, TextField).
Code:
String get = textArea1.getText() ; //getting a text
StringSelection selection = new StringSelection(get); //selecting all to the text
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); //Define a clipboard
clipboard.setContents(selection, selection); //copy the text ;)
Wa Salam Alekum
* Thankful to Allah *
Kurdy