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


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

Re: how do you block the GUI repaints?

From Martin Gregorie <martin@mydomain.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: how do you block the GUI repaints?
Date 2018-05-22 21:41 +0000
Organization albasani.net
Message-ID <pe22qt$4aj$1@news.albasani.net> (permalink)
References <2ddef1c1-ac37-4384-a3a5-f9b94a1fcbf6@googlegroups.com> <pe1n5c$toi$1@dont-email.me> <7da12ca3-a20e-4b84-a2f0-6e26657c4848@googlegroups.com> <pe1uk3$o69$1@dont-email.me> <9ca8b690-f847-4089-aeb2-8375b643ccf5@googlegroups.com>

Show all headers | View raw


On Tue, 22 May 2018 13:51:43 -0700, Eric Douglas wrote:

> Of course making it non editable doesn't automagically affect the
> repaint, I tried that.  I'm just saying I should be able to tell it not
> to repaint because the user can't do anything to change it between
> paints.  The display doesn't matter until it's done loading.  There's
> another control trying to show the loading progress, but it can't update
> a JProgressBar while it's doing a lot of inserts because the EDT is all
> tied up with this unnecessary painting.
>
Have you tried creating an empty JTextArea, i.e. one with no Document or 
content, then filling a Document, e.g. a PlainDocument, with all the 
material that will be displayed before attaching it to the JTextArea, i.e.

// Create JTextArea something like this:
 
JtextArea jta = new JTextArea(rows, cols); 

// when the View is being created, i.e. with NO Document and no content.
// Now create the Document, insert content into it and finally
// link it to the JTextArea...

   Plain Document doc = new PlainDocument();
   doc.insertString(0, contentString, new SimpleAttributeSet());
   jta.setDocument(doc);

It seems to me that thats as good a way as any of stopping the JTextArea 
from firing multiple display refreshes while the Document is being filled 
as any. 

Usual caveats: it looks possible from reading the class specs but I 
haven't tried it.


-- 
Martin    | martin at
Gregorie  | gregorie dot org

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