Results 1 to 5 of 5
  1. #1
    saba is offline Member
    Join Date
    Jan 2010
    Posts
    3
    Rep Power
    0

    Question how to make JScrollpane not to fetch data while scrollbar is adjusting?

    Hi,

    I need to make the jscrollpane get data only when the scrollbar stops scrolling.
    for instance if I hold the scrollbar's thumb and drag it to pass 1000 records, I want the view to wait until I release the thumb before taking any action( ex. adjust the view). in other words if the value of getValueIsAdjusting() of scrollbar is true, then the jscrollpsne should wait until it changes to false before doing anything. this is the same approach that Outlook takes when browsing through the list of emails in your mailbox.

    I don't know how to solve this issue. any help regarding this issue would be appreciated.

    thanks

    Saba

  2. #2
    zweibieren is offline Senior Member
    Join Date
    Aug 2009
    Location
    Pittsburgh, PA
    Posts
    284
    Rep Power
    6

    Default

    The solution has to be in the object that is getting scrolled. Please yell us something about that object. Is is a JList or JTable or something else? What data model is it using?

  3. #3
    saba is offline Member
    Join Date
    Jan 2010
    Posts
    3
    Rep Power
    0

    Default

    Zweibieren,

    I am using a JTable with a model that overwrites the getValue() method to cache data from a database as needed to implement the paging using the scrollbar.
    thanks
    Saba

  4. #4
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    You should have complete control over when the TableModel requests more records from the database. Try starting a Swing timer when the window starts scrolling. Every 30 millis (a value of around 30 frames/second is invisible to the eye), have the Timer check the state of the scroll pane. Have it return if the scroll pane is still moving. When the scrolling stops, have Timer tell itself to stop firing and then add more records if appropriate. This approach works well with mouse drags and things like that, as well.

  5. #5
    saba is offline Member
    Join Date
    Jan 2010
    Posts
    3
    Rep Power
    0

    Default

    Steve11235,
    I may not have explained my problem properly.
    I need to know what part of the Jscrollpane to overwrite to to make it fetch new data only after jscrollbar's thumb is released after a drag.
    I'm fairly new to these stuff.
    thanks,\
    Saba

Similar Threads

  1. How to fetch integer data from excel
    By nehakuls in forum JDBC
    Replies: 5
    Last Post: 11-24-2009, 01:52 PM
  2. How to fetch integer data from excel
    By nehakuls in forum NetBeans
    Replies: 2
    Last Post: 11-18-2009, 05:47 AM
  3. How to clear data in Jtable in JScrollPane
    By simmi in forum AWT / Swing
    Replies: 5
    Last Post: 08-17-2009, 11:26 AM
  4. Make money from home, Home Typing Data Entry Partnerships
    By arturmoniswork in forum Reviews / Advertising
    Replies: 0
    Last Post: 12-30-2008, 05:55 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
  •