Home arrow static arrow Java Programming [Archive] - anothere Question about JScrollPane
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - anothere Question about JScrollPane
This topic has 1 reply on 1 page.

Posts:35
Registered: 7/16/04
anothere Question about JScrollPane  
Aug 9, 2004 8:49 AM



 
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 !
 

Posts:349
Registered: 1/8/04
Re: anothere Question about JScrollPane  
Aug 9, 2004 9:01 AM (reply 1 of 1)



 
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.
 
This topic has 1 reply on 1 page.