Hi, I've followed the example in my lecture notes and it doesn't work! I want to add an image to a label and then add that label to my sub north panel. I want to do this with creating a new class...I'm not sure if I need an "image loader" or to repaint it from the paint method...This code seemed to work for my lecturer:
logo = new ImageIcon("JavaProgram2/LogoGIF.GIF");
logoLabel = new JLabel(" " + logo);
logoLabel.setOpaque(true);
logoLabel.setBackground(Color.white);
row2.add(logoLabel); //row2 is the name of the panel
The label and logo is initialised at the beginning of my application with the Jlabel and ImageIcon var type, I have imported it, tried it without the file path with solely the file name and have tried different file types. I did look at previous posts about this but the code seemed a bit lengthly considering that I simply want to add an image.
Anyone got any ideas on how I could do this easily?