Copying Text from a Dialog Box...
843805Aug 23 2006 — edited Aug 23 2006Okay, I have a program, in which the user enters a word into a text box, and that word is the run through a while loop, and the letters of the word are reversed, so "java" would become "avaj". The program works, but the conversion pops up in a dialog box. I would like for the user to be able to copy the text that pops up in the dialog box, in either of these ways:
1. Have a button, next to "Okay" that says "Copy", which will add the text in the dialog to the clipboard (or the string that conatins the text in the dialog).
2. have the converted text appear in a text box eitehr in the dialog or a new pane, so the user cna manually highlet, and ctrl + c the text.
I can't figure out how to do either of these... my best guess was to instead of doing a JOptionPane.showMessageDialog , doing a JOptionPane.showInputDialog, and having the input be preset to the generated text, i.e.:
textName2 = new JTextField(name of string);
String input=JOptionPane.showInputDialog(textName2, "Enter a String: ", "SuperString", 1);
but the text box still comes up blank!
Can anyone help me, or help me figure out a solution... :)
Message was edited by:
coryw68122
Message was edited by:
coryw68122