2
I already checked and the path is correct, but when I run nothing appears on the screen:
public class MapaInterface extends JPanel implements ActionListener {
private Image fundo;
public static Agente daenerys;
private Timer timer;
public MapaInterface() {
    String caminho = "/res/mapaGot.png";
    URL url = getClass().getResource(caminho);
    ImageIcon referencia = new ImageIcon(caminho);
    fundo = referencia.getImage();
    timer = new Timer(5, this);
    timer.start();
}
public void Paint(Graphics g) {
    Graphics2D graficos = (Graphics2D) g;
    //null = fundo estático
    graficos.drawImage(fundo, 0, 0, null);
    //atualiza a imagem
    graficos.drawImage(daenerys.getImagem(), daenerys.getPosicao().getX(), daenerys.getPosicao().getY(), this);
    g.dispose();
}
@Override
public void actionPerformed(ActionEvent e) {
    repaint();
}
public static Agente getDaenerys() {
    return daenerys;
}
public static void setDaenerys(Agente daenerys) {
    MapaInterface.daenerys = daenerys;
}
When I call the class:
public class ContainerDeJanelas extends JFrame{
    public ContainerDeJanelas(){
        add(new MapaInterface());
        setTitle("Heurística Game of Thrones");
        //tamanho da tela
        setSize(750,750);
        //usuario nao pode redimensionar a tela
        setResizable(false);
        //evento ao clicar em fechar
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //onde a janela vai aparecer (null = centro)
        setLocationRelativeTo(null);
        setVisible(true);
    }
}
main:
   ContainerDeJanelas containerDeJanelas = new ContainerDeJanelas();
						
Try using an image (url) from the internet and/or using an absolute path. I remember I’ve been through something similar. For some reason the program could not access the file; as if it did not exist. I resolved using an absolute path.
– Pedro H. N. Vieira
The problem is that the image has to be this, is an image that I created. What would be an absolute path? I have tested anyway
– Éowyn
Absolute path is type "C: my folder icone.png figures". The idea of using an absolute path (or a url) is only to see if the image will appear as desired. To determine whether the problem is in the code or in the path (as I mentioned, sometimes the file may be invisible to the program; what seems to have happened to me - and I don’t know how to solve it).
– Pedro H. N. Vieira
Aaah worked out! Thank you :)
– Éowyn
I closed it as a duplicate because the way to resolve it is similar to what was answered in the other question.
– user28595