public Vue(String title) {
    super(title);
    this.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    this.getContentPane().setLayout(new GridLayout(4, 1));
    JPanel p1 = createPanel1();
    this.getContentPane().add(p1);
    JPanel p2bis = createPanel2bis();
    this.getContentPane().add(p2bis);
    JPanel p3 = createPanel3();
    this.getContentPane().add(p3);
    this.setJMenuBar(createMenuBar());
    this.setPreferredSize(new Dimension(750,400));
    this.pack();
    this.setVisible(true);
    ImageIcon image = new ImageIcon(getClass().getResource("voile.png"));
    this.setIconImage(image.getImage());
    System.out.println(image.getDescription());
}
Hi,
I spent time to find the solution to display my image as a JFrame icon image... And tryed a lot of things like
ImageIcon image = new ImageIcon(Constants.LOGO_ABSOLUTE_PATH);
this.setIconImage(image.getImage());
System.out.println(image.getDescription());
I put "voile.png" file everywhere in my directories : root,src,bin and inside bin and src packages. I also tryed with an online logo and its URI.
However, it actually doesn't work. If anyone can help me ?
I'm running it on Eclipse Oxygen and Windows 10
PS : System.out.println(image.getDescription()); always showing a path where my image is located (Anyway I put it everywhere)