Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JTable flicker after scroll

0 views
Skip to first unread message

Dux Gregis

unread,
Sep 16, 2001, 4:16:53 AM9/16/01
to
I have a JTable inside a JScrollPane that I call updateUI() on every .5
seconds (the table model gets updated in another thread, items are just
added, never removed). But if I scroll while the table is updating I very
often get a null pointer exception and every table in my application that
updates starts flickering heavily. I have tried

scrollPane.getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE);

which prevents it from flickering but is unbearably slow even on my 800MHz
CPU. Is there anything else I can do to stop the flickering without
disabling 2D acceleration? I've tried both java 1.3.0 and 1.3.1 and have
gotten the same thing.


Here's the first few lines of the stack trace:

java.lang.NullPointerException
at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:929)
at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:858)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:39)


Linda Radecke

unread,
Sep 16, 2001, 10:38:39 AM9/16/01
to

Dux Gregis wrote:

> I have a JTable inside a JScrollPane that I call updateUI() on every .5
> seconds (the table model gets updated in another thread, items are just
> added, never removed). But if I scroll while the table is updating I very
> often get a null pointer exception and every table in my application that
> updates starts flickering heavily. I have tried

> scrollPane.getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE);

> which prevents it from flickering but is unbearably slow even on my 800MHz
> CPU. Is there anything else I can do to stop the flickering without
> disabling 2D acceleration? I've tried both java 1.3.0 and 1.3.1 and have
> gotten the same thing.

It might be a better idea to use SIMPLE_SCROLL_MODE instead. Basically
it provides better performance (documentation). And with respect to the
BACKINGSTORE_SCROLL_MODE it is documented that
it "requires a large chunk of extra RAM".
Did you wrap your Scrolling code into SwingUtilities.invokeLater()?


Linda
--
To where the water and the earth caress and the down of a peach says
mmh, yes, do I look for those millionaires like a Machiavellian girl
would when I could wear a sunset? Kate Bush, The Sensual World

Christian Kaufhold

unread,
Sep 17, 2001, 8:32:37 AM9/17/01
to
Hello!

Dux Gregis <ass...@god.remus.rutgers.edu> wrote:

> I have a JTable inside a JScrollPane that I call updateUI() on every .5
> seconds (the table model gets updated in another thread, items are just
> added, never removed). But if I scroll while the table is updating I very

Neither modify the model nor call updateUI() from another Thread. I don't
know why you would want to call updateUI() at all.


Christian

0 new messages