Skip to content

Commit a61b959

Browse files
authored
Merge pull request #67 from FHNW-IP5-IP6/DEV-lesson6
Dev lesson6
2 parents e18a30a + 5db08bf commit a61b959

File tree

80 files changed

+1871
-579
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1871
-579
lines changed

.idea/templateLanguages.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ Wenn IntelliJ geöffnet ist, kann über die Webseite [EduTools](https://plugins.
99
Das Plugin kann auch direkt in der IDE installiert werden. Dazu kann im Menu oben Links per File -> Settings -> Plugins das Plugin installiert werden, so wie hier aufgezeigt:
1010
![EduTools Plugin](/Edutools-Plugin.png)
1111

12+
Das Zweite Plugin, welches installiert werden muss, ist das folgende [Embedded Linux JVM Debugger for Raspberry PI](https://plugins.jetbrains.com/plugin/18849-embedded-linux-jvm-debugger-for-raspberry-pi):
13+
![Embedded Linux JVM Debugger for Raspberry PI](/Rasppi-JVM.png)
14+
1215
## Kurs starten von Kursdatei
1316
Auf dem Welcome Screen von IntelliJ kann, bei *My Courses* über die drei Punkte, die Kursdatei geöffnet werden.
1417

Rasppi-JVM.png

32.5 KB
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public class Main {
2+
public static void main(String[] args) {
3+
// Nothing to see here
4+
}
5+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
type: theory
2+
files:
3+
- name: src/Main.java
4+
visible: true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
id: 1815990962
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Task 2/7: Einleitung
2+
3+
## JavaFX Template
4+
Hier die [Theorie](https://pi4j.com/getting-started/javafx-mvc-template/) zum JavaFX-Template.
5+
6+
## 3 Templates
7+
Das JavaFx-Template besteht aus 3 verschiedenen Apps, sowie dem Verzeichnis für Komponenten.
8+
9+
### MultiControllerApp
10+
Die *MultiControllerApp* bietet die Möglichkeit mehrere Controller in der gleichen Applikation zu steuern. Sie stellt eine
11+
PUI und eine GUI Klasse zu Verfügung. Es können also gleichzeitig Hardwarebauteile und grafische Objekte umgesetzt werden.
12+
Die *MultiControllerApp* ist eine App, um aufzuzeigen, wie mit mehreren Controllern gearbeitet werden könnte.
13+
14+
### TemplateApp
15+
Die *TemplateApp* ist eine App, welche aus einem einzelnen Controller besteht und implementationen für ein GUI und ein PUI
16+
bereitstellt. Dieses Template sollte genutzt werden, wenn die Funktionalität der App klein ist, aber ein GUI für den
17+
Benutzer bereitgestellt wird, welches zum Beispiel durch die PUI-Komponenten gesteuert wird.
18+
19+
### TemplatePUIApp
20+
Die *TemplatePUIApp* ist, die vom Umfang her, kleinste App. Sie besteht aus einem einzelnen Controller und implementiert
21+
nur ein PUI. Die Applikation benötigt keien JavaFX Komponenten, sondern nur Hardware Bauteile. Die Visualisierung wird dabei
22+
ausschliesslich durch Hardwarekomponenten realisiert.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="EigenesProjekt-Projektstart" type="Application" factoryName="Application">
3+
<option name="ALTERNATIVE_JRE_PATH" value="17" />
4+
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
5+
<option name="MAIN_CLASS_NAME" value="Main" />
6+
<module name="pi4j-programming-tutorial.Tutorial-Eigenes_Projekt-Projektstart.main" />
7+
<method v="2">
8+
<option name="Make" enabled="true" />
9+
</method>
10+
</configuration>
11+
</component>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import java.util.Random;
2+
import java.util.Scanner;
3+
4+
public class Main {
5+
public static void main(String[] args) {
6+
// Generating a Random String, which Simon will say
7+
int leftLimit = 48; // numeral '0'
8+
int rightLimit = 122; // letter 'z'
9+
int targetStringLength = 4;
10+
Random random = new Random();
11+
12+
String simonPattern = random.ints(leftLimit, rightLimit + 1)
13+
.filter(i -> (i <= 57 || i >= 65) && (i <= 90 || i >= 97))
14+
.limit(targetStringLength)
15+
.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
16+
.toString();
17+
18+
// Printing the SimonPattern for 3 Seconds, so you need to memorize it
19+
System.out.println("The Pattern you need to match: " + simonPattern);
20+
try {
21+
Thread.sleep(3000);
22+
}catch (InterruptedException e){
23+
Thread.currentThread().interrupt();
24+
}
25+
26+
// Entering many lines, so in the console, the pattern is not visible anymore without scrolling
27+
for (int i = 0; i < 20; i++) {
28+
System.out.println("");
29+
}
30+
31+
// reading the input of the console
32+
System.out.print("Please give in the Pattern: ");
33+
Scanner sc = new Scanner(System.in);
34+
String userPattern = sc.nextLine();
35+
36+
// Calculating, how many Symbols were right
37+
int userScore = 0;
38+
39+
for(int i = 0; simonPattern.length() > i; i++){
40+
if (simonPattern.charAt(i) == userPattern.charAt(i)){
41+
userScore += 1;
42+
}else{
43+
break;
44+
}
45+
}
46+
47+
// Printing the score
48+
System.out.println("You had " + userScore + " symbols right of " + targetStringLength + ".");
49+
}
50+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
type: theory
2+
files:
3+
- name: src/Main.java
4+
visible: true
5+
- name: runConfigurations/EigenesProjekt-Projektstart.run.xml
6+
visible: true

0 commit comments

Comments
 (0)