Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Have problems with text windows

Status
Not open for further replies.

McBugzz

Programmer
Sep 17, 2002
90
0
0
JP
I need to display some text (lots of text) in a window. The text must be scrollable, and it should be modified on each window resize operation.

I can't use JTextPane or any other Swing/AWT component that perfomes automatic formatting.

So I have decided to use JLabel. I can drop HTMLed text into it, and that's great, but so far I haven't found a way to scroll the text.

Also, I need to cut looong words (that don't fit into a line) so I need to be notified when the window is resized. How do I do that?

Please help.
 
Use a JTextArea, wrapped in a JScrollPane ...
 
But JTextArea doesn't allow formatting - it displays everything in the same font! And I need to display formatted!!! text.
 
But you said ou did not want formatting :

I can't use JTextPane or any other Swing/AWT component that perfomes automatic formatting.

Have you tried JEditorPane - this will display HTML ...
 
I didn't say I didn't want formatting. I said that I can't use it. For example, if a word is too long to fit in a single line, it is MY job to split it.
 
If you can't use formatting objects, then why do you care if a object does not use formatting (ie JTextArea).

Your requirements are seeming a little confusing to me. Either you want the component to format your text, or you don't ...

Perhaps if you elaborated a little more on the problem, we would be able to find you a solution ...
 
Here's the problem:

I need to display some text, with some markup applied to it. Also I have to take care of loooong words (that don't fit into a line) and other issues. These issues are handled automatically by JTextPane and some other components which I can't (i.e. have no permission) use. It's just that the task has been put this way. I can't do anything about it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top