Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Knute Johnson Newsgroups: comp.lang.java.programmer Subject: Re: What do you think of my CropImage class Date: Thu, 21 Jul 2016 07:58:44 -0700 Organization: A noiseless patient Spider Lines: 23 Message-ID: References: <87twfk93vu.fsf@Equus.decebal.nl> <87vazz71ct.fsf@Equus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 21 Jul 2016 14:58:45 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="fc10d1b501433caa198830294d826923"; logging-data="28259"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19EdzWE0naiMDH8Q5fbH3V5" User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 In-Reply-To: <87vazz71ct.fsf@Equus.decebal.nl> Cancel-Lock: sha1:hh2E8wbxO0dQUCUymS0E/9Kx0TU= Xref: csiph.com comp.lang.java.programmer:35045 On 7/21/2016 03:05, Cecil Westerhof wrote: > >> Runnable r = new Runnable() { >> public void run() { >> try { >> ImageIO.write(subImage,"JPEG",new >> File("crop.jpg")); >> } catch (IOException ioe) { >> ioe.printStackTrace(); >> } >> } >> }; >> new Thread(r).start(); > > Why are you doing this in a separate thread? > So if you have a large image that takes a second or two to write it won't block the Event Dispatch Thread and mess up the mouse movement. -- Knute Johnson