Return-Path: X-Original-To: apmail-pivot-user-archive@www.apache.org Delivered-To: apmail-pivot-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 14ABED3C0 for ; Thu, 7 Mar 2013 17:22:53 +0000 (UTC) Received: (qmail 64458 invoked by uid 500); 7 Mar 2013 17:22:52 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 64250 invoked by uid 500); 7 Mar 2013 17:22:52 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 64224 invoked by uid 99); 7 Mar 2013 17:22:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Mar 2013 17:22:51 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of gk_brown@verizon.net designates 206.46.173.3 as permitted sender) Received: from [206.46.173.3] (HELO vms173003pub.verizon.net) (206.46.173.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Mar 2013 17:22:44 +0000 Received: from [192.168.1.101] ([unknown] [208.54.36.208]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0MJA0044PW7YQB40@vms173003.mailsrvcs.net> for user@pivot.apache.org; Thu, 07 Mar 2013 11:22:09 -0600 (CST) Content-type: text/plain; charset=us-ascii MIME-version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: why does this paint twice? From: Greg Brown In-reply-to: <2F5A71AA2EE83044AB46CB16CC1549F8017C1E36@FMSMSX108.amr.corp.intel.com> Date: Thu, 07 Mar 2013 12:22:26 -0500 Content-transfer-encoding: quoted-printable Message-id: References: <2F5A71AA2EE83044AB46CB16CC1549F8017C1E36@FMSMSX108.amr.corp.intel.com> To: user@pivot.apache.org X-Mailer: Apple Mail (2.1499) X-Virus-Checked: Checked by ClamAV on apache.org paint() is called any time any region of the screen needs to be updated. = This update could be triggered by the application or it could be = triggered by the OS (for example, if an overlapping window is moved).=20 The graphics context passed to paint() will be clipped to the bounds of = the update region, but you should generally optimize your component's = drawing code so it only draws that part that needs to be repainted. On Mar 7, 2013, at 12:08 PM, "Schwartz, Cynthia L" = wrote: > I am writing a custom control and want to understand why this is = painting twice. Complete code below. > =20 > Thanks, > Cynthia > =20 > public class PaintTest extends Application.Adapter { > private Window window =3D null; > private Waveform waveform =3D null; > =20 > @Override > public void startup(Display display, Map = properties) { > window =3D new Window(); > waveform =3D new Waveform(); > window.setContent(waveform); > window.setMaximized(true); > window.open(display); > } > =20 > @Override > public boolean shutdown(boolean optional) { > if (window !=3D null) { > window.close(); > } > =20 > return false; > } > =20 > public static void main(String[] args) { > DesktopApplicationContext.main(PaintTest.class, args); > } > =20 > } > =20 > package painttest; > =20 > import java.awt.Graphics2D; > import org.apache.pivot.wtk.Panel; > =20 > public class Waveform extends Panel > { > @Override > public void paint(Graphics2D graphics) > { > System.out.println("Painting"); > } > } > =20 > =20