So, I do not know why my image is not showing because I put the image in the right folder and I believe that the code below is right. The result of this code is just a blank white frame background. I thought the image was corrupted but I tried a different image and its the same result. Anyway I will be highly grateful if anyone could solve this.
package fia_project;
import java.awt.Color;
java.awt.*;
import javax.swing.*;
public class Fia_test extends JFrame {
public Frame kenny;
public Fia_test(){
super("");
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
setVisible(true);
setSize(350, 100);
Container pane = getContentPane();
getContentPane().setBackground(Color.WHITE);
ImageIcon icon = new ImageIcon("speaker.png");
JLabel label2 = new JLabel(icon);
add(label2);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Fia_test t = new Fia_test();
}
}