-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.0
-
None
-
sparc
-
solaris_2.5
This problem has to do with the method java.awt.Component.repaint().
According to the spec:
"public void repaint()
Repaints this component.
This method causes a call to this component's update method as soon as possible.
"
But with the current implemention, the method repaint() doesn't call the update() method for some light weight component.
See the following code fragment:
=============================================================
public Status Component2004() {
Frame fr = new Frame();
FakeComponent fc = new FakeComponent();
try {
fr.setSize(200, 200);
fr.add(fc);
fr.setVisible(true);
synchronized (fr) {
while (!fr.isShowing()) {
try {
fr.wait(50);
} catch (InterruptedException ie) {
}
}
}
Graphics g = fc.getGraphics();
fc.repaint();
synchronized (fr) {
while (fc.updateCatch == false) {
try {
fr.wait(50);
} catch (InterruptedException ie) {
}
}
}
if (fc.updateCatch == false) {
return Status.failed("Failed: method did not call the update() method");
}
return Status.passed("OKAY");
} finally {
fr.dispose();
}
}
class FakeComponent extends Component {
public boolean paintCatch = false;
public boolean updateCatch = false;
public void paint(Graphics g) {
paintCatch = true;
super.paint(g);
}
public void update(Graphics g) {
updateCatch = true;
super.update(g);
}
}
===============================================================================
The result of running the above code is that it keeps waiting and stays in while loop.
But if I changed FakeCompoennt extends Canvas instead of Component, the abvoe code passed.
According to the spec:
"public void repaint()
Repaints this component.
This method causes a call to this component's update method as soon as possible.
"
But with the current implemention, the method repaint() doesn't call the update() method for some light weight component.
See the following code fragment:
=============================================================
public Status Component2004() {
Frame fr = new Frame();
FakeComponent fc = new FakeComponent();
try {
fr.setSize(200, 200);
fr.add(fc);
fr.setVisible(true);
synchronized (fr) {
while (!fr.isShowing()) {
try {
fr.wait(50);
} catch (InterruptedException ie) {
}
}
}
Graphics g = fc.getGraphics();
fc.repaint();
synchronized (fr) {
while (fc.updateCatch == false) {
try {
fr.wait(50);
} catch (InterruptedException ie) {
}
}
}
if (fc.updateCatch == false) {
return Status.failed("Failed: method did not call the update() method");
}
return Status.passed("OKAY");
} finally {
fr.dispose();
}
}
class FakeComponent extends Component {
public boolean paintCatch = false;
public boolean updateCatch = false;
public void paint(Graphics g) {
paintCatch = true;
super.paint(g);
}
public void update(Graphics g) {
updateCatch = true;
super.update(g);
}
}
===============================================================================
The result of running the above code is that it keeps waiting and stays in while loop.
But if I changed FakeCompoennt extends Canvas instead of Component, the abvoe code passed.
- duplicates
-
JDK-4627627 Image rendering causes some applets to fail with merlin-rc
- Resolved