anothere Question about JScrollPane
I have the code as following :
JTextArea ta = new JTextArea ("I am viaphoe,\nHere I am , 20,30) ;
JSCrollPane scr= new JScrollPane (); // I did not attatch this JScrollPane obj to the Obj ta
.....
How can I attatch the Obj scr to Obj ta in the following code dynamically ?
thx for your reading , and giving advice is best !
[368 byte] By [
viaphone] at [2007-9-30 14:58:33]

> JTextArea ta = new JTextArea ("I am viaphoe,\nHere I
> am , 20,30) ;
> JSCrollPane scr= new JScrollPane (); // I did not
> attatch
> How can I attatch the Obj scr to Obj ta in the
> following code dynamically ?
> thx for your reading , and giving advice is best !
Think of it like this:
You're adding a JTextArea to the JScrollPane. You're not going to "attatch the Obj scr to Obj ta". The text area goes in the scroll pane.
Now, you will see in the API that JScrollPane is a Container. Then you will note that Containers have add(Component) and removeAll() methods. Light will grow brighter. Joy will increase and spread.