title: Moving jLabel to a different place in the jPanel (Pacman like game)
body: <p>I'm making a game like pacman and so far I am just starting with the grid. I got the grid started but I need to figure out how to move something to a different place in the grid so that when the user clicks or my ghosts move, it will display on the screen. How do I make it move? I have tried a bunch of different ways but none worked for me.</p>
  
  <pre><code>import java.awt.*;
  
  import javax.swing.*;
  import javax.swing.border.BevelBorder;
  
  
  public class GUI {
  
  public static void main(String[] args) {
      final JFrame f = new JFrame("Frame Test");
      GridLayout Layout = new GridLayout(50,50);
  
      JPanel panel = new JPanel(new GridLayout(50, 50, 1, 1));
  
      //Not sure if I need this or not?
      //panel.setLayout(new GridBagLayout());
  
      //first set of black
      for (int i = 0; i &lt; 1000; i++) {
          JLabel a = new JLabel(new ImageIcon("black-square.jpg"), JLabel.CENTER);
          panel.add(a);
  
      }
  
      //adds pacman
      JLabel b = new JLabel(new ImageIcon("pacman.png"), JLabel.CENTER);
      panel.add(b);
  
      //next set of black
      for (int i = 0; i &lt; 1000; i++) {
          JLabel c = new JLabel(new ImageIcon("black-square.jpg"), JLabel.CENTER);
          panel.add(c);
      }
  
  
     //do the thing 
      f.setContentPane(panel);
      f.setSize(1000, 1000);
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setVisible(true);
  
  
  }
  </code></pre>
  
  <p>}</p>