Results 1 to 3 of 3
  1. #1
    hungleon88 is offline Member
    Join Date
    Aug 2008
    Posts
    41
    Rep Power
    0

    Default Make a text in Jlabel down to next Line

    How to make a text in Jlabel down to next Line ??
    I have a String and don't know how long it will, and set that String to the JLabel, and the problem is, when the String is too long, the Text in JLabel will appear "....."
    How can we make the text auto drop down to next line???

    Sorry, my English is too bad :P

  2. #2
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    6

    Default

    There's probably a simpler way but if you know how long the JLabel text field is you can just compare the string length to that length and have a loop that once it reaches max length just starts printing on the next line.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    One way is to use a JTextArea, set its linewrap property to true via setLineWrap(true), set it's wrap style word property to true via setWrapStyleProperty(true), set it non-editable via setEditable(false), remove its border, make it not opaque via setOpaque(false).

Similar Threads

  1. Saving To A New Line Using A Text File
    By jadaleus in forum Advanced Java
    Replies: 10
    Last Post: 10-24-2008, 07:21 PM
  2. Saving To A New Line Using A Text File
    By jadaleus in forum Advanced Java
    Replies: 1
    Last Post: 10-24-2008, 12:31 AM
  3. saving to a new line a text
    By jadaleus in forum Advanced Java
    Replies: 1
    Last Post: 10-20-2008, 06:10 PM
  4. Styled Text with highlighted Odd Line
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-25-2008, 02:31 PM
  5. JLabel and text concept issues
    By Jononomous in forum New To Java
    Replies: 1
    Last Post: 03-30-2008, 05:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •