-
Bug
-
Resolution: Fixed
-
P2
-
1.1.4
-
1.1.5
-
x86
-
windows_nt
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2016592 | 1.2.0 | Creighton Chong | P2 | Resolved | Fixed | 1.2beta3 |
Name: sg39081 Date: 08/20/97
In JDK 1.1.4G -
When several repaints() are issued together, occasionally one is
dropped. It's infrequent enough to not be obvious, but some of our
components can reproduce this bug extremely easily.
I've been unable to reproduce the problem on Solaris 1.1.2, but
have repro'd it on Windows on JDK 1.1.4G and 1.1.3 final.
The following source code will reproduce the problem. Run the
application, and hold down the "tab" key. The window will gradually
repaint from top to bottom. Periodically, individual lines fail
to be repainted.
The frequency with which repaints are dropped varies from machine
to machine, and from run to run (and moment to moment).
This bug is likely causing many mysterious and hard-to-reproduce
refresh problems in our products - it may qualify as a showstopper.
import java.awt.*;
import java.awt.event.*;
public class RepaintBug extends Frame
{
static public void main(String[] args)
{
(new RepaintBug()).setVisible(true);
}
public RepaintBug()
{
add(new TestComponent());
pack();
}
}
class TestComponent extends Component
{
public TestComponent()
{
enableEvents(AWTEvent.KEY_EVENT_MASK);
}
public boolean isFocusTraversable()
{
return true;
}
public Dimension getPreferredSize()
{
return new Dimension(50, _LINE_COUNT);
}
public void paint(Graphics g)
{
Dimension d = getSize();
if (_lineNumber < 0) // Quick hack for first paint()
g.setColor(_colors[1 - _colorIndex]);
else
g.setColor(_colors[_colorIndex]);
g.fillRect(0, 0, d.width, d.height);
}
protected void processKeyEvent(KeyEvent e)
{
if (e.getID() == KeyEvent.KEY_TYPED)
{
// Repaint a bunch of lines
for (int i = 0; i < _LINES_REDRAWN_AT_A_TIME; i++)
repaint(0, _lineNumber++, getSize().width, 1);
if (_lineNumber >= _LINE_COUNT)
{
_lineNumber = 0; // Back to the first line
_colorIndex++; // and switch colors
if (_colorIndex == _colors.length)
_colorIndex = 0;
}
}
}
private int _colorIndex = 0;
private int _lineNumber = -1;
static private final Color[] _colors = {Color.red, Color.green};
static private int _LINE_COUNT = 600;
static private int _LINES_REDRAWN_AT_A_TIME = 25;
}
company - Oracle , email - ###@###.###
======================================================================
jeff.hsiao@Eng 1997-10-17
I can reproduce this bug on WinNT.
- backported by
-
JDK-2016592 1.1.4G - repaints on lightweight components are sometimes dropped
-
- Resolved
-