package grafik; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.JarURLConnection; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class BildLaden { public BildLaden() { init(); } private void init() { JLabel label = new JLabel(showImg()); JPanel panel = new JPanel(); panel.add(label); JFrame frame = new JFrame("Bilddatei laden"); frame.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Frame-Titel"); frame.setSize(600, 400); frame.setLocationRelativeTo(null); frame.setVisible(true); } private ImageIcon showImg() { BufferedImage img = null; try { /* hier Graphikdatei laden */ } catch (IOException e) { e.printStackTrace(); } return new ImageIcon(img); } public static void main(String[] args) { SwingUtilities.invokeLater(() -> new BildLaden()); } }