I am trying to do the simple activity of setting the Application Icon in a java application. I have many working examples with me but in this instance it fails. Please help I have tried a) b) c) marked in the code. a) Gives a error hint 'Non-static getClass cannot be referenced from a static context' So I tried b) and c). In both, the program runs, but NO Icon is set, NO errors. (I have put the same image in different paths for test purpose)
private static void createAndShowGUI() {
myFrame = new MyDynamic();
myFrame.setTitle( "Sunsong Public School : Home" );
a)myFrame.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("../Images/Sudan.png")));
b)myFrame.setIconImage(ImageIO.read(new File("../Images/Sudan.png")));
c)Image icoon = Toolkit.getDefaultToolkit().getImage("Sudan.png"