i am trying for about two hours to show a 800*600 "Background Picture" on my Jpanel, it simply wont show up, whats wrong over here?
And by the way: i want to change my Background sometimes while the application is running, shouldnt i use another method for that than the main? If so, how could that Method look like? I still get Errors like "cant make static reference..."
public class Start {
public static void main(String[] args) {
JFrame frame = new JFrame("Abstieg");
JPanel panel = new JPanel();
frame.add(panel);
frame.setSize(800, 600);
frame.setResizable(false);
frame.setLocationRelativeTo ( null );
frame.setUndecorated(true);
ImageIcon background = new ImageIcon("Title.png");
JLabel label = new JLabel();
label.setBounds(0, 0, 0, 0);
label.setIcon(background);
panel.setLayout(null);
panel.add(label);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);