diff --git a/q2/tp5/TP5.pdf b/q2/tp5/TP5.pdf
new file mode 100644
index 0000000..5c5f726
Binary files /dev/null and b/q2/tp5/TP5.pdf differ
diff --git a/q2/tp7/ExempleFX/.gradle/7.4.1/checksums/checksums.lock b/q2/tp7/ExempleFX/.gradle/7.4.1/checksums/checksums.lock
new file mode 100644
index 0000000..1042bcd
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/7.4.1/checksums/checksums.lock differ
diff --git a/q2/tp7/ExempleFX/.gradle/7.4.1/dependencies-accessors/dependencies-accessors.lock b/q2/tp7/ExempleFX/.gradle/7.4.1/dependencies-accessors/dependencies-accessors.lock
new file mode 100644
index 0000000..73dc8cc
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/7.4.1/dependencies-accessors/dependencies-accessors.lock differ
diff --git a/q2/tp7/ExempleFX/.gradle/7.4.1/dependencies-accessors/gc.properties b/q2/tp7/ExempleFX/.gradle/7.4.1/dependencies-accessors/gc.properties
new file mode 100644
index 0000000..e69de29
diff --git a/q2/tp7/ExempleFX/.gradle/7.4.1/executionHistory/executionHistory.bin b/q2/tp7/ExempleFX/.gradle/7.4.1/executionHistory/executionHistory.bin
new file mode 100644
index 0000000..5394db6
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/7.4.1/executionHistory/executionHistory.bin differ
diff --git a/q2/tp7/ExempleFX/.gradle/7.4.1/executionHistory/executionHistory.lock b/q2/tp7/ExempleFX/.gradle/7.4.1/executionHistory/executionHistory.lock
new file mode 100644
index 0000000..3d84c85
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/7.4.1/executionHistory/executionHistory.lock differ
diff --git a/q2/tp7/ExempleFX/.gradle/7.4.1/fileChanges/last-build.bin b/q2/tp7/ExempleFX/.gradle/7.4.1/fileChanges/last-build.bin
new file mode 100644
index 0000000..f76dd23
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/7.4.1/fileChanges/last-build.bin differ
diff --git a/q2/tp7/ExempleFX/.gradle/7.4.1/fileHashes/fileHashes.bin b/q2/tp7/ExempleFX/.gradle/7.4.1/fileHashes/fileHashes.bin
new file mode 100644
index 0000000..b792b82
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/7.4.1/fileHashes/fileHashes.bin differ
diff --git a/q2/tp7/ExempleFX/.gradle/7.4.1/fileHashes/fileHashes.lock b/q2/tp7/ExempleFX/.gradle/7.4.1/fileHashes/fileHashes.lock
new file mode 100644
index 0000000..d61ae7a
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/7.4.1/fileHashes/fileHashes.lock differ
diff --git a/q2/tp7/ExempleFX/.gradle/7.4.1/fileHashes/resourceHashesCache.bin b/q2/tp7/ExempleFX/.gradle/7.4.1/fileHashes/resourceHashesCache.bin
new file mode 100644
index 0000000..d56ea5e
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/7.4.1/fileHashes/resourceHashesCache.bin differ
diff --git a/q2/tp7/ExempleFX/.gradle/7.4.1/gc.properties b/q2/tp7/ExempleFX/.gradle/7.4.1/gc.properties
new file mode 100644
index 0000000..e69de29
diff --git a/q2/tp7/ExempleFX/.gradle/8.0.2/checksums/checksums.lock b/q2/tp7/ExempleFX/.gradle/8.0.2/checksums/checksums.lock
new file mode 100644
index 0000000..816d49a
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/8.0.2/checksums/checksums.lock differ
diff --git a/q2/tp7/ExempleFX/.gradle/8.0.2/checksums/md5-checksums.bin b/q2/tp7/ExempleFX/.gradle/8.0.2/checksums/md5-checksums.bin
new file mode 100644
index 0000000..e18e70b
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/8.0.2/checksums/md5-checksums.bin differ
diff --git a/q2/tp7/ExempleFX/.gradle/8.0.2/checksums/sha1-checksums.bin b/q2/tp7/ExempleFX/.gradle/8.0.2/checksums/sha1-checksums.bin
new file mode 100644
index 0000000..3893674
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/8.0.2/checksums/sha1-checksums.bin differ
diff --git a/q2/tp7/ExempleFX/.gradle/8.0.2/dependencies-accessors/dependencies-accessors.lock b/q2/tp7/ExempleFX/.gradle/8.0.2/dependencies-accessors/dependencies-accessors.lock
new file mode 100644
index 0000000..90feba5
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/8.0.2/dependencies-accessors/dependencies-accessors.lock differ
diff --git a/q2/tp7/ExempleFX/.gradle/8.0.2/dependencies-accessors/gc.properties b/q2/tp7/ExempleFX/.gradle/8.0.2/dependencies-accessors/gc.properties
new file mode 100644
index 0000000..e69de29
diff --git a/q2/tp7/ExempleFX/.gradle/8.0.2/executionHistory/executionHistory.bin b/q2/tp7/ExempleFX/.gradle/8.0.2/executionHistory/executionHistory.bin
new file mode 100644
index 0000000..5b75217
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/8.0.2/executionHistory/executionHistory.bin differ
diff --git a/q2/tp7/ExempleFX/.gradle/8.0.2/executionHistory/executionHistory.lock b/q2/tp7/ExempleFX/.gradle/8.0.2/executionHistory/executionHistory.lock
new file mode 100644
index 0000000..808ebba
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/8.0.2/executionHistory/executionHistory.lock differ
diff --git a/q2/tp7/ExempleFX/.gradle/8.0.2/fileChanges/last-build.bin b/q2/tp7/ExempleFX/.gradle/8.0.2/fileChanges/last-build.bin
new file mode 100644
index 0000000..f76dd23
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/8.0.2/fileChanges/last-build.bin differ
diff --git a/q2/tp7/ExempleFX/.gradle/8.0.2/fileHashes/fileHashes.bin b/q2/tp7/ExempleFX/.gradle/8.0.2/fileHashes/fileHashes.bin
new file mode 100644
index 0000000..fdf6697
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/8.0.2/fileHashes/fileHashes.bin differ
diff --git a/q2/tp7/ExempleFX/.gradle/8.0.2/fileHashes/fileHashes.lock b/q2/tp7/ExempleFX/.gradle/8.0.2/fileHashes/fileHashes.lock
new file mode 100644
index 0000000..f031e5d
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/8.0.2/fileHashes/fileHashes.lock differ
diff --git a/q2/tp7/ExempleFX/.gradle/8.0.2/fileHashes/resourceHashesCache.bin b/q2/tp7/ExempleFX/.gradle/8.0.2/fileHashes/resourceHashesCache.bin
new file mode 100644
index 0000000..88b0702
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/8.0.2/fileHashes/resourceHashesCache.bin differ
diff --git a/q2/tp7/ExempleFX/.gradle/8.0.2/gc.properties b/q2/tp7/ExempleFX/.gradle/8.0.2/gc.properties
new file mode 100644
index 0000000..e69de29
diff --git a/q2/tp7/ExempleFX/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/q2/tp7/ExempleFX/.gradle/buildOutputCleanup/buildOutputCleanup.lock
new file mode 100644
index 0000000..b6dc44d
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/q2/tp7/ExempleFX/.gradle/buildOutputCleanup/cache.properties b/q2/tp7/ExempleFX/.gradle/buildOutputCleanup/cache.properties
new file mode 100644
index 0000000..3e9b61e
--- /dev/null
+++ b/q2/tp7/ExempleFX/.gradle/buildOutputCleanup/cache.properties
@@ -0,0 +1,2 @@
+#Wed Apr 19 14:36:46 CEST 2023
+gradle.version=7.4.1
diff --git a/q2/tp7/ExempleFX/.gradle/buildOutputCleanup/outputFiles.bin b/q2/tp7/ExempleFX/.gradle/buildOutputCleanup/outputFiles.bin
new file mode 100644
index 0000000..bf1a1e6
Binary files /dev/null and b/q2/tp7/ExempleFX/.gradle/buildOutputCleanup/outputFiles.bin differ
diff --git a/q2/tp7/ExempleFX/.gradle/vcs-1/gc.properties b/q2/tp7/ExempleFX/.gradle/vcs-1/gc.properties
new file mode 100644
index 0000000..e69de29
diff --git a/q2/tp7/ExempleFX/.project b/q2/tp7/ExempleFX/.project
new file mode 100644
index 0000000..cc56c7e
--- /dev/null
+++ b/q2/tp7/ExempleFX/.project
@@ -0,0 +1,17 @@
+
+
+ ExempleFX
+ Project ExempleFX created by Buildship.
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectbuilder
+
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectnature
+
+
diff --git a/q2/tp7/ExempleFX/.settings/org.eclipse.buildship.core.prefs b/q2/tp7/ExempleFX/.settings/org.eclipse.buildship.core.prefs
new file mode 100644
index 0000000..288a007
--- /dev/null
+++ b/q2/tp7/ExempleFX/.settings/org.eclipse.buildship.core.prefs
@@ -0,0 +1,13 @@
+arguments=
+auto.sync=false
+build.scans.enabled=false
+connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
+connection.project.dir=
+eclipse.preferences.version=1
+gradle.user.home=
+java.home=/usr/lib/jvm/java-19-openjdk
+jvm.arguments=
+offline.mode=false
+override.workspace.settings=true
+show.console.view=true
+show.executions.view=true
diff --git a/q2/tp7/ExempleFX/build.gradle b/q2/tp7/ExempleFX/build.gradle
new file mode 100644
index 0000000..da1d9a8
--- /dev/null
+++ b/q2/tp7/ExempleFX/build.gradle
@@ -0,0 +1,25 @@
+plugins {
+ id 'application'
+ id 'org.openjfx.javafxplugin' version '0.0.9'
+}
+
+compileJava.options.encoding = "UTF-8"
+
+repositories {
+ jcenter()
+}
+
+dependencies {
+}
+
+application {
+ // C'est le nom de la classe principale (contenant la méthode main). On
+ // doit donner les packages s'il y en a. Ici, Main est dans le package
+ // exemplefx.
+ mainClass = 'exemplefx.Main'
+}
+
+javafx {
+ version = "11"
+ modules = [ 'javafx.controls' ]
+}
diff --git a/q2/tp7/ExempleFX/build/tmp/compileJava/previous-compilation-data.bin b/q2/tp7/ExempleFX/build/tmp/compileJava/previous-compilation-data.bin
new file mode 100644
index 0000000..186c04e
Binary files /dev/null and b/q2/tp7/ExempleFX/build/tmp/compileJava/previous-compilation-data.bin differ
diff --git a/q2/tp7/ExempleFX/gradle/wrapper/gradle-wrapper.jar b/q2/tp7/ExempleFX/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..41d9927
Binary files /dev/null and b/q2/tp7/ExempleFX/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/q2/tp7/ExempleFX/gradle/wrapper/gradle-wrapper.properties b/q2/tp7/ExempleFX/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..00e33ed
--- /dev/null
+++ b/q2/tp7/ExempleFX/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/q2/tp7/ExempleFX/gradlew b/q2/tp7/ExempleFX/gradlew
new file mode 100755
index 0000000..1b6c787
--- /dev/null
+++ b/q2/tp7/ExempleFX/gradlew
@@ -0,0 +1,234 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+
+APP_NAME="Gradle"
+APP_BASE_NAME=${0##*/}
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+# Collect all arguments for the java command;
+# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+# shell script including quotes and variable substitutions, so put them in
+# double quotes to make sure that they get re-expanded; and
+# * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/q2/tp7/ExempleFX/gradlew.bat b/q2/tp7/ExempleFX/gradlew.bat
new file mode 100644
index 0000000..ac1b06f
--- /dev/null
+++ b/q2/tp7/ExempleFX/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/q2/tp7/ExempleFX/src/main/java/exemplefx/Main.java b/q2/tp7/ExempleFX/src/main/java/exemplefx/Main.java
new file mode 100644
index 0000000..88a1e62
--- /dev/null
+++ b/q2/tp7/ExempleFX/src/main/java/exemplefx/Main.java
@@ -0,0 +1,260 @@
+package exemplefx;
+
+import javafx.application.Application;
+import javafx.stage.Stage;
+import javafx.scene.Scene;
+import javafx.scene.layout.BorderPane;
+import javafx.scene.layout.GridPane;
+import javafx.scene.layout.StackPane;
+import javafx.scene.layout.VBox;
+import javafx.scene.layout.HBox;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.Button;
+import javafx.scene.control.TextField;
+import javafx.scene.control.Label;
+import javafx.geometry.Pos;
+import javafx.event.EventHandler;
+import javafx.scene.input.KeyEvent;
+import javafx.scene.input.KeyCode;
+import java.util.Timer;
+import java.util.TimerTask;
+
+// La classe principale pour javafx doit hériter de Application.
+//
+// L'objectif de ce programme est d'afficher une forme (cercle ou carré) que
+// l'on pourra déplacer via des boutons. Commencez par exécuter le code pour
+// voir ce que ça fait.
+//
+// Pour ce faire, ouvrez un terminal dans le dossier contenant le fichier
+// build.gradle et entrez la commande "gradle run" (sans les guillemets)
+//
+// Si vous n'avez pas installé gradle, remplacez gradle dans la commande par
+// .\gradlew.bat si vous êtes sous windows et ./gradlew si vous êtes sous mac
+// ou linux.
+public class Main extends Application {
+
+ private CheckBox drawSquare;
+ private CheckBox blink;
+ private Button up;
+ private Button down;
+ private MonCanvas canvas;
+ private TextField size;
+ private TextField increment;
+ private Timer blinkTimer;
+
+ public static void main(String[] args) {
+ // Méthode statique de Application pour lancer le programme
+ launch(args);
+ }
+
+ // Méthode appelée quand on initialise la fenêtre. C'est à partir de là
+ // qu'on va ajouter les boutons et autres.
+ // Stage représente la fenêtre.
+ public void start(Stage stage) {
+ // Il s'agit d'un layout. Un layout est un objet auquel on va ajouter
+ // des éléments (boutons, texte, ...) et qui va gérer comment les
+ // placer sur la fenêtre.
+ // Le BorderPane découpe la zone en cinq : haut, bas, gauche, droite et
+ // centre. Il permet de placer des éléments sur les bords tout en
+ // gardant un maximum de place pour le centre où on peut mettre le
+ // principal. Par exemple, dans un éditeur de texte, on peut avoir les
+ // boutons au dessus et le texte prend la place restante au centre.
+ BorderPane root = new BorderPane();
+
+ // On crée deux boutons
+ up = new Button("Haut");
+ down = new Button("Bas");
+
+ // Une VBox est un autre exemple de layout. Elle va placer les éléments
+ // de haut en bas dans l'ordre où on les ajoute. Pour un placement de
+ // gauche à droite, on utilise une HBox.
+ VBox buttons = new VBox();
+ // On ajoute le bouton up en l'ajoutant aux "enfants" de la VBox. Les
+ // enfants d'un élément sont ceux qui se trouvent à l'intérieur.
+ buttons.getChildren().add(up);
+ buttons.getChildren().add(down);
+ // On peut aussi demander à la VBox de centrer ses composants.
+ buttons.setAlignment(Pos.CENTER);
+
+ // Ici, on place la VBox dans la partie gauche du BorderPane. Cela veut
+ // dire que le BorderPane va juste placer tous les éléments de la VBox
+ // dans la partie gauche de la fenêtre mais c'est la VBox qui va
+ // choisir comment les placer dans cette partie gauche. Ici, de haut en
+ // bas car c'est le principe d'une VBox.
+ root.setLeft(buttons);
+
+ // On crée une check box avec le texte donné.
+ drawSquare = new CheckBox("Dessiner un carré");
+ blink = new CheckBox("Clignoter");
+
+ HBox checks = new HBox(drawSquare, blink);
+ checks.setAlignment(Pos.CENTER);
+ // On place la check box en haut du BorderPane et donc en haut de la
+ // fenêtre comme le BorderPane sera le contenu principal de la fenêtre.
+ root.setTop(checks);
+
+ // Un GridPane est un layout qui place ses éléments sous forme de
+ // grille. On peut y ajouter chaque élément dans une certaine ligne et
+ // une certaine colonne.
+ GridPane texts = new GridPane();
+ // On crée un Label qui correspond à un simple texte. Ce Label sera
+ // placé dans la ligne 0 et la colonne 0 du GridPane. C'est à dire,
+ // dans la case en haut à gauche.
+ texts.add(new Label("Taille de la forme (rayon) :"), 0, 0);
+ // Un TextField permet d'entrer du texte.
+ size = new TextField();
+ // On place le TextField pour la taille de la forme dans la première
+ // ligne et dans la deuxième colonne du GridPane.
+ texts.add(size, 1, 0);
+ texts.add(new Label("Distance du déplacement :"), 0, 1);
+ increment = new TextField();
+ texts.add(increment, 1, 1);
+ texts.setAlignment(Pos.CENTER);
+
+ root.setBottom(texts);
+
+ // On crée un canvas personnalisé (voir MonCanvas.java)
+ canvas = new MonCanvas(800, 600);
+ // Le canvas pourra utiliser toute la place restante au centre. Mais
+ // comme les canvas de JavaFX ont une taille fixe, il ne changera pas
+ // de taille si on change la taille de la fenêtre. Pour cela, il
+ // faudrait modifier notre canvas.
+ root.setCenter(canvas);
+
+ // La scène représente ce qui sera affiché dans la fenêtre.
+ // Une scène à besoin d'un layout. C'est pour ça qu'on lui donne root
+ // qui sera le layout principal.
+ Scene scene = new Scene(root);
+
+ // On configure la scène à afficher.
+ stage.setScene(scene);
+
+ // Cette méthode définie plus bas va configurer tous les éléments qui
+ // doivent réagir à certains évènements. Par exemple, que faire quand
+ // on clique sur un bouton.
+ this.confHandlers(stage);
+
+ // On configure le titre de la fenêtre
+ stage.setTitle("Ma fenêtre");
+
+ // En général, c'est la dernière instruction de start. On dit à javafx
+ // d'afficher la fenêtre (sinon elle ne sera pas visible).
+ stage.show();
+ }
+
+ private void confHandlers(Stage stage) {
+ // Dans une interface graphique, on utilise de la programmation
+ // évènementielle. C'est à dire qu'on va exécuter certaines fonctions
+ // quand un évènement particulier se produit. Par exemple, cliquer sur
+ // un bouton. Le code à exécuter est donné par un objet appelé le
+ // "handler". Une sous-classe de EventHandler pour JavaFX.
+ // Ci-dessous, on crée une classe anonyme qui sera sous-classe de
+ // EventHandler pour les KeyEvent (pour le clavier). Sa méthode handle
+ // va faire monter ou descendre la forme du canvas selon la touche
+ // enfoncée. La syntaxe veut juste dire qu'on ne gère que
+ // les KeyEvent. Donc que les touches du clavier et pas, par exemple,
+ // la souris.
+ EventHandler keyhandler = new EventHandler() {
+ public void handle(KeyEvent evt) {
+ // Le code est celui de la touche utilisée. Ceux-ci sont
+ // contenus dans la classe KeyCode. KeyCode.UP est le code pour
+ // la flèche du haut.
+ KeyCode code = evt.getCode();
+ if (code == KeyCode.UP) {
+ // Si on a appuyé sur la flèche du haut, on fait monter la
+ // forme dans le canvas.
+ canvas.up();
+ } else if (code == KeyCode.DOWN) {
+ canvas.down();
+ }
+ }
+ };
+ // On ajoute le handler à la fenêtre. On précise bien qu'on ne
+ // s'intéresse que aux évènements KEY_PRESSED qui correspondent à une
+ // touche qui a été enfoncée. Par opposition, KEY_RELEASED correspond à
+ // une touche qui a été relachée.
+ stage.addEventFilter(KeyEvent.KEY_PRESSED, keyhandler);
+
+ // Les handlers peuvent aussi être donnés via une expression lambda. La
+ // fonction doit prendre un évèment en paramètre. Comme ici, up est un
+ // bouton, les détails de l'évènement ne nous intéresse pas car il
+ // s'agit juste d'un clic sur le bouton.
+ //this.up.setOnAction(evt -> this.canvas.up());
+ this.up.setOnAction(evt -> this.canvas.up());
+ this.down.setOnAction(evt -> this.canvas.down());
+
+ // On remarque ici qu'on prend une propriété (selectedProperty). Il
+ // s'agit d'un attribut particulier sur lequel on peut ajouter des
+ // handlers pour gérer les cas où la valeur change. Ici, la propriété
+ // "selected" indique si la checkbox est cochée ou pas.
+ // On ajoute un listener qui est une forme de handler qui gère les cas
+ // où des valeurs changent. On reçoit trois paramètres : l'objet
+ // lui-même (la checkbox), la valeur avant le changement et la valeur
+ // après. Avant et après sont des booléens ici (voir documentation de
+ // CheckBox).
+ this.drawSquare.selectedProperty().addListener(
+ (box, avant, apres) -> {
+ // On n'a pas besoin de la valeur précédente. Juste de la
+ // nouvelle valeur indiquant si la case est cochée (true)
+ // ou pas (false).
+ this.canvas.setDrawSquare(apres);
+ }
+ );
+ // Comme ci-dessus, on ajoute un handler pour mettre à jour la taille
+ // de la forme quand on change la valeur dans le TextField. Sans
+ // surprise, avant et apres sont des String.
+ this.size.textProperty().addListener(
+ (field, avant, apres) -> {
+ try {
+ this.canvas.setSize(Double.parseDouble(apres));
+ } catch (NumberFormatException e) {
+ // Ici, on ignore le problème.
+ // On pourrait afficher un message d'erreur dans une
+ // vraie application ou utiliser une pop-up.
+ }
+ }
+ );
+ this.increment.textProperty().addListener(
+ (observable, avant, apres) -> {
+ try {
+ this.canvas.setIncrement(Double.parseDouble(apres));
+ } catch (NumberFormatException e) {
+ }
+ }
+ );
+
+ // Pour activer ou désactiver le clignotement, on utilise un Timer. La
+ // checkbox blink va donc soit activer le timer toutes les 2 secondes,
+ // soit le désactiver selon qu'elle soit cochée ou pas.
+ this.blinkTimer = new Timer();
+ this.blink.selectedProperty().addListener(
+ (observable, avant, apres) -> {
+ if (!apres) {
+ // Si on vient de décocher blink, on arrête le timer et
+ // on en crée un nouveau qui ne sera pas lancé.
+ blinkTimer.cancel();
+ blinkTimer = new Timer();
+ } else {
+ // Si on vient de cocher blink, on lance le timer après
+ // 2 secondes (2000 ms) et à intervalles de 2 secondes.
+ blinkTimer.scheduleAtFixedRate(new BlinkingTask(canvas), 0, 2000);
+ }
+ }
+ );
+
+ // Dernier handler, si on ferme la fenêtre, on arrête le timer.
+ stage.setOnCloseRequest(evt -> this.blinkTimer.cancel());
+ }
+
+ private class BlinkingTask extends TimerTask {
+ private MonCanvas canvas;
+
+ public BlinkingTask(MonCanvas c) {
+ this.canvas = c;
+ }
+
+ public void run() {
+ this.canvas.toggleRed();
+ }
+ }
+}
diff --git a/q2/tp7/ExempleFX/src/main/java/exemplefx/MonCanvas.java b/q2/tp7/ExempleFX/src/main/java/exemplefx/MonCanvas.java
new file mode 100644
index 0000000..49c9eb4
--- /dev/null
+++ b/q2/tp7/ExempleFX/src/main/java/exemplefx/MonCanvas.java
@@ -0,0 +1,121 @@
+package exemplefx;
+
+import javafx.scene.canvas.Canvas;
+import javafx.scene.canvas.GraphicsContext;
+import javafx.scene.paint.Color;
+
+// Un canvas est un élément d'interface graphique qui permet de dessiner. Nous
+// créons ici notre propre canvas pour lui ajouter des fonctionnalités
+// spécifiques. On voudra pouvoir dessiner une forme spécifique à des un
+// endroit spécifique. Cette forme sera centrée en x mais pourra monter ou
+// descendre.
+public class MonCanvas extends Canvas {
+
+ // Coordonnée y de la forme.
+ private double y;
+ // Si drawSquare est vrai, on dessine un carré. Sinon, on dessine un
+ // cercle.
+ private boolean drawSquare;
+ // De combien de pixels ont va déplacer la forme dans les méthodes up et
+ // down.
+ private double increment;
+ // Rayon de la forme.
+ private double size;
+ // Si vrai, on dessine la forme en rouge. Sinon, en bleu.
+ private boolean red;
+
+ public MonCanvas(double width, double height) {
+ super(width, height);
+ // La fonction reset permet de tout remettre à zéro. Mais elle sert
+ // aussi à initialiser. On pourrait imaginer ajouter un bouton reset
+ // dans l'interface. Voyez-vous comment ?
+ reset();
+ }
+
+ public void reset() {
+ this.y = getHeight() / 2;
+ this.drawSquare = false;
+ this.increment = 10;
+ this.size = 100;
+ this.red = false;
+ // Quand on a tout initialisé, on dessine.
+ draw();
+ }
+
+ public void setIncrement(double inc) {
+ this.increment = inc;
+ }
+
+ public void setDrawSquare(boolean drawsq) {
+ this.drawSquare = drawsq;
+ // A chaque fois qu'on change un paramètre, on va redessiner la forme
+ // avec ces changements. On voit ici un exemple où les méthodes set
+ // sont importantes. Ce comportement de redessiner automatiquement ne
+ // serait pas possible si drawSquare était publique.
+ draw();
+ }
+
+ public void setSize(double s) {
+ this.size = s;
+ draw();
+ }
+
+ public void toggleRed() {
+ this.red = !red;
+ draw();
+ }
+
+ public void up() {
+ // Dans un canvas, l'axe y est inversé. Le point (0,0) est en haut à
+ // gauche va vers le bas. Le point en bas à droite sera donc (width,
+ // height) avec width et height la largeur et la hauteur du canvas
+ // respectivement. Pour dessiner la forme plus haut, on va donc
+ // diminuer la valeur y.
+ this.y -= this.increment;
+ draw();
+ }
+
+ public void down() {
+ this.y += this.increment;
+ draw();
+ }
+
+ // Cette méthode va dessiner la forme avec tous les paramètres.
+ private void draw() {
+ // On ne peut pas utiliser directement les attributs width et height de
+ // Canvas car elles sont privées et donc pas accessibles dans notre
+ // sous-classe. On doit donc utiliser getWidth et getHeight.
+ double width = this.getWidth();
+ double height = this.getHeight();
+ // xc est la coordonnée x correspondant au centre du canvas.
+ double xc = width / 2;
+ // Un GraphicsContext est un objet qui permet de dessiner sur un
+ // Canvas. Il possède beaucoup de méthodes spécifiques comme strokeLine
+ // pour dessiner une ligne.
+ GraphicsContext gc = this.getGraphicsContext2D();
+ // La méthode clearRect fonctionne comme une gomme. Il efface tous les
+ // dessins se trouvant à l'intérieur. Sans cela, les dessins
+ // précédents restent affichés. Essayez de commenter cette ligne pour
+ // voir ce que ça donne.
+ gc.clearRect(0, 0, width, height);
+ // On va dessiner un rectangle pour bien voir les limites du canvas.
+ // Vous verrez que sa taille reste constante.
+ gc.strokeRect(1, 1, width-2, height-2);
+ // Selon la valeur de red, on choisis la couleur à utiliser. La méthode
+ // setFill configure la couleur pour le remplissage (l'intérieur des
+ // formes). Pour choisir la couleur des lignes, on utilise setStroke.
+ if (red) {
+ gc.setFill(Color.RED);
+ } else {
+ gc.setFill(Color.BLUE);
+ }
+ // Si vrai, on dessine un carré. Pour cela, la méthode fillRect dessine
+ // un carré et le colore avec la couleur configurée ci-dessus. Sinon,
+ // on dessine un cercle avec fillOval.
+ if (this.drawSquare) {
+ gc.fillRect(xc-size, y-size, 2*size, 2*size);
+ } else {
+ gc.fillOval(xc-size, y-size, 2*size, 2*size);
+ }
+ }
+}
diff --git a/q2/tp7/TP7.pdf b/q2/tp7/TP7.pdf
new file mode 100644
index 0000000..7227d79
Binary files /dev/null and b/q2/tp7/TP7.pdf differ
diff --git a/q2/tp7/spirale/.gitattributes b/q2/tp7/spirale/.gitattributes
new file mode 100644
index 0000000..097f9f9
--- /dev/null
+++ b/q2/tp7/spirale/.gitattributes
@@ -0,0 +1,9 @@
+#
+# https://help.github.com/articles/dealing-with-line-endings/
+#
+# Linux start script should use lf
+/gradlew text eol=lf
+
+# These are Windows script files and should use crlf
+*.bat text eol=crlf
+
diff --git a/q2/tp7/spirale/.gitignore b/q2/tp7/spirale/.gitignore
new file mode 100644
index 0000000..1b6985c
--- /dev/null
+++ b/q2/tp7/spirale/.gitignore
@@ -0,0 +1,5 @@
+# Ignore Gradle project-specific cache directory
+.gradle
+
+# Ignore Gradle build output directory
+build
diff --git a/q2/tp7/spirale/.idea/.gitignore b/q2/tp7/spirale/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/q2/tp7/spirale/.idea/.gitignore
@@ -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
diff --git a/q2/tp7/spirale/.idea/.name b/q2/tp7/spirale/.idea/.name
new file mode 100644
index 0000000..459b05b
--- /dev/null
+++ b/q2/tp7/spirale/.idea/.name
@@ -0,0 +1 @@
+Spirale
\ No newline at end of file
diff --git a/q2/tp7/spirale/.idea/compiler.xml b/q2/tp7/spirale/.idea/compiler.xml
new file mode 100644
index 0000000..e58d3e4
--- /dev/null
+++ b/q2/tp7/spirale/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/q2/tp7/spirale/.idea/gradle.xml b/q2/tp7/spirale/.idea/gradle.xml
new file mode 100644
index 0000000..4979975
--- /dev/null
+++ b/q2/tp7/spirale/.idea/gradle.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/q2/tp7/spirale/.idea/jarRepositories.xml b/q2/tp7/spirale/.idea/jarRepositories.xml
new file mode 100644
index 0000000..fdc392f
--- /dev/null
+++ b/q2/tp7/spirale/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/q2/tp7/spirale/.idea/misc.xml b/q2/tp7/spirale/.idea/misc.xml
new file mode 100644
index 0000000..61e7e00
--- /dev/null
+++ b/q2/tp7/spirale/.idea/misc.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/q2/tp7/spirale/.idea/vcs.xml b/q2/tp7/spirale/.idea/vcs.xml
new file mode 100644
index 0000000..c2365ab
--- /dev/null
+++ b/q2/tp7/spirale/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/q2/tp7/spirale/.project b/q2/tp7/spirale/.project
new file mode 100644
index 0000000..ca9c7ac
--- /dev/null
+++ b/q2/tp7/spirale/.project
@@ -0,0 +1,17 @@
+
+
+ Spirale
+ Project Spirale created by Buildship.
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectbuilder
+
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectnature
+
+
diff --git a/q2/tp7/spirale/.settings/org.eclipse.buildship.core.prefs b/q2/tp7/spirale/.settings/org.eclipse.buildship.core.prefs
new file mode 100644
index 0000000..7b6d786
--- /dev/null
+++ b/q2/tp7/spirale/.settings/org.eclipse.buildship.core.prefs
@@ -0,0 +1,13 @@
+arguments=
+auto.sync=false
+build.scans.enabled=false
+connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
+connection.project.dir=app
+eclipse.preferences.version=1
+gradle.user.home=
+java.home=/usr/lib/jvm/java-19-openjdk
+jvm.arguments=
+offline.mode=false
+override.workspace.settings=true
+show.console.view=true
+show.executions.view=true
diff --git a/q2/tp7/spirale/app/.classpath b/q2/tp7/spirale/app/.classpath
new file mode 100644
index 0000000..cd32a54
--- /dev/null
+++ b/q2/tp7/spirale/app/.classpath
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/q2/tp7/spirale/app/.project b/q2/tp7/spirale/app/.project
new file mode 100644
index 0000000..ac485d7
--- /dev/null
+++ b/q2/tp7/spirale/app/.project
@@ -0,0 +1,23 @@
+
+
+ app
+ Project app created by Buildship.
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectbuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.buildship.core.gradleprojectnature
+
+
diff --git a/q2/tp7/spirale/app/.settings/org.eclipse.buildship.core.prefs b/q2/tp7/spirale/app/.settings/org.eclipse.buildship.core.prefs
new file mode 100644
index 0000000..e479558
--- /dev/null
+++ b/q2/tp7/spirale/app/.settings/org.eclipse.buildship.core.prefs
@@ -0,0 +1,13 @@
+arguments=
+auto.sync=false
+build.scans.enabled=false
+connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
+connection.project.dir=
+eclipse.preferences.version=1
+gradle.user.home=
+java.home=
+jvm.arguments=
+offline.mode=false
+override.workspace.settings=false
+show.console.view=false
+show.executions.view=false
diff --git a/q2/tp7/spirale/app/.settings/org.eclipse.jdt.core.prefs b/q2/tp7/spirale/app/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..55e9d5f
--- /dev/null
+++ b/q2/tp7/spirale/app/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=19
+org.eclipse.jdt.core.compiler.compliance=19
+org.eclipse.jdt.core.compiler.source=19
diff --git a/q2/tp7/spirale/app/build.gradle b/q2/tp7/spirale/app/build.gradle
new file mode 100644
index 0000000..16585b4
--- /dev/null
+++ b/q2/tp7/spirale/app/build.gradle
@@ -0,0 +1,41 @@
+/*
+ * This file was generated by the Gradle 'init' task.
+ *
+ * This generated file contains a sample Java application project to get you started.
+ * For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
+ * User Manual available at https://docs.gradle.org/8.0.2/userguide/building_java_projects.html
+ */
+
+plugins {
+ // Apply the application plugin to add support for building a CLI application in Java.
+ id 'application'
+ id 'org.openjfx.javafxplugin' version '0.0.13'
+}
+
+repositories {
+ // Use Maven Central for resolving dependencies.
+ mavenCentral()
+}
+
+dependencies {
+ // Use JUnit Jupiter for testing.
+ testImplementation 'org.junit.jupiter:junit-jupiter:5.9.1'
+
+ // This dependency is used by the application.
+ implementation 'com.google.guava:guava:31.1-jre'
+}
+
+application {
+ // Define the main class for the application.
+ mainClass = 'spirale.App'
+}
+
+javafx {
+ version = "20"
+ modules = [ 'javafx.controls' ]
+}
+
+tasks.named('test') {
+ // Use JUnit Platform for unit tests.
+ useJUnitPlatform()
+}
diff --git a/q2/tp7/spirale/app/src/main/java/spirale/App.java b/q2/tp7/spirale/app/src/main/java/spirale/App.java
new file mode 100644
index 0000000..b2a763c
--- /dev/null
+++ b/q2/tp7/spirale/app/src/main/java/spirale/App.java
@@ -0,0 +1,77 @@
+package spirale;
+
+import javafx.application.Application;
+import javafx.scene.*;
+import javafx.scene.layout.*;
+import javafx.scene.paint.*;
+import javafx.scene.control.*;
+import javafx.scene.canvas.*;
+import javafx.stage.Stage;
+import javafx.geometry.Pos;
+
+public class App extends Application {
+
+ private BorderPane root;
+ private Button next;
+ private HBox top;
+ private Generator gen;
+ private Canvas can;
+
+ @Override
+ public void start(Stage primaryStage){
+ final int[] last_pos_x = {400};
+ final int[] last_pos_y = { 400 };
+ final int[] last_pos_state = { 0 };
+ gen = new Fibonacci();
+ can = new Canvas(800,800);
+ GraphicsContext con = can.getGraphicsContext2D();
+ con.setFill(Color.BLUE);
+
+ root = new BorderPane();
+
+ top = new HBox();
+ next = new Button("Next");
+ next.setOnAction((x) -> {
+ int curr = gen.next();
+ System.out.println(curr);
+ int next_pos_x = last_pos_x[0], next_pos_y = last_pos_y[0];
+ switch (last_pos_state[0]) {
+ case 0:
+ next_pos_x = last_pos_x[0];
+ next_pos_y = last_pos_y[0] + curr;
+ break;
+ case 1:
+ next_pos_x = last_pos_x[0] + curr;
+ next_pos_y = last_pos_y[0];
+ break;
+ case 2:
+ next_pos_x = last_pos_x[0];
+ next_pos_y = last_pos_y[0] - curr;
+ break;
+ case 3:
+ next_pos_x = last_pos_x[0] - curr;
+ next_pos_y = last_pos_y[0];
+ break;
+ }
+ last_pos_state[0]++;
+ last_pos_state[0] = last_pos_state[0] % 4;
+ con.strokeLine(last_pos_x[0], last_pos_y[0], next_pos_x, next_pos_y);
+ last_pos_x[0] = next_pos_x;
+ last_pos_y[0] = next_pos_y;
+ });
+ top.getChildren().add(next);
+ top.setAlignment(Pos.CENTER);
+
+ root.setTop(top);
+ root.setCenter(can);
+
+ Scene scene = new Scene(root);
+ primaryStage.setScene(scene);
+ primaryStage.setTitle("Mon paneau");
+ primaryStage.show();
+ }
+
+ public static void main(String[] args) {
+ launch();
+ }
+}
diff --git a/q2/tp7/spirale/app/src/main/java/spirale/Fibonacci.java b/q2/tp7/spirale/app/src/main/java/spirale/Fibonacci.java
new file mode 100644
index 0000000..2847c72
--- /dev/null
+++ b/q2/tp7/spirale/app/src/main/java/spirale/Fibonacci.java
@@ -0,0 +1,15 @@
+package spirale;
+
+public class Fibonacci implements Generator{
+ private int last1 = 0, last2 = 0;
+
+ public int next(){
+ int tmp = last1 + last2;
+ if(tmp == 0){
+ tmp = 1;
+ }
+ last2 = last1;
+ last1 = tmp;
+ return tmp;
+ }
+}
diff --git a/q2/tp7/spirale/app/src/main/java/spirale/Generator.java b/q2/tp7/spirale/app/src/main/java/spirale/Generator.java
new file mode 100644
index 0000000..c9a64be
--- /dev/null
+++ b/q2/tp7/spirale/app/src/main/java/spirale/Generator.java
@@ -0,0 +1,5 @@
+package spirale;
+
+public interface Generator {
+ int next();
+}
diff --git a/q2/tp7/spirale/app/src/test/java/spirale/AppTest.java b/q2/tp7/spirale/app/src/test/java/spirale/AppTest.java
new file mode 100644
index 0000000..9e642e1
--- /dev/null
+++ b/q2/tp7/spirale/app/src/test/java/spirale/AppTest.java
@@ -0,0 +1,14 @@
+/*
+ * This Java source file was generated by the Gradle 'init' task.
+ */
+package spirale;
+
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
+
+class AppTest {
+ @Test void appHasAGreeting() {
+ App classUnderTest = new App();
+ assertNotNull(classUnderTest.getGreeting(), "app should have a greeting");
+ }
+}
diff --git a/q2/tp7/spirale/gradle/wrapper/gradle-wrapper.jar b/q2/tp7/spirale/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..ccebba7
Binary files /dev/null and b/q2/tp7/spirale/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/q2/tp7/spirale/gradle/wrapper/gradle-wrapper.properties b/q2/tp7/spirale/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..bdc9a83
--- /dev/null
+++ b/q2/tp7/spirale/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
+networkTimeout=10000
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/q2/tp7/spirale/gradlew b/q2/tp7/spirale/gradlew
new file mode 100755
index 0000000..79a61d4
--- /dev/null
+++ b/q2/tp7/spirale/gradlew
@@ -0,0 +1,244 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+# Collect all arguments for the java command;
+# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+# shell script including quotes and variable substitutions, so put them in
+# double quotes to make sure that they get re-expanded; and
+# * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/q2/tp7/spirale/gradlew.bat b/q2/tp7/spirale/gradlew.bat
new file mode 100644
index 0000000..93e3f59
--- /dev/null
+++ b/q2/tp7/spirale/gradlew.bat
@@ -0,0 +1,92 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/q2/tp7/spirale/settings.gradle b/q2/tp7/spirale/settings.gradle
new file mode 100644
index 0000000..9e7f1ab
--- /dev/null
+++ b/q2/tp7/spirale/settings.gradle
@@ -0,0 +1,11 @@
+/*
+ * This file was generated by the Gradle 'init' task.
+ *
+ * The settings file is used to specify which projects to include in your build.
+ *
+ * Detailed information about configuring a multi-project build in Gradle can be found
+ * in the user manual at https://docs.gradle.org/8.0.2/userguide/multi_project_builds.html
+ */
+
+rootProject.name = 'Spirale'
+include('app')