Results 1 to 2 of 2
  1. #1
    danoc93 is offline Member
    Join Date
    Apr 2012
    Posts
    37
    Rep Power
    0

    Default Adding text to Jtexpane

    Ok, I got a code that adds a line to a jtextpane, but the problem is that a huge space appears...

    I got user string, and message string

    The line that should show on the jtextpane is 10:30:10 | daniel > hello everybody
    The line tha appears on the jtextpane is 10:30:10 | daniel > SPACEEEEEEEEEEEEEEEE hello everybody

    Spaceeee= a huge white space, but the forum doesn't show it :P

    None of the strings has that huge space... (tested using System.out.println), so basically it has to be a problem with this code I am using:

    tiempo=current time, got with util.calendar...

    I want the user and the mssage with two diff colors so I add two different lines with their respective color configuration:

    caja.insertString(caja.getLength(),tiempo+" | "+obtenerusuario(linea)+" > ", colorespecial );
    caja.insertString(caja.getLength(), arreglarformatonormal(linea)+"\n", colorprivados);



    What do you think it might be occuring...?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,237
    Rep Power
    19

    Default Re: Adding text to Jtexpane

    Difficult if not impossible to say without a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Adding words to a text file using java
    By Andie in forum New To Java
    Replies: 0
    Last Post: 04-21-2012, 08:14 PM
  2. adding text to a text area dynamically
    By tom2zip in forum AWT / Swing
    Replies: 3
    Last Post: 01-17-2012, 05:58 AM
  3. Replies: 2
    Last Post: 08-18-2011, 09:36 PM
  4. Use Scanner to parse text file, adding to HashMap
    By JordashTalon in forum New To Java
    Replies: 0
    Last Post: 03-04-2009, 11:08 PM
  5. Adding lines at start and end of the text file
    By phani532 in forum New To Java
    Replies: 5
    Last Post: 08-27-2008, 03:12 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
  •