Java Folder Location for Image NetBeans 6.8
greetings, today i have started to learn java using netbeans ide.
i would like my jframe to display an icon as stated in the following:
setIconImage(Toolkit.getDefaultToolkit().getImage("SartreIcon.jpg"));
the questin is under netbeans ide.. exactly in which folder do i place the graphic in question in order to load it?
thanks.
EDIT: solved.
URL url= getClass().getResource("Resources/SartreIcon.jpg");
ImageIcon imageIcon = new ImageIcon(url);
Image image = imageIcon.getImage();
this.setIconImage(image);
thank you.
URL url= getClass().getResource("Resources/SartreIcon.jpg");
ImageIcon imageIcon = new ImageIcon(url);
Image image = imageIcon.getImage();
this.setIconImage(image);
精彩评论