feat: init VueGrille

This commit is contained in:
Morph01
2025-05-13 12:01:57 +02:00
parent b2649c364b
commit 5a175ea4b4
12 changed files with 125 additions and 2 deletions

8
.idea/.gitignore generated vendored Normal file
View 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
View 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
View 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
View 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
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -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") {

View File

@@ -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);
} }
} }

View 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;
}
}

View File

@@ -0,0 +1,5 @@
package org.Models;
public class Jeu {
}

View File

@@ -0,0 +1,5 @@
package org.Models;
public class PieceCourante {
}

View File

@@ -0,0 +1,5 @@
package org.Models;
public class PieceL {
}

View 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");
}
}