I\'m using a JScrollPane to hold a JTextArea for a large area of text. I add the TextArea directly to the JFrame, it works fine. But I add it to the scrollpane and add the scrol
Assuming textPane
is a JScrollPane
, you should never be adding components to it.
Instead use JScrollPane#setViewportView(Component)
JScrollPane
is made of a number components which work together to provide you the functionality required to make the component scrollable...
JScrollPane
has a JViewport
, which is used to contain the component you want to be scrolled. You need to "apply" the component to the view.
Take a closer look at How to use Scroll Panes for more details