Results 1 to 3 of 3
  1. #1
    ZacK.YoveL is offline Member
    Join Date
    Jun 2010
    Posts
    2
    Rep Power
    0

    Default Chat window autoscroll lockes scrollbar at buttom

    Hi, I'm writing an instant chat client (for practice), I use netbeans 6.8 on ubuntu 10.04.

    My chat window contains a JTextPane enclosed in a JScrollBar, to get auto adjustment of the vertical scrollbar I use the following code:

    Java Code:
    jScrollPane1.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener(){
    
                public void adjustmentValueChanged(AdjustmentEvent e) {
                    e.getAdjustable().setValue(e.getAdjustable().getMaximum());
                }
            });
    It works, but it forces the scrollpane to the buttom - can't go up again to see it.
    I did see many solutions for this problem, but they all seem to go around and adjust the visible area according to the textPane/textarea, creating ton of new problems on the way. Adjusting the visible area by the scrollbar of the scrollpane should be the right way to do it, but I can't find a way to stop it from forcing thw visible area down.

    Doe's anyone know a solution for that?

  2. #2
    camickr is online now Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

    Default

    Check out the code and discussion in Swing - JTextPane autoscroll down / stop scroll on choose

  3. #3
    ZacK.YoveL is offline Member
    Join Date
    Jun 2010
    Posts
    2
    Rep Power
    0

Similar Threads

  1. dragging the row header autoscroll
    By Allgorythm in forum New To Java
    Replies: 6
    Last Post: 02-15-2010, 05:10 AM
  2. witch buttom was clicked?
    By p0rnstar in forum New To Java
    Replies: 6
    Last Post: 01-28-2010, 04:59 PM
  3. change url in parent window from child window
    By rakesh_n_mehta in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-09-2009, 12:17 PM
  4. Scrollbar on graphics output window
    By ann123 in forum AWT / Swing
    Replies: 3
    Last Post: 06-27-2009, 08:47 PM
  5. Replies: 1
    Last Post: 08-08-2008, 03:20 AM

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
  •