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

    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 Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    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.

    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, 09:14 PM
  2. adding text to a text area dynamically
    By tom2zip in forum AWT / Swing
    Replies: 3
    Last Post: 01-17-2012, 06:58 AM
  3. Replies: 2
    Last Post: 08-18-2011, 10:36 PM
  4. Use Scanner to parse text file, adding to HashMap
    By JordashTalon in forum New To Java
    Replies: 0
    Last Post: 03-05-2009, 12:08 AM
  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, 04: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