Swing Hintergrund

jonasmanager

Grünschnabel
Hey Leute,
ich hab ein problem:
ich habe diesen code und möchte ein bild als hintergrund.
allerdings will es nicht so ganz hinhauen...
hier der code:

Java:
package tests;

import javax.swing.*;

/**
 *
 * @author Jonas
 */
public class Tests{
    
    public static void main(String[] args) {
        JFrame frame = new JFrame("Test");
        frame.setSize(400,300);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
        Icon img = new ImageIcon("Feld.gif");
        JLabel label = new JLabel(img);
        frame.add(label);
     }
}
 
Zuletzt bearbeitet von einem Moderator:
Es wäre super wenn du [code=java] tags benutzt.
Sowie hier:
Java:
/**
*
* @author Jonas
*/
public class Tests{

public static void main(String[] args) {
    JFrame frame = new JFrame("Test");
    frame.setSize(400,300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
    Icon img = new ImageIcon("Feld.gif");
    JLabel label = new JLabel(img);
    frame.add(label);
}

}

Danke :)
 

Neue Beiträge

Zurück