I have been doing it this way for a couple years now, my interface looks like this.
1 2 3 4 5 6 7 8 9 10
| import java.awt.Graphics2D; import java.awt.event.KeyListener; import javax.swing.event.MouseInputListener;
public interface GameState extends MouseInputListener, KeyListener { public void draw(Graphics2D g); public void update(long time); public GameState nextState(); } |
I have the nextState function so state changes are controlled by the current state with a line in your main game class's update function like:
1
| currentState = currentState.nextState(); |
You are creating a linked-list of GameStates? Why?
I have a class called GameWorld that acts much like a JPanel.
I add objects of a type that extends GameComponent, which is an abstract class with a draw and update method.
So you have almost the same setup

By the way, what is the
parameter in your update method for?