Hello, I've looked all over for the solution to this problem, but they all present a similar solution to this one and they all don't work. I've created the JFrame in the constructor for the class that this method is contained in.
public void print()
{
JPanel panel = new JPanel();
panel.setBackground(Color.GREEN);
ImageIcon icon = new ImageIcon("image.jpg");
if(icon !=null)
JOptionPane.showMessageDialog(null,"there is a value");
else
JOptionPane.showMessageDialog(null,"fail");
JLabel label = new JLabel();
label.setIcon(icon);
panel.add(label);
frame.getContentPane().add(panel);
frame.setVisible(true);
}
Any help would be appreciated