I'm a student working on a side project. However, I've hit a wall.
For some reason the image I'm trying to output is not being displayed on my JFrame
. It displays blank.
Is it because of my file location? I have stored the .jpg
in the same place as my src
code.
JFrame frame = new JFrame();
ImageIcon icon = new ImageIcon("pixPortrait.jpg");
JLabel label = new JLabel(icon);
frame.add(label);
frame.setDefaultCloseOperation;
(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);