Author: tchemit Date: 2011-09-20 13:27:33 +0200 (Tue, 20 Sep 2011) New Revision: 2303 Url: http://nuiton.org/repositories/revision/jaxx/2303 Log: Evolution #1744: treat imageIcon as icon and actionIcon Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java Modified: trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java =================================================================== --- trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java 2011-09-17 12:48:19 UTC (rev 2302) +++ trunk/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java 2011-09-20 11:27:33 UTC (rev 2303) @@ -73,6 +73,8 @@ public static final String ICON_ATTRIBUTE = "icon"; + public static final String ICON_IMAGE_ATTRIBUTE = "iconImage"; + public static final String NAME_ATTRIBUTE = "name"; public static final String WIDTH_ATTRIBUTE = "width"; @@ -327,6 +329,19 @@ stringValue = "{" + type + ".createImageIcon(\"" + stringValue + "\")}"; } } + } else if (ICON_IMAGE_ATTRIBUTE.equals(propertyName)) { + if (!(stringValue.startsWith("{") || stringValue.endsWith("}"))) { + // this is a customized icon, add the icon creation code +// compiler.setNeedSwingUtil(true); + String type = + compiler.getImportedType(SwingUtil.class); + + if (compiler.getConfiguration().isUseUIManagerForIcon()) { + stringValue = "{" + type + ".getUIManagerIcon(\"" + stringValue + "\").getImage()}"; + } else { + stringValue = "{" + type + ".createImageIcon(\"" + stringValue + "\").getImage()}"; + } + } } else if (ACTION_ICON_ATTRIBUTE.equals(propertyName)) { // customized actionIcon property if (stringValue.startsWith("{") && stringValue.endsWith("}")) {