Check out example codes for "scrollbar in textarea java". It will help you in understanding the concepts better.

Code Example 1

textArea = new JTextArea();
scroll = new JScrollPane(textArea);
//this.add(textArea); // get rid of this
this.add(scroll);

Learn ReactJs, React Native from akashmittal.com