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


Groups > comp.lang.java.gui > #2856

Re: Does swing repaint "h

From "A. Bolmarcich" <a..bolmarcich@THRWHITE.remove-dii-this>
Subject Re: Does swing repaint "h
Message-ID <slrnflivj4.tt7.aggedor@earl-grey.cloud9.net> (permalink)
Newsgroups comp.lang.java.gui
References <dcb0a51d-0d17-43f3-a83a-4453cec5fea0@b40g2000prf.googlegroups.com
Date 2011-04-27 15:41 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
On 2007-12-07, daf <davfrancois@gmail.com> wrote:
> Hi,
>
> I have a very simple / stupid question,
> Does swing repaint component not visible on screen ?
>
> By not visible I means that component is set to visible but not paint
> on screen
> (for example, in a scrollPane, if some component are not visible are
> they repaint...)

According to

http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Container.html#paint(java.awt.Graphics)

"If a child component is entirely clipped by the current clipping
setting in g, paint() will not be forwarded to that child."

When painting directly to the screen, the paint method of a component
is not invoked if no part of the component is on the screen.  As Steve
W. Jackson mentioned in another follow-up, off-screen rendering, such as
used by double buffering, complicates the answer, and the paint method
of a component may be invoked to pain to an off-screen buffer even though
no part of the component is on the screen.

According to

http://java.sun.com/products/jfc/tsc/articles/painting/#swing_summary

"Components which render complex output should make smart use of the
clip rectangle to narrow the drawing operations to those which
intersect with the clip area."

Where "smart use" means the paintComponent(Graphics g) code invokes
only draw methods on the Graphics parameter that will draw inside the
clip area of the Graphics.  Draw methods that would only draw outside
the clip area are not invoked, reducing the amount of drawing.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | Next | Find similar | Unroll thread


Thread

Re: Does swing repaint "h "A. Bolmarcich" <a..bolmarcich@THRWHITE.remove-dii-this> - 2011-04-27 15:41 +0000

csiph-web