Hallo ich hab mir ein Bild mit Paint.net gemalt und will dieses als Hintergrund in meinem Projekt haben.
Mein Code:
In Zeile mit dem //hier wird mir das gesagt: The method setContentPane(Container) in the type JFrame is not applicable for the arguments (File).
So jetzt möchte ich wissen was ich falsch gemacht hab (bestimmt was voll dämliches) und wie ich das dann auch richtig mache. Danke im voraus : )
Mein Code:
Java:
package Pack1;
import java.io.File;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Screen {
public static void main(String[] args) {
JFrame jf = new JFrame();
jf.setTitle("Bild");
jf.setVisible(true);
jf.setContentPane(new File("Background.jpg")); //hier
jf.setSize(1024, 768);
jf.setDefaultCloseOperation(jf.EXIT_ON_CLOSE);
}}
In Zeile mit dem //hier wird mir das gesagt: The method setContentPane(Container) in the type JFrame is not applicable for the arguments (File).
So jetzt möchte ich wissen was ich falsch gemacht hab (bestimmt was voll dämliches) und wie ich das dann auch richtig mache. Danke im voraus : )