How do I separate classes for MVC design pattern in Java (KeyListener separate from JFrame)?

You should use the Observable and Observer class of the JDK, here's a very simple example (with Swing). It's some pseudo-code, , be careful ;).

In Swing the View and Controller are mostly the same classes, e.g. JTable (View & Controller) + TableModel (Model). If you want a clean separation you could take a look at JGoodies which is a data binding framework for Swing but I'm not sure if it will be the best solution for a game. Of course you could implement your own Logic Layer, e.g.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions