=== modified file 'src/com/goldencode/p2j/ui/client/gui/WindowTitleBar.java' --- src/com/goldencode/p2j/ui/client/gui/WindowTitleBar.java 2015-09-01 20:15:57 +0000 +++ src/com/goldencode/p2j/ui/client/gui/WindowTitleBar.java 2015-09-01 20:51:33 +0000 @@ -288,24 +288,6 @@ title.location().x - c.widthFromNative(nativeInsets.right); title.setWidth(twidth); - if (icon != null && icon.img != null) - { - Object[] drawingParameters = icon.calculateDrawingParameters(); - int iw = (Integer) drawingParameters[0]; - int ih = (Integer) drawingParameters[1]; - int offsetX = (Integer) drawingParameters[2]; - int offsetY = (Integer) drawingParameters[3]; - boolean transparent = (Boolean) drawingParameters[4]; - boolean stretchToFit = (Boolean) drawingParameters[5]; - boolean retainShape = (Boolean) drawingParameters[6]; - boolean convert3D = (Boolean) drawingParameters[7]; - /** - * Sets the window icon. The drawing parameters are due to the drawing operations are - * performed on the server side for the web rendering engine implementation. - */ - gd.setIcon(icon.img, 0, 0, iw, ih, offsetX, offsetY, transparent, - stretchToFit, retainShape, convert3D); - } } /** @@ -430,6 +412,12 @@ { /** Flag indicating the icon was loaded by LOAD-SMALL-ICON(). */ private boolean useSmallIconSize = false; + + /** + * The boolean value indicates that the icon is changed. The flag is used + * to track setIconData usages. + */ + private boolean isIconChanged; /** * Create the window icon. @@ -494,7 +482,7 @@ if (imgNew != null) { img = imgNew; - + isIconChanged = true; // repaint changed icon ThinClient.getInstance().eventDrawingBracket(this, false, true, new Runnable() { @@ -555,6 +543,37 @@ return false; } } + + /** + * Sets the window icon, if the icon is changed and then draws it on the graphic device. + */ + @Override + public void draw() + { + if (isIconChanged && img != null) + { + isIconChanged = false; + Object[] drawingParameters = calculateDrawingParameters(); + int iw = (Integer) drawingParameters[0]; + int ih = (Integer) drawingParameters[1]; + int offsetX = (Integer) drawingParameters[2]; + int offsetY = (Integer) drawingParameters[3]; + boolean transparent = (Boolean) drawingParameters[4]; + boolean stretchToFit = (Boolean) drawingParameters[5]; + boolean retainShape = (Boolean) drawingParameters[6]; + boolean convert3D = (Boolean) drawingParameters[7]; + /** + * Sets the window icon. The drawing parameters are due to the drawing operations are + * performed on the server side for the web rendering engine implementation. + */ + gd.setIcon(img, 0, 0, iw, ih, offsetX, offsetY, transparent, + stretchToFit, retainShape, convert3D); + } + + super.draw(); + } + + } /**