Java ImageIcon.toString()

Syntax

ImageIcon.toString() has the following syntax.

public String toString()

Example

In the following code shows how to use ImageIcon.toString() method.


import javax.swing.ImageIcon;
/*from   www  .j  a  v  a2 s.  c o  m*/
public class Main {
  public static void main(String[] argv) throws Exception {

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