-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0, 1.4.0
-
beta
-
x86
-
windows_2000, windows_xp
Name: rmT116609 Date: 01/29/2001
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
/*
* W2kFlicker.java
*
* Philip Koester
* ###@###.###
*/
import java.awt.*;
import java.awt.event.*;
/*
* Bug description:
*
* This is a simple program that displays System.currentTimeMillis() in
* a Frame, ca. 50 times a second. For the time to be updated on screen,
* the panel's repaint() method is called.
*
* This program (or any AWT program that makes use of automatic repaints)
* will cause excessive mouse and menu flicker on a W2K system. The
* problem does *not* exist in NT4.
*
* Start the program and watch the mouse cursor (wait a few seconds). The mouse
* will flicker. It doesn't matter where the mouse is or if this program's frame
* is activated. The mouse will always flicker when a portion of the time
* panel is visible on screen. (If the panel is obscured by another window,
* no flicker occurs.)
*
* To see the menu flicker, minimize all windows (except this program's frame)
* and right-click on the Windows desktop. W2K will show one of those new
* fancy fading-in menus. Again, excessive flicker.
*
* There is weird work-around: Go CTRL+ALT+Del once and press ESCAPE. The
* flicker is gone until the next time the program is run.
*/
public class W2kFlicker {
public static void main(String[] args) throws Exception {
// create and configure frame
Frame f = new Frame("W2K Flicker");
f.setBounds(new Rectangle(100, 100, 300, 300));
f.setLayout(new GridBagLayout());
// add the panel that displays currentTimeMillis
final Component timePanel = new TimePanel();
GridBagConstraints c = new GridBagConstraints();
c.fill = c.BOTH;
c.weightx = c.weighty = 1;
f.add(timePanel, c);
// make the frame closable
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
} );
// show the frame
f.setVisible(true);
// start a thread that repeatedly repaints the time panel
new Thread(new Runnable() {
public void run() {
while (true) {
timePanel.repaint();
try { Thread.sleep(20); }
catch(InterruptedException e) { }
}
}
} ).start();
}
static class TimePanel extends Panel {
TimePanel() {
// set a bigger font
setFont(new Font("SansSerif", Font.BOLD, 28));
}
public void paint(Graphics g) {
super.paint(g);
// draw currentTimeMillis
String time = "" + System.currentTimeMillis();
FontMetrics fm = getFontMetrics(getFont());
Dimension size = getSize();
int x = (size.width - fm.stringWidth(time)) / 2;
int y = (size.height - fm.getHeight()) / 2 +fm.getAscent();
g.drawString(time, x, y);
}
}
}
// EOF
(Review ID: 115929)
======================================================================
Name: jl125535 Date: 01/30/2002
The test case also causes problems on Windows XP with merlin-rc1. In addition, this situation can cause the Start menu to flicker.
It's a pretty serious flaw for any client-based program to have such a strong effect on normal operation of the system. Supplying the no.ddraw option fixes the issue, however. Perhaps the ddraw option should be turned off by default so this doesn't happen as much?
(Review ID: 138798)
======================================================================
Verified fix with jdk build 1.4.1-beta-b09, mixed mode on w2k.
###@###.### 2002-04-24
- duplicates
-
JDK-4527320 cursor flickers when running applets where repaint is called often
-
- Closed
-
- relates to
-
JDK-4711587 REGRESSION in 1.4.1-beta: Drag JInternalFrame in JDesktopPane.OUTLINE_DRAG_MODE
-
- Closed
-
-
JDK-4693644 REGRESSION,JCK1.4: api/java_awt/interactive/LWComponentTests.html fails
-
- Closed
-
-
JDK-4752334 Regression: Some J2DBench tests are 3-4 times slower on Win XP for 1.4.0_03b1
-
- Closed
-
-
JDK-4617023 IME language bar flickering synchronizing with caret's flickering
-
- Closed
-