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


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

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 16:29 -0400
Organization A noiseless patient Spider
Message-ID <pe1uk3$o69$1@dont-email.me> (permalink)
References <2ddef1c1-ac37-4384-a3a5-f9b94a1fcbf6@googlegroups.com> <pe1n5c$toi$1@dont-email.me> <7da12ca3-a20e-4b84-a2f0-6e26657c4848@googlegroups.com>

Show all headers | View raw


On 5/22/2018 4:00 PM, Eric Douglas wrote:
> On Tuesday, May 22, 2018 at 2:22:50 PM UTC-4, Knute Johnson wrote:
>> On 5/22/2018 12:59, 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.
>>>
>>
>> Buffer the chunks?
>>
>> -- 
>>
>> Knute Johnson
> 
> Is there an efficient way to buffer?  Is reading bytes from a file into a buffer then pushing them into a JTextArea going to take twice the memory?  How big can a buffer be?
> 
> I tried creating the maximum buffer and got the error "java.lang.OutOfMemoryError: Requested array size exceeds VM limit".  I'm using java.nio.ByteBuffer.allocate() for a java.nio.channels.FileChannel.read().  I'm trying to see if it can read a 8284958067 byte text file into the JTextArea, or how much I can get it to display at one time.

... which will be a little less unless you have a truly enormous
display screen.  Eight gigabytes on a typical desktop of around
two megapixels comes to around two thousand characters per pixel
(assuming 2+ bytes per character), which will tax most people's
visual acuity somewhat ...

> I tried just doing a loop on the file read with smaller sizes to see if there's a memory limit to JTextArea and what would happen if I hit that on insert.  It seemed to hold quite a bit but I got annoyed that the frame was not responding if I called too many inserts unless I throw a Timer.sleep in between them, but it doesn't make sense to take an extra half second on every insert for no apparent reason.  I can make the control not editable while I'm inserting so there's no reason to lock up the EDT trying to display after each insert.

     I'm not 100% certain, but I don't think non-editability will
affect the repainting.  The EDT will still try to keep the display
up-to-date with the state of the displayed things, whether the
updates come from the user or from the program.

     But, but, but: Why in the ever-lovin' blue-eyed world are you
trying to draw four gigacharacters (perhaps more!) on a display?
That's a three-million-page book; who will read it?  What are you
trying to do?

-- 
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