Java Swing Tutorial - 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;

public class Main {
  public static void main(String[] argv) throws Exception {

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