This commit is contained in:
2022-05-22 23:34:42 +08:00
parent d0416b02bd
commit a9f7967976
30 changed files with 904 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import javax.swing.JFrame;
public abstract class View<T extends Controller> extends JFrame implements ModelListener {
protected Model m;
protected T c;
public View(Model m, T c) {
this.m = m;
this.c = c;
m.addListener(this);
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
c.shutdown();
}
});
}
@Override
public abstract void update();
}