Hi, there,
Thank you for all of you responding to my last email about TextArea.
This is my small testing program.
import java.awt.*;
import java.awt.event.*;
public class TextDemo implements ActionListener {
TextField textField;
TextArea textArea;
Frame f;
public TextDemo() {
f = new Frame();
textField = new TextField(20);
textArea = new TextArea("Hello", 5, 20);
textArea.setEditable(false);
f.add("South", textField);
f.add("North", textArea);
f.pack();
f.show();
textField.addActionListener(this);
}
public void actionPerformed(ActionEvent evt) {
String text = textField.getText();
System.out.println(text);
textArea.append(text );
textField.selectAll();
}
public static void main(String[] args){
TextDemo textDemo = new TextDemo();
}
}
The problem is that: Hello is not on textArea and what I typed in
textField will not echo in textArea too. But it works fine on Solaris
machine. And also it works well if I use applet on LINUX machine. Like
this:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class Text extends Applet implements ActionListener {
TextField textField;
TextArea textArea;
Frame f;
public void init() {
f = new Frame();
textField = new TextField(20);
textArea = new TextArea("Hello", 5, 20);
textArea.setEditable(false);
f.add("South", textField);
f.add("North", textArea);
f.pack();
f.show();
textField.addActionListener(this);
}
public void actionPerformed(ActionEvent evt) {
String text = textField.getText();
System.out.println(text);
textArea.append(text );
textField.selectAll();
}
}
}
I am using jdk1.1.6v4a-i386-glibc.
Thanks again!
Jie Yu
------------------------------------------------------------------------
2366 Main Mall Tel: 604-221-9740(H)
Dept. of Computer Science 604-822-8572(O) ext. 3
UBC, Vancouver, V6T 1Z4 ICQ: 16352804
BC, CANADA http://www.cs.ubc.ca/spider/jyu