Results 1 to 3 of 3
  1. #1
    porchrat is offline Senior Member
    Join Date
    Mar 2009
    Posts
    105
    Rep Power
    0

    Default Creating a formatted TextArea (with underlines and stuff)

    I hope the title was informative enough.

    This forum has been so helpful in the past that I thought I had better come to you guys.

    What I'm trying to do is create some sort of TextArea to display a section of text with underlines, bold, number points etc. I'm trying to create some sort of simple EULA screen. I've got the structure of the screen sorted (buttons etc. all positioned) I just need to insert the text. In the past I just created a String that goes into the TextArea and it has "\n" everywhere to create paragraphs etc.

    I'm wondering if there isn't a better way to do this. Also using that method I don't know how to underline or bold. Also arranging the text is a bugger. :p

    I'm sure this must be something easily done. I've looked at the API and tried Google searches but I can't find information on how to do this sort of thing. Clearly I'm hopeless at Google so I was hoping someone here could point me in the right direction.

    Thanks.

  2. #2
    porchrat is offline Senior Member
    Join Date
    Mar 2009
    Posts
    105
    Rep Power
    0

    Default

    OK I've found a thing called a StyledDocument. I'm going to investigate that and see if maybe that isn't the answer. It looks like I can use HTML to markup different parts of a text file.

  3. #3
    porchrat is offline Senior Member
    Join Date
    Mar 2009
    Posts
    105
    Rep Power
    0

    Default

    What I've finally settled on is using an HTML document to markup the text and then instead of using a simple JTextArea I'm using a non-editable JEditorPane that grabs the HTML document. So far it is working great.

Similar Threads

  1. How to email formatted text from a JTextPane
    By akssingh400 in forum AWT / Swing
    Replies: 2
    Last Post: 02-23-2011, 07:59 PM
  2. Properly formatted code
    By Bgreen7887 in forum New To Java
    Replies: 1
    Last Post: 11-22-2010, 04:28 PM
  3. Replies: 0
    Last Post: 03-25-2010, 11:50 AM
  4. Sending a formatted string to a servlet
    By higashij in forum Java Servlet
    Replies: 0
    Last Post: 12-18-2009, 01:20 AM
  5. displaying a formatted output on a jTextField
    By techbossmb in forum AWT / Swing
    Replies: 1
    Last Post: 09-24-2009, 04:56 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
  •