mirror of
https://github.com/guezoloic/L3-racing-game.git
synced 2026-03-31 12:21:34 +00:00
feat: ajout classe view principale
This commit is contained in:
33
src/GameView.java
Normal file
33
src/GameView.java
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import java.awt.Container;
|
||||||
|
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
|
||||||
|
public class GameView extends JFrame implements GObserver {
|
||||||
|
protected Container window;
|
||||||
|
|
||||||
|
public GameView(String title, int width, int height, int x, int y)
|
||||||
|
{
|
||||||
|
// la fenetre
|
||||||
|
JFrame frame = new JFrame(title);
|
||||||
|
// position fenetre
|
||||||
|
frame.setLocation(x, y);
|
||||||
|
// taille fenetre
|
||||||
|
frame.setSize(width, height);
|
||||||
|
|
||||||
|
// bool pour resize la fenetre
|
||||||
|
frame.setResizable(false);
|
||||||
|
// le bouton close par defaut
|
||||||
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
// visibilité de la fenetre
|
||||||
|
frame.setVisible(true);
|
||||||
|
|
||||||
|
// acceder a l'interieur de la fenetre
|
||||||
|
window = frame.getContentPane();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user