Good!
Look, I have a class called GIFPanel that inherits from the JPanel class
package Trivia;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;
public class GIFPanel extends JPanel{
private Image imagen;
public GIFPanel(Image imagen){
this.imagen = imagen;
}
@Override
public void paintComponent(Graphics g){
super.paintComponent(g);
g.drawImage(imagen,0,0,getWidth(),getHeight(),this);
}
}
In my other class I believe it and I insert an image whose source was from a web address
Image img = Toolkit.getDefaultToolkit().getImage(new URL("https://media.giphy.com/media/l3q2XKiWAOl0qa1Tq/source.gif"));
menu = new GIFPanel(img);
Ok, it works correctly, the gif plays back even with the generated JAR .... but ... it's not really what I'm looking for. How do you do ?, a few days ago ask about how to load images contained within packages of the same project in JAVA that were not through URLs, because when generating the jar file, the program responds with errors.
Try to do the same with the GIF file, but not even the netbeans recognize it. . .
The assets package already contains the GIF.
I want to avoid using web links since at the moment there is a connection failure where it will be used, the program will crasheara (it closes).
How do I make it so that I can reproduce the gif using the file contained in the package of my project?