I am debugging graphics updates in a Java application, under Windows 8.
Mac users have Quartz Debug that flash updated screen regions in real-time. This allows to determine repaint frequency and false updates - sometimes only a small area requires a repaint, but the full window is repainted. The application even shows areas that receive an update with unchanged content.
Is there a similar Windows debugging tool allowing me to detect repainted areas?
Meanwhile I found JXLayer, a SwingLabs subproject with BSD license. After including jxlayer-3.0.4.jar
into my project library, I was able to animate repaints. If you have a JFrame and a JPanel, use:
JFrame frame = ...;
JPanel panel = ...;
if (DEBUG_REPAINT) {
JXLayer<JPanel> layer = new JXLayer<>(panel);
DebugRepaintingUI dp = new DebugRepaintingUI(50); // 50ms delay
layer.setUI(dp);
frame.setContentPane(layer);
}
else {
frame.setContentPane(panel);
} }
By default the DebugRepaintingUI
draws the changed area in XORMode, but I can adapt the source to create a less obtrusive effect.
This approach has the problem that it actually modifies the application. Maybe someone has a better idea.