Java Swing Tutorial - Java Toolkit.getImage(String filename)








Syntax

Toolkit.getImage(String filename) has the following syntax.

public abstract Image getImage(String filename)

Example

In the following code shows how to use Toolkit.getImage(String filename) method.

/*from   w ww. j a va  2  s .  c o  m*/
import java.awt.Image;
import java.awt.Toolkit;

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

    Image im = Toolkit.getDefaultToolkit().getImage("C:/Java/image.PNG");

  }
}