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


Groups > comp.lang.java.programmer > #38264

Re: how do you block the GUI repaints?

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: how do you block the GUI repaints?
Date 2018-05-22 14:43 -0400
Organization A noiseless patient Spider
Message-ID <pe1obt$8p6$1@dont-email.me> (permalink)
References <2ddef1c1-ac37-4384-a3a5-f9b94a1fcbf6@googlegroups.com>

Show all headers | View raw


On 5/22/2018 1:59 PM, Eric Douglas wrote:
> I made a custom JTable, but it has a separate model.  I wanted to be able to update a lot of cell values and just have it repaint the whole table when I'm done, so I just made a custom model, overrode the fire method to not tell it to repaint while I'm loading it, and call one fireTableChanged when I'm done.
> 
> Now what's the easiest way to do this with other controls?  I made a custom JTextArea, I try to insert a lot of text one chunk at a time, and it locks up the EDT issuing repaint requests.

     You're on the right track: Do it in the model.  For example,
the TableModel you implemented replaces

	update cell
	fire event
	update cell
	fire event
	update cell
	fire event
	...

with

	update cell
	update cell
	update cell
	...
	fire mega-event

and you could, perhaps, go on to

	bulk-update many cells
	fire mega-event

     Do similarly with the other controls that bother you.

     Also (and depending on the nature of your updates), you may
gain by firing "specific" events instead of "catch-all" events.
For example, a JTable might be more responsive if its model fired
events reporting updates to three individual cells than if it
fired "the whole table changed" events.  (This goes somewhat
against the "fire mega-event" suggestion above, but that just
means that engineering is the art of striking balances.)

-- 
esosman@comcast-dot-net.invalid
Nine hundred seventy-four days to go.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 10:59 -0700
  Re: how do you block the GUI repaints? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2018-05-22 13:22 -0500
    Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 13:00 -0700
      Re: how do you block the GUI repaints? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-22 16:29 -0400
        Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 13:51 -0700
          Re: how do you block the GUI repaints? Martin Gregorie <martin@mydomain.invalid> - 2018-05-22 21:41 +0000
          Re: how do you block the GUI repaints? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-22 18:03 -0400
            Re: how do you block the GUI repaints? Andreas Leitgeb <avl@logic.at> - 2018-05-22 22:22 +0000
              Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 07:55 -0700
                Re: how do you block the GUI repaints? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-23 11:06 -0400
                Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 08:19 -0700
  Re: how do you block the GUI repaints? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-22 14:43 -0400
    Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 13:20 -0700
      Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-22 22:47 +0200
        Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 13:58 -0700
          Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 04:30 +0200
            Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 05:54 -0700
              Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 15:58 +0200
                Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 07:26 -0700
                Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 16:30 +0200
                Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 07:48 -0700
                Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 18:46 +0200
                Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 10:51 -0700
                Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 22:35 +0200

csiph-web