In this section, you will learn how to create a scroll pane container in Java Swing. When you simply create a Text Area and putting text in the that then the size of the text area is increased according to the length of the text. But you can fix the size of the text area through adding the JScrollPane component of Java Swing. Following is the screen shot for the result of the given program:

This program shows a scroll pane for the given text area. The following methods and APIs used in the program for creating the JScrollPane container.
JScrollPane(Component view):
This is the constructor of JScrollPane
Class. It extends from the JComponent.
This constructor uses to create a JScrollPane . This JScrollPane displays the
horizontal and vertical scroll bar. It takes the components for which the scroll pane
has to be set.
Here is the code of program:
import javax.swing.*;
|
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Create a Scroll Pane Container in Java View All Comments
Post your Comment