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


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

Re: Does swing repaint "h

Started by"A. Bolmarcich" <a..bolmarcich@THRWHITE.remove-dii-this>
First post2011-04-27 15:41 +0000
Last post2011-04-27 15:41 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.gui

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#2856 — Re: Does swing repaint "h

From"A. Bolmarcich" <a..bolmarcich@THRWHITE.remove-dii-this>
Date2011-04-27 15:41 +0000
SubjectRe: Does swing repaint "h
Message-ID<slrnflivj4.tt7.aggedor@earl-grey.cloud9.net>
  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

[toc] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web