Skip to content

Commit

Permalink
Import
Browse files Browse the repository at this point in the history
  • Loading branch information
LionelJouin committed Sep 14, 2018
1 parent fdbfe96 commit 39553c1
Show file tree
Hide file tree
Showing 104 changed files with 5,058 additions and 674 deletions.
7 changes: 7 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/mysql-connector-java-5.1.39-bin.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Mobile Tools for Java (J2ME)
.mtj.tmp/

/bin/

# Package Files #
*.jar
*.war
Expand Down
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PTS2-G3</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
674 changes: 0 additions & 674 deletions LICENSE

This file was deleted.

Binary file added ico/gamew.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ico/gear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ico/gearw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ico/pause.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ico/people.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ico/web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions options.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<Options>
<thematiqueDefaut>chimieFacile</thematiqueDefaut>
<resolution>1680x1050</resolution>
<urlBDD></urlBDD>
<user></user>
<password></password>
</Options>
29 changes: 29 additions & 0 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import controller.Controller;
import model.Model;
import view.Window;

public class Main {

public static void main(String[] args) {

// http://www.developpez.net/forums/d881330/java/interfaces-graphiques-java/awt-swing/fenetres-dialogues/question-cardlayout-changement-panel/
// http://thebadprogrammer.com/swing-uimanager-keys/
// http://www.duncanjauncey.com/java/ui/uimanager/UIDefaults_Java1.7.0_Linux_2.6.38-11-server_CDE_Motif.html

/*
* Faire des listener sur le model dans le controlleur pour quae quand
* le model change la vue soit notifier et change aussi
*/

// https://github.com/koppelbw/TicTacToe/tree/master/src


Model model = new Model();
Window vue = new Window();
Controller controller = new Controller(model, vue);

vue.setVisible(true);

}

}
55 changes: 55 additions & 0 deletions src/controller/AccueilController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.swing.JButton;
import javax.swing.JTable;

import model.ModelTableClassement;
import model.dao.ScoreDAO;
import view.AccueilPanel;
import view.Panels;

public class AccueilController extends Controller implements PanelControllerInterface {

private Controller mC;
private AccueilPanel accueilPanel;

public AccueilController(Controller mC) {

this.mC = mC;
this.accueilPanel = mC.view.getAccueilPanel();
this.accueilPanel.addButtonListener(new ButtonListener());

}

private class ButtonListener implements ActionListener{

@Override
public void actionPerformed(ActionEvent e) {
JButton optionsJeuButton = accueilPanel.getOptionsJeuButton();
JButton optionsButton = accueilPanel.getOptionsButton();
JButton classementButton = accueilPanel.getClassementButton();

if (e.getSource() == optionsJeuButton)
mC.panelController.changeView(Panels.OPTIONS_JEU);
else if (e.getSource() == optionsButton)
mC.panelController.changeView(Panels.OPTIONS);
else if (e.getSource() == classementButton)
mC.panelController.changeView(Panels.CLASSEMENT);

}
}

@Override
public void initPanel() {
JTable scoreTable = accueilPanel.getScoreTable();
scoreTable.setModel(new ModelTableClassement(10));

System.out.println(scoreTable.getModel().getRowCount() +" test");
}

}
47 changes: 47 additions & 0 deletions src/controller/ClassementController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JTable;

import model.ModelTableClassement;
import view.AccueilPanel;
import view.ClassementPanel;
import view.Panels;

public class ClassementController extends Controller implements PanelControllerInterface {

private Controller mC;
private ClassementPanel classementPanel;

public ClassementController(Controller mC) {

this.mC = mC;
this.classementPanel = mC.view.getClassementPanel();
this.classementPanel.addButtonListener(new ButtonListener());

}

private class ButtonListener implements ActionListener{

@Override
public void actionPerformed(ActionEvent e) {

JButton accueilButton = classementPanel.getAccueilButton();

if (e.getSource() == accueilButton)
mC.panelController.changeView(Panels.ACCUEIL);
}
}

@Override
public void initPanel() {
JTable scoreTable = classementPanel.getScoreTable();
scoreTable.setModel(new ModelTableClassement(100));

System.out.println(scoreTable.getModel().getRowCount() +" test");
}

}
37 changes: 37 additions & 0 deletions src/controller/Controller.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package controller;

import java.util.ArrayList;
import java.util.HashMap;

import model.Model;
import view.AccueilPanel;
import view.Panels;
import view.Window;

public class Controller {

protected Window view;
protected Model model;
protected HashMap<Panels, PanelControllerInterface> controllers = new HashMap<>();
protected PanelController panelController;

public Controller() {

}

public Controller(Model gameModel, Window view) {
this();
this.view = view;
this.model = gameModel;

controllers.put(Panels.ACCUEIL, new AccueilController(this));
controllers.put(Panels.OPTIONS_JEU, new OptionsJeuController(this));
controllers.put(Panels.OPTIONS, new OptionsController(this));
controllers.put(Panels.JEU, new JeuController(this));
controllers.put(Panels.CLASSEMENT, new ClassementController(this));

panelController = new PanelController(this);

}

}
Loading

0 comments on commit 39553c1

Please sign in to comment.