FireTableRowsInserted looses mouse focus on scroll button

Hello,
I created a simple caching TableModel which reads data from database table. Data is cached internally in a vector which holds initially 100 rows. When scrolling down and reaching the 100th row I fetch the next 100 rows from the database table and add them to the vector.
So far, so good. But after reading from the database table I need to call fireTableRowsInserted which causes the scrolling (pressing the scroll-down-button all the time) to stop. So I need to press again on the scroll-down-button to restart scrolling down.
Is there a remedy to make scrolling more "fluid"?
This does not happen when scrolling down with cursor keys (scrolling one row a time) or clicking in the scrollbar track area, and it would be nice if it would behave the same when clicking on the scroll-down-button.
Thank you very much for any good advice.
Stephan

Hi Stephan,
I suggest you try the following code sample, which seems to work although some better code could perhaps be found:
public class Frame extends JFrame {
    private JTable table;
    private JScrollPane scrollPane;
    private boolean scrolling = false;
    private Object scrollingLock = new Object();
    ... // other attributes
    public Frame() {
        ... // init the frame
        table = new JTable();
        ... // init the table
        scrollPane = new JScrollPane();
        scrollPane.setViewportView(table);
        ... // init the scroll pane
        scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
            public void adjustmentValueChanged(final AdjustmentEvent e) {
                synchronized(scrollingLock) {
                    if (!scrollingLock) {
                        scrollingLock = true;
                        scrollPane.setViewportView(null);
                        // fetch the next rows and add them to the table
                        scrollPane.setViewportView(table);
                        scrollingLock = false;
    ... // other methods
}I hope this will help you!
Pierre-Vincent

Similar Messages

  • My mouse's horizontal scroll buttons now skip over a tab

    I used to use the horizontal scrolling on my mouse wheel to scroll through the tabs in Firefox 3.6, but ever since the update to 3.6.8, instead of one horizontal click scrolling to the next tab over, it skips that tab and scrolls to the tab after it. It's not a huge deal, but it definitely interrupts workflow habits.

    I just checked and I already have version 24, and I still have the same problem. I'm going to try uninstalling and reinstalling Firefox to see if that works.

  • My mouse will only scroll one way

    My mouse will only scroll down and not up, it has done this before and self cured after a few days. any suggestions?

    I assume you are referring to a mouse with the scroll button/wheel in the middle?
    I have seen this a few times with more than one such mouse. I have "cured" it by putting some pressure (e.g. considerably more than normal) downward on that scroll wheel and moving it in the direction that it is no longer moving in (e.g. scrolls only down but not up, or vice versa). By applying a fair amount of pressure (don't break it but it's much more pressure than normal for a short time), it seems to suddenly "catch" and then works fine.

  • The scroll button on my mouse suddenly stoped working after the recent upgrade in firefox

    about 6 weeks ago, the scroll button on my mouse quit working when using firefox. It works fine with explorer

    about 6 weeks ago, the scroll button on my mouse quit working when using firefox. It works fine with explorer

  • The button on the mouse doesn't scroll down or sidewides...

    This is a minor bother but it bugs me every single day. The little nub-button (Button 3 according to System Preferences) on my cordless not-magic mouse will only scroll up; not down or side wides. I've mucked about with the mouse preferences setting but it's still not working. There has got to be an easy fix for this; I'm just missing it.
    The batteries are still at 66% so I don't think that's the problem. Any ideas?
    Thanks.
    Brian

    Usually when that happens, you need to clean it.
    Here's one demo video: http://km.support.apple.com/library/APPLE/APPLECARE_ALLGEOS/HT3226/HT326.mov
    You will find many other ways of cleaning an Apple Mighty Mouse (the only one with a scroll ball) - just search for variations of "mighty mouse scroll ball" in your favorite search engine.

  • Resetting bluetooth may fix your mighty mouse scroll button

    I have had this problem with the scroll button on my mighty mouse for months and months, and the only advise I have managed to get from here when I complained was to clean it. But I tried that many times and I have had nothing but problems with it, so much so that I recently called Apple and they agreed straight away to send me a new one.
    What made me call them today was the clicking action and side buttons on my mighty mouse also failed completely, and I thought the thing was totally broke. Whilst I was on the phone I happened to mention that my wireless keyboard also keeps losing its connection, and the advisor told me to do this following...
    This advise was used on my MacBook 13.3inch model from last year.
    Turn off Mac, removed the power and battery and hold down the power button for 5 seconds. Then turn it back on, but while you turn it back on hold down the altcmnd+RP buttons together. You will hear it ching two times as it turns on, let go after the second ching.
    This apparently resets the bluetooth and it fixed my mouse, it now works perfectly.
    Anyway, I called apple back to say that this reset not only fixed my keyboard, but also my mouse. Everything now works perfectly. The problem was bluetooth all along and not that the button needed cleaning.
    But they said they would still send me out a new one, and so long as they received a mouse back in the post they wouldn't charge me. I accepted that offer and I'll see how it goes with the one I have. I feel that I may have damaged the scroll button trying to clean it and feel that I probably should get a new one anyway on account of that.

    Hello stu:
    What you apparently did (based on the feedback you got from from Apple) is reset the SMC (system management controller) and the PRAM. When one has odd problems that do not appear software related, those are sometimes suggested as troubleshooting steps.
    http://support.apple.com/kb/HT1411
    http://support.apple.com/kb/HT1379
    Resetting the SMC should not, however, be used until other avenues have been exhausted (based on Apple guidance)
    Barry
    Message was edited by: Barry Hemphill

  • How can I get Mighty Mouse scroll button to work?

    My Mighty Mouse has started to not respond to the scroll button. Sometimes it will scroll up but not down at all.

    If you don't mind losing warranty you mighty want to open your mouse. A good tutorial to do this can be found here: http://arstechnica.com/old/content/2005/08/dissect.ars
    I already did this twice and it worked like a charm. But be aware that you do this on your own risk.

  • Use of scroll button on mouse?

    Child just got a macbook air for school's laptop program. Get ready for an endless stream of stupid questions as I try to work with Apple software and hardware. First one: I want to get her a mouse. I see in the Apple store, Apple mice with only two buttons, and a Logitech (now that is a familar name) mouse with two buttons and a middle scroll wheel.
    I'd rather not give her a mouse with a scroll bar right in the middle, that is useless. It would only serve as a distraction, whether or not the drivers can get the mouse itself to work.
    Is there any use/function in OSX for a middle scroll wheel?
    FWIW, this is for OSX 10.9.1.

    No  questions are stupid.   People ask because they don't know the answer; I'm glad you have enough confidence in Apple's forums to ask here.
    The Apple Magic mouse performs all the functions that will be required.   As for any other supplier; Logitech is well regarded here.  
    Why a centrally situated scroll wheel could be a distraction, I don't know.   Whether the scrolling is performed by a wheel or a finger gesture is quite irrelevant.   It is a necessary function.
    As you know, you need to connect it via Bluetooth.

  • Mighty Mouse scroll button

    The scroll button on my Mighty Mouse has stopped functioning. I thought it was perhaps due to a low battery level but a battery change didn't help. I've noticed the battery charge (via iStat Pro) seems to bleed quite quickly on the mouse and I've upgraded my battery choice. I like the Apple mouse pretty well... the only wireless mouse I've owned... and I've grown quite dependent on the scrolling function. Is there a history of these buttons wearing prematurely? Is there a way to "repair" a non-functioning scroll button? I'd hate to lose the mouse by attempting to disassemble something that shouldn't be tampered with. BTW, it's only about 6 months old. Thanks for input!
    jjsea

    From what I've read, Apple will replace a mouse under warranty for this reason, but to avoid the hassle of driving 50 minutes to my nearest Apple store, I just clean my mouse once per week using the damp cloth treatment. So far so good. Once per week, I run a basic maintenance program and afterwards I have to shut down and restart, so while it's shut down, I clean the mouse, the keyboard, the screen, and the case. It only takes a couple of minutes, and I keep the computer looking like new.

  • Can the Intellipoint mouse center scroll button open a new tab?

    I have a Microsoft Wheel Mouse optical USB mouse with a scroll wheel which can be modified from within the System Preferences settings. The Wheel Button however has a limited number of options. Different from Windows, this mouse, in the Mac, does not have the option to set the wheel button to open a new tab. Perhaps I can't figure it out from the options available, but is there a way to force it to open a new tab, like in Windows?
    Thank you.
    Roxy

    My apologies for my late reply to your very helpful response.
    However, my question probably was not well made. What I meant was to click on a link with the wheel button and open the link in a new tab.
    What assigning command-t does is open a new tab. Not what I meant.
    Sorry about the confusion and I hope you do have a suggestion.
    Thank you very much.
    Roxy

  • My little scroll button on top of my older model A1197 mouse.

    My little scroll button on top of my older model A1197 mouse works only intermittantly and usually, if at all, only in one direction.  ??

    This is usually caused by debris building up between the rollerball and the rollers underneath.  Sometimes you can free this up by turning the mouse upside down and rubbing the rollerball vigorously on a sheet of paper.

  • Small scroll button on mouse...

    Wondering if I have to replace my mouse...or a way to clean or fix it?
    The small finger scroll button scrolls up...but does not scroll down. I went into preferences, and nothing is changed as options. Shouldn't be anyway, my wife wouldn't know how to change it, and I certainly didn't.
    On a 20" monitor...gets kinda to be a drag to have to move over to the right and scroll the manual down feature. Any ideas what might be happening? Or just time to replace it...?

    I had the same thing with my Mighty Mouse and was able to clean it with a baby wipe (for some reason, this got me the best result). It is typically just the normal dust and oil build up, but if you don't clean it when you see it happening, it can make it difficult (I did have one I neglected too long and I was never able to get the scrolling to work properly again). If you use the baby wipe to roll around the scroll button, being sure it rotates fully and that all sides are getting cleaned this usually works for me.
    There is also someone who uses a piece of tape, I may try this on my other mighty mouse and see if it helps... http://www.brendanfenn.com/cleanmouse.html

  • Using Mouse Scroll Button In Swing

    Hi all, here's my question:
    When using a JScrollPane, how is it possible to use the mouse scroll button found in the middle of the mouse to scroll up or down?

    Hi,
    if you are using JDK1.4 it should work. If not you would need a native implementation to catch the wheel.
    Regards
    Andre

  • My mouse scroll button only moves up (not down)

    My scroll button on my Apple mouse (brand new iMac) was working beautifully. All of a sudden, it will not scroll down -- only up.
    Can someone give me an idea as to what might be wrong? (I checked my mouse preferences and the setting is correct, "vertical and horizontal").
    Thanks in advance.

    OK
    I have the same problem with my wireless mouse which isn't dirty, because when using it with a CAD program which uses the scroll ball as zoom in/out it works fine.
    Maybe it stopped working with the latest upgrade?.

  • Mouse scroll button

    HI. I there a way to set the scroll button for a double- click when I press it ? I thought I had this set up on my previous system, but don't seem able to do so now.
    Thanks,
    Zach

    "I guess my only option is to set the scroll button to primary & have to click that twice ?"
    Apparently so yes. I tried double clicking my Mighty Mouse scroll and it does work and I didn't reset my preferences but one would think that would wear the scroll ball down considerably. You can't just double click the mouse itself? I switch between this and keyboard shortcuts to give my wrist a rest on occasion.
    Carolyn

Maybe you are looking for