title: Java Animate JLabel
body: <p>So I am creating a basic application that I want to have a JLabel at the bottom of the screen that starts at the left bottom corner and moves, animation style, to the right bottom corner in a set time, and a static image in the center. To do this, I created a JFrame with a JPanel using BorderLayout. There is a JLabel with an ImageIcon added to BorderLayout.CENTER and a JPanel at BorderLayout.SOUTH. My code, while hastily written and far from pretty, is:</p>
  
  <pre><code>import java.awt.BorderLayout;
  import java.awt.Color;
  import java.awt.Dimension; 
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  
  import javax.swing.JFrame;
  import javax.swing.JLabel;
  import javax.swing.JPanel;
  import javax.swing.Timer;
  import javax.swing.BorderFactory;
  
  public class GameWindow extends JPanel{
  
  private static JLabel mainWindow, arrowLabel, arrowBox;
  protected static JFrame frame;
  protected static JPanel arrows;
  
  public static int x = 600;
  
  public GameWindow(){
      mainWindow = new JLabel("Center");
      arrowLabel = new JLabel("Moving");
      arrows = new JPanel();
      arrows.setSize(600, 100);
      arrows.setLayout(null);
      arrowBox = new JLabel("");
      arrowBox.setBounds(0, 0, 150, 100);
      arrowBox.setPreferredSize(new Dimension(150, 100));
      arrowBox.setBorder(BorderFactory.createLineBorder(Color.black));
      arrows.add(arrowBox);
      this.setSize(600,600);
      this.setLayout(new BorderLayout());
      this.add(mainWindow, BorderLayout.CENTER);
      this.add(arrows, BorderLayout.SOUTH);
  }
  
  public static void main(String[] args)
  {
      GameWindow g = new GameWindow();
      frame = new JFrame("Sword Sword Revolution");
      frame.add(g);
      frame.setSize(600,600);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
  
      Timer t = new Timer(1000, new ActionListener(){
  
          @Override
          public void actionPerformed(ActionEvent e) {
              arrows.add(arrowLabel);
              arrowLabel.setBounds(x, 100, 100, 100);
              x-=50;
              arrows.repaint();
              frame.repaint();
          }
  
      });
      t.start();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The ImageIcon in the center JLabel appears fine, and the empty JLabel with a border appears at the bottom, but I cannot get the second JLabel with the arrow image to show up on screen. Eventually I will change to scheduleAtFixedRate to continuously move the JLabel, but right now I can't even get the image to appear on screen. </p>
  
  <p>I also understand that I will most likely not be able to use FlowLayout for this, as I understand it does not allow you to set the location of your components. I tried using null layout, but with null layout the empty JLabel with a border does not appear. I can barely make out the top of the border at the bottom edge of the frame, but even with setLocation I cannot get it to appear where I want it to.</p>
  
  <p>Obviously, my thought process is flawed, so any help would be appreciated.</p>