Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4495213

Updating data model while scrolling JTable freezes user interface

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      05
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description



        Name: nt126004 Date: 08/22/2001


        java version "1.3.0"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
        Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

        Background:

        I am using a JTable within a JScrollPane. I am providing a custom table model
        for the JTable which extends AbstractDataModel. The application has a
        simulation modelling thread that rapidly changes the values in the table model,
        and fires many table rows updated events. Each of the update events is for a
        single row (the first and last rows updated is always the same value). The
        table has 40,000 rows, and about 5,000 update events are generated per second.

        Symptom:

        When the JTable is not being scrolled the performance is as expected.

        When the JTable is being scrolled horizontally *sometimes* the viewport update
        routines seem to get confused and attempt to update (repaint) every row in the
        table, even rows that are not currently visible in the viewport. This results
        in the application 'freezing' temporarily while all 40,000 rows are painted.

        I am sure that it is the table disply routines that are causing a problem
        because I have added the following lines to BasicTableUI.java at around lines
        835:
                int rMin = table.rowAtPoint(minLocation);
                int rMax = table.rowAtPoint(maxLocation);
                // This should never happen.
                if (rMin == -1) {
        + System.err.println("rMin="+rMin+" rMax="+rMax);
        + System.err.println("minLocation x="+minLocation.x+"
        y="+minLocation.y);
        + System.err.println("maxLocation x="+maxLocation.x+"
        y="+maxLocation.y);
        rMin = 0;
                }

        The resulting value that is printed out is:
        rMin=-1 rMax=-1
        minLocation x=365 y=-23
        maxLocation x=366 y=-24

        As a consequence of rMin and rMax being == -1, all rows in the table are then
        painted, resulting in poor performance.

        This problem cannot be triggered while the simulation model is quiescent, or
        while the table is not being scrolled. It only seems to occur while many table
        row update events occur while the JTable is being scrolled.

        Source Code:

        The actual source code that triggers this event is complex, and the datasets are
        large. I am not able to submit source code and data at this time. However, I
        would be able to work on developing a sample app that can be used to exhibit
        this bug. Please contact me and I will respond right away.

        Impact:

        This bug cause the application to stall unexplainably. The user interface
        appears unresponsive and it appears as though the application has failed.
        (Review ID: 130274)
        ======================================================================

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                svioletsunw Scott Violet (Inactive)
                Reporter:
                nthompsosunw Nathanael Thompson (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: