All I am trying to do is add a picture to a JFrame
.
I am really confused and don't really understand... I have looked up every possible question on this site, looked on other java stuff, such as forums. I tried my best and now I must ask guys for help. I hope the code is clean and easy to read. Thanks for the help.
package zeus;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
public class Main extends JFrame{
public static final int WIDTH = 800;
public static final int HEIGHT = 600;
public static final int SCALE = 1;
public static void Launch(){
JFrame xF = new JFrame("xFrame");
xF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
xF.setResizable(false);
xF.setVisible(true);
xF.setSize(WIDTH*SCALE,HEIGHT*SCALE);
xF.setLocationRelativeTo(null);
xF.add(new JLabel(new ImageIcon("/Clicker/xS/cow.png")));
}
public static void main(String[] args){
Launch();
}
}
Very sorry for the confusion, eclipse shows no error, also I am trying to open a JFrame with an image on it, that I can eventually use to create into a button to change a value of a int value.