How do I load images in Jframe java(eclipse)?

后端 未结 4 1869
情书的邮戳
情书的邮戳 2021-01-03 16:58

I have an paneel.java file wich looks like the following code:

import java.awt.*;
import javax.swing.*;

public class Paneel extends JFrame
{
    public stat         


        
4条回答
  •  星月不相逢
    2021-01-03 17:45

    you need to set a file path to the image..something like this

    final ImageIcon icon = new ImageIcon("C:\\Users\\you\\Desktop\\test.gif");
    

提交回复
热议问题