Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2950 > unrolled thread

Re: JTablle anomaly

Started by"Roedy Green" <roedy.green@THRWHITE.remove-dii-this>
First post2011-04-27 15:42 +0000
Last post2011-04-27 15:42 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.lang.java.gui

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: JTablle anomaly "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
    Re: JTablle anomaly "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
      Re: JTablle anomaly "Alexander.V.Kasatkin" <alexander.v.kasatkin@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000

#2950 — Re: JTablle anomaly

From"Roedy Green" <roedy.green@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
SubjectRe: JTablle anomaly
Message-ID<d3tgn31eo8jn617i3l130gp8h9oj74enl5@4ax.com>
  To: comp.lang.java.gui
On Mon, 31 Dec 2007 04:42:03 GMT, Roedy Green
<see_website@mindprod.com.invalid> wrote, quoted or indirectly quoted
someone who said :

>I have noticed that when my JTable is scrolling, it sometimes displays
>the heading line temporarily before replacing it with the proper data
>line.  Is this a bug in Swing, or am I doing something wrong?

I found a pragmatic solution. After I make my calls that will trigger
gui changes, I use  Thread.yield(); in my computational thread to give
the Swing thread a crack at processing the GUI events.
-- 
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#2952

From"Roedy Green" <roedy.green@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
Message-ID<5uohn3thskoi0fi79craipr8v3slikjsbf@4ax.com>
In reply to#2950
  To: comp.lang.java.gui
On Mon, 31 Dec 2007 04:48:48 GMT, Roedy Green
<see_website@mindprod.com.invalid> wrote, quoted or indirectly quoted
someone who said :

>I found a pragmatic solution. After I make my calls that will trigger
>gui changes, I use  Thread.yield(); in my computational thread to give
>the Swing thread a crack at processing the GUI events.
I still get sporadic anomalies.

-- 
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2958

From"Alexander.V.Kasatkin" <alexander.v.kasatkin@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
Message-ID<ec9f263a-d703-48b2-82e7-2afaeeda81a3@f3g2000hsg.googlegroups.com>
In reply to#2952
  To: comp.lang.java.gui
It's normal situation if a table model is updated by a non-Swing
thread.
IMHO, If you've extends an AbstractTableModel class, you can override
the fireTableChanged method:

<pre>
public class Model extends DefaultTableModel {
    private static final long serialVersionUID =
-5792073620222974655L;
    @Override
    public void fireTableChanged(final TableModelEvent e) {
        if (SwingUtilities.isEventDispatchThread()) {
            super.fireTableChanged(e);
        } else {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    fireTableChanged(e);
                }
            });
        }
    }
}
</pre>

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web