Java ImageIcon .setDescription (String description)

Syntax

ImageIcon.setDescription(String description) has the following syntax.

public void setDescription(String description)

Example

In the following code shows how to use ImageIcon.setDescription(String description) method.


import javax.swing.ImageIcon;
// ww  w .j  a v a 2s .  com
public class Main {
  public static void main(String[] argv) throws Exception {

    ImageIcon icon = new ImageIcon("image.gif");
    icon.setDescription("Description of Image");
  }
}