How do I display an image in an APPLICATION
I have the following code and I want to display an image. I figured that the easiest way to display an image was via a JLabel.
import javax.swing.*;
import java.awt.*;
publicclass NewMain{
publicstaticvoid main(String[] args){
JFrame win =new JFrame("TestApp");
win.setDefaultCloseOperation(win.EXIT_ON_CLOSE);
win.setBounds(0,0,200,200);
ImageIcon icon =new ImageIcon("ca.bmp");
JLabel label =new JLabel("",icon,JLabel.CENTER);
win.add(label);
win.setVisible(true);
}
}
What am I doing wrong. I have the cd.bmp file in the source directory but I just get an empty frame when I run the program...
PS: I get a lot of hate messages in other forums. I am BRAND new to programming anything (especially OOP). I realize I suck at this but that is why I am trying to learn.

