I tried to load a picture in my JDialog
.
So, I tried with JLabel
like that:
ImageIcon icon = new ImageIcon("/sau/se/editor/images/HighBtomStPic.png");
System.out.println("Icon exists: "+(icon != null));
JLabel lblNewLabel = new JLabel();
lblNewLabel.setIcon(icon);
The print
gives me true
and I don't see the picture I have inserted, so what am I doing wrong?
Since I am dealing with source context not a file system one,
The answer should be: To replace:
ImageIcon icon = new ImageIcon("/sau/se/editor/images/HighBtomStPic.png");
With:
ImageIcon icon = new ImageIcon(GraphEditor.class.getResource("/sau/se/editor/images/HighBtomStPic.png"));