Part of the application I am building demands that I display a variable amount of text in a non-editable component of some sort. Currently this has been implemented in JTextArea, but JTextArea has only the setRows() to set the vertical size of the component.
What I want is a component that will expand to the size needed. This does not pose a problem since the panel on which this thing is embedded is scrollable. It doesn't have to all show up at any particular time but it has to be visible. (And I don't want scrollbars within scrollbars, which I consider an abomination.
What Swing component is best for these requirements?
(Note: I am only asking this here because the entire #$%^&* Oracle Java documentation site including all the Swing demos and tutorials appears to be down now).
tags in will the JLabel be smart enough to break up the lines on its own and add rows as necessary (as an html page would)? The text I am displaying is just a random String of characters that were entered somewhere else. And will it be smart enough to break up on word boundaries? If so, then this is just what I need. – Steve Cohen Mar 23 '12 at 20:44
` Use styles rather than hard line breaks. That way the text can wrap to next line as needed, without any complications. See [an example](http://stackoverflow.com/a/7861833/418556). – Andrew Thompson Mar 23 '12 at 20:53
. It is a very simple code; I just start its basis... watch my answer edited – user592704 Mar 24 '12 at 01:25