Blank Component Render with Multiple Monitor
I am developing an AWT application. It runs smoothly on single monitor. However, when used with a multiple monitor set up:
Often dialog boxes open blank: complete black spot the size of a dialog, even top window system icons do not appear. Once moved or after any action performed on that blank part - resize, move etc, content appears normally.
When application is "put" on secondary monitor. The dialogs open on primary monitor only with the issues described above.
Although the issue is not found to be consistent when used with Win 7, issues occur more frequently on Windows XP.
Is this a standard Java Bug开发者_如何学运维 like this and related ones?
Any workarounds?
I've also encountered quite some multi-monitors issues: most notably the Robot class is badly broken on some JVMs in multi-monitors setup. For example it's darn near impossible to get consistent screenshots when there are multiple monitors hooked up to an OS X system.
Any work arounds for the same?
Well if you ask for a workaround, there's an obvious one regarding what you described: if any move/resize action force the content to appear normally then you could programmatically trigger a fake mover or resize action which may be a workaround your problem.
Been there, done that: in one app we had to use a (broken) 3rd party graphing API that had broken displaying issues. In one case a graph wouldn't show up correctly unless we resized the window: it was a known bug but not fixed yet. Our solution consisted in forcing a one-pixel resize of the window. It's a crappy workaround, but it worked. To this day we haven't had a single user complaining (it's really very hard to spot a one-pixel resize).
I'd like to re-emphasis that this is a hack but, sometimes, workarounds are needed. I'm not saying that there's not a better solution in your cases. You asked for a workaround, so here's one...
精彩评论