Hey, so im going through the basics of GUI. At first it was going great but right now Ive been trying to a) set the ImageIcon of the frame and also setting the ImageIcon of a label but with my current implementation none of the pictures load and I dont know why. I have included both the code and the file strucutre (ps. i have also set the Pictures package to be Resources Root Directory):
import javax.swing.*;
import java.awt.*;
public class Main {
JFrame frame;
public static void main (String[] args) {
JFrame frame = new JFrame("Wowzzzers");
frame.setSize(420,420);
frame.getContentPane().setBackground(Color.DARK_GRAY);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
ImageIcon img = new ImageIcon("/Pictures/yippee.jpg");
ImageIcon img2 = new ImageIcon("/Pictures/these-days-were-wild-v0-vfwnc6uu1e7e1.webp");
frame.setIconImage(img.getImage());
JLabel label = new JLabel();
label.setText("Wassssupp");
frame.add(label);
label.setForeground(Color.CYAN);
label.setIcon(img2);
label.setVisible(true);
//frame.pack();
}
}