I made a GIF using photoshop, here is the result:
It works fine
I am having issues when i load it to my java program. The red lines are bugged (I dont know what it's called), when it goes through the arrow. Here is the screenshot:
Here is the code if it helps in any way
IDLE_DEFAULT_GIF.setIcon(new ImageIcon("IDLE-GIF.gif"));
IDLE_DEFAULT_GIF.setBounds(x+128-130,15,204,172); //I set my panel's layout to null
FSM_PANEL.add(IDLE_DEFAULT_GIF);
MCVE
package vendingmachine;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class MainFrame extends JFrame{
//WIDTH & HEIGHT//
int WIDTH = 300;
int HEIGHT = 350;
//PANEL//
JPanel FSM_PANEL = new JPanel();
//GIF LABELS
JLabel IDLE_DEFAULT_GIF = new JLabel();
public MainFrame(){
setLayout( null );
//JFRAME
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(WIDTH,HEIGHT);
setVisible(true);
setLocationRelativeTo(null);
INIT_FSM_PANEL();
repaint();
}
public void INIT_FSM_PANEL(){
FSM_PANEL.setBounds(10, 8, WIDTH, HEIGHT);
FSM_PANEL.setLayout(null);
//The gif that caused the issue
IDLE_DEFAULT_GIF.setIcon(new ImageIcon("IDLE-GIF.gif"));
IDLE_DEFAULT_GIF.setBounds(10,10,204,172);
FSM_PANEL.add(IDLE_DEFAULT_GIF);
add(FSM_PANEL);
}
public static void main(String[] args) {
SwingUtilities.invokeLater( new Runnable(){
@Override
public void run() {
MainFrame frame = new MainFrame();
}
});
}
}