feat: init VueGrille
This commit is contained in:
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
6
.idea/compiler.xml
generated
Normal file
6
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<bytecodeTargetLevel target="21" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
16
.idea/gradle.xml
generated
Normal file
16
.idea/gradle.xml
generated
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
5
.idea/misc.xml
generated
Normal file
5
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="23" project-jdk-type="JavaSDK" />
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -34,7 +34,7 @@ java {
|
|||||||
|
|
||||||
application {
|
application {
|
||||||
// Define the main class for the application.
|
// Define the main class for the application.
|
||||||
mainClass = "org.example.App"
|
mainClass = "org.App"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named<Test>("test") {
|
tasks.named<Test>("test") {
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
package org;
|
package org;
|
||||||
|
|
||||||
|
import org.Models.Grille;
|
||||||
|
import org.Views.VueGrille;
|
||||||
|
|
||||||
public class App {
|
public class App {
|
||||||
public String getGreeting() {
|
public String getGreeting() {
|
||||||
return "Hello World!";
|
return "Hello World!";
|
||||||
@@ -10,5 +13,7 @@ public class App {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println(new App().getGreeting());
|
System.out.println(new App().getGreeting());
|
||||||
|
Grille grille = new Grille(10, 10);
|
||||||
|
VueGrille vueGrille = new VueGrille(grille);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
21
app/src/main/java/org/Models/Grille.java
Normal file
21
app/src/main/java/org/Models/Grille.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package org.Models;
|
||||||
|
|
||||||
|
public class Grille {
|
||||||
|
private boolean[][] grille;
|
||||||
|
public int nbLignes;
|
||||||
|
public int nbColonnes;
|
||||||
|
|
||||||
|
public Grille(int nbLignes, int nbColonnes) {
|
||||||
|
this.nbLignes = nbLignes;
|
||||||
|
this.nbColonnes = nbColonnes;
|
||||||
|
this.grille = new boolean[nbLignes][nbColonnes];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNbLignes() {
|
||||||
|
return nbLignes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNbColonnes() {
|
||||||
|
return nbColonnes;
|
||||||
|
}
|
||||||
|
}
|
||||||
5
app/src/main/java/org/Models/Jeu.java
Normal file
5
app/src/main/java/org/Models/Jeu.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package org.Models;
|
||||||
|
|
||||||
|
public class Jeu {
|
||||||
|
|
||||||
|
}
|
||||||
5
app/src/main/java/org/Models/PieceCourante.java
Normal file
5
app/src/main/java/org/Models/PieceCourante.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package org.Models;
|
||||||
|
|
||||||
|
public class PieceCourante {
|
||||||
|
|
||||||
|
}
|
||||||
5
app/src/main/java/org/Models/PieceL.java
Normal file
5
app/src/main/java/org/Models/PieceL.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package org.Models;
|
||||||
|
|
||||||
|
public class PieceL {
|
||||||
|
|
||||||
|
}
|
||||||
41
app/src/main/java/org/Views/VueGrille.java
Normal file
41
app/src/main/java/org/Views/VueGrille.java
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
package org.Views;
|
||||||
|
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.border.Border;
|
||||||
|
|
||||||
|
import org.Models.Grille;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.GridLayout;
|
||||||
|
|
||||||
|
public class VueGrille extends JFrame {
|
||||||
|
private JPanel grillePanel;
|
||||||
|
private int tailleJPanel = 1000;
|
||||||
|
private Grille grille;
|
||||||
|
|
||||||
|
public VueGrille(Grille grille) {
|
||||||
|
this.grille = grille;
|
||||||
|
grillePanel = new JPanel(new GridLayout(grille.getNbLignes(), grille.getNbColonnes()));
|
||||||
|
setSize(tailleJPanel, tailleJPanel);
|
||||||
|
setContentPane(grillePanel);
|
||||||
|
initialiserVueGrille();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialiserVueGrille() {
|
||||||
|
Border border = BorderFactory.createLineBorder(Color.BLACK);
|
||||||
|
for (int i = 0; i < grille.getNbLignes(); i++) {
|
||||||
|
for (int j = 0; j < grille.getNbColonnes(); j++) {
|
||||||
|
JPanel caseG = new JPanel();
|
||||||
|
caseG.setBorder(border);
|
||||||
|
caseG.setBackground(Color.WHITE);
|
||||||
|
grillePanel.add(caseG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setVisible(true);
|
||||||
|
|
||||||
|
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||||
|
setTitle("TETRIS");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user