I'm working on a Java program that is intended to run in full-screen mode. It uses numerous of customized Swing components and Java2D-drawn components that need to be updated and repainted several times a second. And it was working relatively fine on my underpowered work PC.
But then I tried it out at home on my much more powerful PC. And it ran noticeably slower. Triggering an event that should have instantly updated about 20 different screen elements instead caused an effect where each element seemed to take at least a quarter second each to repaint itself. So instead of instantaneous changes it was taking 5 seconds to complete each screen change.
I thought that maybe I was trying to repaint too often or in the wrong manner. But after experimenting a bit with other ideas, on a hunch I let the application start up in a windowed mode instead of in full-screen mode. And with that one change, everything started to work perfectly fast and smooth.
So I suppose there are really two issues here: Why does full-screen mode cause this problem? And why is it only causing this problem on my faster computer? I do suspect there's an OS-related bug. My slow work computer is Windows XP while the home one is Windows 7. I saw in other threads that Aero on Win7 can cause Java speed issues so I tried disabling it. That did cause a small speed improvement but it still wasn't as smooth as when I ran in windowed mode. Has anyone else had performance issues running full-screen Java apps on Win7? And if so, is there a work around?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…