Results 1 to 3 of 3
  1. #1
    chayan is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

    Question Automatic scrolling of JScrollPane

    here is the problem..
    I creat a JList and add it to a JScrollPane.I set its vertical scroll bar policy to Always Visible. Then I add it to the CENTER of content pane of a JFrame.

    Now i want to add new members to the list dynamically. the problem is when the list grows beyond the vertical size of the JFrame, the scroll pane does not automatically scroll down to display the newly added items. I have to manually scroll down to see the new members.

    My question is what should I do to make the scroll bar automatically scroll down, so that I can see the most recent additions to the list.

    Thanks in advance..:)

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,234
    Rep Power
    7

    Default

    After you add the item you invoke:
    Java Code:
    list.ensureIndexIsVisible(...);

  3. #3
    chayan is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

Similar Threads

  1. Automatic sign in?
    By dunafrothint in forum Networking
    Replies: 1
    Last Post: 03-26-2010, 03:00 PM
  2. automatic email
    By pracheebapate in forum New To Java
    Replies: 2
    Last Post: 01-18-2009, 08:07 PM
  3. automatic email
    By aswin in forum New To Java
    Replies: 0
    Last Post: 11-13-2008, 08:03 AM
  4. Getting JScrollPane to stop auto-scrolling
    By Shadow in forum AWT / Swing
    Replies: 8
    Last Post: 10-21-2008, 08:52 PM
  5. JScrollPane not scrolling
    By Riftwalker in forum Advanced Java
    Replies: 2
    Last Post: 07-17-2007, 08:16 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
  •