Generated Object

A javax.swing.ImageIcon, where the supplied image details are loaded into the icon.

Value Argument

The value argument can be a String, URL, java.awt.Image, or byte[]. There is no attribute equivilent to the byte[] value argument.

If the value argument is a String it can be treated in multiple ways. If the value resolved to a File resolved without any context, then the value argument is treated as though it was passed in as a file: attribute. If the file does not exist, it is treated as though it were passed in as a resource: attribute.

Attributes

the value argument, file :, url:, image:, and resource: are mutually exclusive.

//TODO we should accept strings to file: and url:, in the future.

Content

imageIcon() is a leaf node, no child content is allowed.

Examples

label(icon:imageIcon('http://docs.codehaus.org/download/userResources/GROOVY/logo')

button(icon:imageIcon(url:'http://www.google.com/favicon.ico'))

imageIcon('ConsoleIcon.png', class:groovy.ui.Console)

imageIcon(resource:'/groovy/ui/ConsoleIcon.png')