I want to show String
b
up on TextField
. String
b
is a conversion of array of stringChar
.
void setTextField(char s) {
stringChar[index] = s;
index++;
String b = new String(string);
System.out.println(b);
TextField.setText(b);
}
If I execute the code, then the String is not displayed in the textfield.
You said: I want to show string b up on TextField. string b is a converion of array of stringChar.
But in the code you wrote: String b = new String(string);
Instead of that is should be: String b = new String(stringChar);
Also, you should repaint the textfield: TextField.repaint();
Blockquote JTextArea.setText(string); JTextArea.append(string);
java doc:
http://docs.oracle.com/javase/6/docs/api/javax/swing/JTextArea.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.