Java Swing Tutorial - Java ImageIcon.getIconHeight()








Syntax

ImageIcon.getIconHeight() has the following syntax.

public int getIconHeight()

Example

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

import javax.swing.ImageIcon;
/*from   w w w  .j  av a 2  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.getIconHeight());
  }
}