Results 1 to 10 of 10
Like Tree1Likes
  • 1 Post By Tolls

Thread: Newline after Add data to TextArea From DataBase

  1. #1
    Ridha is offline Member
    Join Date
    Jan 2013
    Posts
    28
    Rep Power
    0

    Default Newline after Add data to TextArea From DataBase

    hello ,
    i want return to line after add data to textArea from Database, I received concatenated result.
    this is my code :
    Java Code:
    ResultSet role = con.Conn().executeQuery("select * from roles");
                while(role.next())
                {
                String nom_role= role.getString("NOM_ROLE");
               
               TextArea1.append(nom_role); //ajout des roles dans textArea
                TextArea1.repaint();
               TextArea1.setLineWrap(true);
               TextArea1.setCaretPosition(add.Tout_role.getDocument().getLength());
                }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: Newline after Add data to TextArea From DataBase

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

  3. #3
    Ridha is offline Member
    Join Date
    Jan 2013
    Posts
    28
    Rep Power
    0

    Default Re: Newline after Add data to TextArea From DataBase

    Mais je suis entrain d'utiliser Netbeans et non pas HTML

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Newline after Add data to TextArea From DataBase

    JTextArea understands HTML.
    Darryl is suggesting using some simple HTML tags (eg <BR>) for your new lines.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: Newline after Add data to TextArea From DataBase

    Quote Originally Posted by Tolls View Post
    JTextArea understands HTML.
    Darryl is suggesting using some simple HTML tags (eg <BR>) for your new lines.
    Um, no it doesn't, and no I'm not.

    The link was to the String escape sequences defined in the JLS.

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

  6. #6
    Ridha is offline Member
    Join Date
    Jan 2013
    Posts
    28
    Rep Power
    0

    Default Re: Newline after Add data to TextArea From DataBase

    i know with /n i can return to line.
    but i don't know how i can put it in the code of netbeans.
    Java Code:
    ResultSet role = con.Conn().executeQuery("select * from roles");
                while(role.next())
                {
                String nom_role= role.getString("NOM_ROLE");
                
               TextArea1.append(nom_role); //ajout des roles dans textArea
                TextArea1.repaint();
               TextArea1.setLineWrap(true);
               TextArea1.setCaretPosition(add.Tout_role.getDocument().getLength());
                }

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Newline after Add data to TextArea From DataBase

    Quote Originally Posted by DarrylBurke View Post
    Um, no it doesn't, and no I'm not.

    The link was to the String escape sequences defined in the JLS.

    db
    I thought it did.
    I could have sworn...oops.
    Serves me right for relying on my memory...
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  8. #8
    Ridha is offline Member
    Join Date
    Jan 2013
    Posts
    28
    Rep Power
    0

    Default Re: Newline after Add data to TextArea From DataBase


  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Newline after Add data to TextArea From DataBase

    You are currently appending a String to the TextArea.
    So append a "\n" as well.
    DarrylBurke likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #10
    Ridha is offline Member
    Join Date
    Jan 2013
    Posts
    28
    Rep Power
    0

    Default Re: Newline after Add data to TextArea From DataBase

    thanks a lot
    how can I mark this thread is resolved?

Similar Threads

  1. Replies: 0
    Last Post: 11-22-2011, 09:55 AM
  2. newline in a string
    By Billaguana in forum New To Java
    Replies: 13
    Last Post: 01-24-2011, 08:06 PM
  3. Not able to data into database
    By nash1990 in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-11-2010, 06:01 PM
  4. Replies: 1
    Last Post: 04-27-2009, 11:19 AM
  5. Replies: 1
    Last Post: 01-15-2008, 09:55 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
  •