Replace icon in a Jframe [closed]

0

How do I remove the icon (the coffee cup) in a Java Jframe.

    
asked by Ran Lenin Lopez 21.03.2018 в 18:32
source

1 answer

2

You must create a ImageIcon :

ImageIcon img = new ImageIcon(pathDelIcon);

Then you set it on your JFrame with setIconImage() :

objetoJFrame.setIconImage(img.getImage());

If your image is a resource:

objetoJFrame.setIconImage(
 Toolkit.getDefaultToolkit().getImage(
   getClass().getResource(pathDelIconResource)
 )
);
    
answered by 21.03.2018 в 18:42