Results 1 to 8 of 8
  1. #1
    George R. is offline Member
    Join Date
    Jan 2010
    Posts
    13
    Rep Power
    0

    Default Bottom-Up JTextPane

    Hi! I'm trying to create a chatpanel, and so I use a jTextPane for this. I want the text to be appeared from bottom to top on the chatpanel, like Skype. Help please...!!!

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    786
    Rep Power
    5

    Default

    Every text component has a model (Document). The interface declare a method insertString(int offset, String str, AttributeSet a).
    So you could get the textpanes document with pane.getDocument() and call insertString with an offset of 0 :D
    Last edited by eRaaaa; 10-14-2010 at 12:50 AM.

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

    Default

    Quote Originally Posted by eRaaaa View Post
    ... call insertString with an offset of 0 :D
    I think you misunderstood the requirement. Possibly you don't use Skype, and the OP didn't post a very good description.

    What the OP wants is a text area where the text is bottom aligned, with all the extra empty space appearing above the text instead of the usual text at the top of the area and blank space below.

    db

  4. #4
    George R. is offline Member
    Join Date
    Jan 2010
    Posts
    13
    Rep Power
    0

    Default

    That's exactly what I'm trying to do! Any ideas?

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

    Default

    eRaaaa's idea should still be able to work, but you'd have to use a different offset, probably one that matches the current size of the Document.

    OP, what have you tried?

  6. #6
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,690
    Rep Power
    8

    Default

    Argh, I posted this exact question a couple months ago in the Sun forums, and eventually did find a great solution. Unfortunately, I can't find it now. Does anybody know how to search by thread starter in the old forums?

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

    Default

    Quote Originally Posted by KevinWorkman View Post
    Argh, I posted this exact question a couple months ago in the Sun forums, and eventually did find a great solution. Unfortunately, I can't find it now. Does anybody know how to search by thread starter in the old forums?
    Google-fu ;)
    Swing - Vertical Alignment of Text in JEditorPane

    Third hit on
    kevinaworkman jeditorpane site:forums.sun.com - Google Search

    db

    edit Add
    http://forums.sun.com/thread.jspa?threadID=5420279

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

Similar Threads

  1. SCJP Voucher @ Rock Bottom Price
    By nphariharan in forum Java Certification
    Replies: 0
    Last Post: 07-01-2010, 04:00 PM
  2. My JOptionPane Scrolls to Bottom!
    By AJArmstron@aol.com in forum New To Java
    Replies: 6
    Last Post: 04-17-2010, 12:58 AM
  3. Bottom-Up or Top-Down
    By 3xpr1ment in forum New To Java
    Replies: 5
    Last Post: 03-31-2010, 09:18 AM
  4. How to make an icon in bottom-right of screen
    By hunterbdb in forum AWT / Swing
    Replies: 1
    Last Post: 08-13-2009, 08:28 AM
  5. JButtons in a straight line on the BOTTOM
    By paul in forum AWT / Swing
    Replies: 0
    Last Post: 07-16-2007, 04:47 PM

Tags for this Thread

Posting Permissions

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