There is a pretty strange error with setting look and feel. For setting look-and-feel I use the following:
... String scheme = "net.sourceforge.atunes.gui.substance.SubstanceATunesSunLookAndFeel";
try {
UIManager.setLookAndFeel(scheme);
UIManager.put(LafWidget.ANIMATION_KIND, LafConstants.AnimationKind.NONE);
UIManager.put(SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND, SubstanceConstants.TabContentPaneBorderKind.SINGLE_FULL);
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
} catch (ClassNotFoundException e) {
ExceptionHandler.handleSilently(e);
} catch (InstantiationException e) {
ExceptionHandler.handleSilently(e);
} catch (IllegalAccessException e) {
ExceptionHandler.handleSilently(e);
} catch (UnsupportedLookAndFeelException e) {
ExceptionHandler.handleSilently(e);
}
which is placed in main function in:
SwingUtilities.invokeAndWait(new Runnable(){
public void run(){
...
}
There is no gui elements right before setting look-and-feel, therefore there is no need to execute SwingUtilities.updateComponentTreeUI(...). So, everything is ok, but some users reported very strange bag which is comprises unhandled windows like: When starting program User sees the following screen (the buttons appear only when he moves with the mouse over this area; before doing that the window does not show these buttons.
So, could anybody help me to find the right solution (I don't ask a solution, I just ask the right way to fix it). Firstly, I thought that it happens because of Out of memory error, but the configuration of user's computer is:
Machine configuration: HP d530 CMT(DF373A) Windows 7 Ultimate, 32Bit,SP1 2GB Ram NVIDIA GeForce FX 5700 (1680x1050, 32Bit Col depth) Java 1.6.0_26
So, I guess Out Of Memory is not the case. Any suggestions, pls.
UPD: so, every GUI creating statements were moved to one SwingUtilities.invokeLater() statement in main function! But, the problem is still reproduced by some users. Also, it's now known, that only view is so weird, but every buttons on it behave as expected! (I mean after pressing Ok button, next MVC is showed and looks well). This bug happens only with very first window which is created right after setting look-and-feel. So, I guess it's not the case of incorrect EDT usig, because of well buttons Listener's execution. Besides, our log (log4j) looks great as nothing weird happens!
Could anyone suggest possible cause?
SOLUTION see http://java.sun.com/products/java-media/2D/perf_graphics.html As commandline parameter where was added:
-Dsun.java2d.noddraw=true