A Java project I am working on is having a bizarre conflict between Java3d and Swing tooltips.
Our program is setup with a Java3D Canvas3D in the center surrounded by Swing JComponents (buttons, sliders, text boxes, and the like). The keyboard and mouse are used to move around the 3d world and the buttons allow other manipulations.
The problem is that whenever a tool tip from the Swing components extends outside our window (a JFrame), the movement in Java3D slows to a crawl and has major stuttering issues. Because of all the problems we have read about regarding heavyweight/lightweight mixing in swing, we assumed that was likely to be the issue.
Our original solution was to override each components getToolTipLocation() method to ensure the tool-tips stay inside our window. This seemed to mostly work, but it left the tooltips in odd locations. In addition, we occasionally get the stuttering/slow down issue as soon as the program launches and before any tooltips have been generated (every 20-30 launches).
Then yesterday I discovered an ever stranger way of fixing it. As long as the tool-tips are 151 pixels wide or greater, they don't cause the slowdown problem going outside the window. Any tooltip that is 150 pixels wide or less causes our slowdown/stuttering issue as soon as it leaves the window. By overriding createToolTip () in each type of component we use, we can call setPreferedSize() and ensure that all the tool tips are 151 pixels wide. The problems with this workaround, of course, is that all the tooltips have either lots of blank space or are truncated.
Does anyone have any idea what could be causing this odd behavior and what I could try to fix it?
以上就是Java3D stuttering issue with Swing tooltips的详细内容，更多请关注web前端其它相关文章！