1848 |
* |
* |
1849 |
* @see #paint(Graphics) |
* @see #paint(Graphics) |
1850 |
* @see #repaint() |
* @see #repaint() |
1851 |
|
* |
1852 |
|
* @specnote In contrast to what the spec says, tests show that the exact |
1853 |
|
* behaviour is to clear the background on lightweight and |
1854 |
|
* top-level components only. Heavyweight components are not |
1855 |
|
* affected by this method and only call paint(). |
1856 |
*/ |
*/ |
1857 |
public void update(Graphics g) |
public void update(Graphics g) |
1858 |
{ |
{ |
1859 |
if (!isLightweight()) |
// Tests show that the clearing of the background is only done in |
1860 |
|
// two cases: |
1861 |
|
// - If the component is lightwight (yes this is in contrast to the spec). |
1862 |
|
// - If the component is a toplevel container. |
1863 |
|
if (isLightweight() || getParent() == null) |
1864 |
{ |
{ |
1865 |
Rectangle clip = g.getClipBounds(); |
Rectangle clip = g.getClipBounds(); |
1866 |
if (clip == null) |
if (clip == null) |
1868 |
else |
else |
1869 |
g.clearRect(clip.x, clip.y, clip.width, clip.height); |
g.clearRect(clip.x, clip.y, clip.width, clip.height); |
1870 |
} |
} |
|
|
|
1871 |
paint(g); |
paint(g); |
1872 |
} |
} |
1873 |
|
|