• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

swing display wrapped text

 
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm simply trying to put a neatly-wrapped, un-editable block of text on a Swing application but I'm not finding a simple solution.

I tried a label but I can't figure out how to make the text wrap. I tried a textbox but I get scrollbars and I get line-breaks within the words rather than a neat break.

Should I be using a label? How do I do a line-break?

Thanks!
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you have a lot of text, perhaps an uneditable JTextArea with word and wrap style set.
for just a snall text, perhaps a JLabel wrapped in <html> tags, and you place the <br> tags

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic