This might be an odd question, so I beg you guys to bear with me on this.
I want to present information to a JFrame
. Particularly, a String
.
Here's the catch, it's a very very long String
. Like, miles. Think several dozen lines of information in total.
It's a little like a phone-book, with more names than you can possibly fit on a page, and you only have that one page to use.
So I'm thinking scrollbars.
I tried:
JTextArea area = new JTextArea(veryLongText.toString());
JScrollPane scrollPane = new JScrollPane(area);
But that didn't work, as I couldn't scroll down until I added more text. Which wasn't what I was going for.
To put it simply, I want a text box that I can scroll in if the window is too small to fit all the text inside it.
How would I go about doing this?