Skip to content
Snippets Groups Projects
Commit 8b38f680 authored by Flori N's avatar Flori N
Browse files

Doku Threads, App, Main

parent 6859fbe9
No related branches found
No related tags found
1 merge request!92Master
......@@ -10,19 +10,24 @@ import java.io.IOException;
/**
* JavaFX App
* Startklasse fuer JavaFX Application, durch die Erweiterung um die Klasse Application.
* Baut die Benutzeroberflaeche in ihren Grundstrukturen auf.
*/
public class App extends Application {
/**
* TODO Dokumentieren
*
* scene : Scene : deklariert die Scene der GUI
*/
private static Scene scene;
/**
* TODO Dokumentieren
* setzt die fxml-Datei
*
* @param fxml
* @throws IOException
* @param fxml : String : Ort der fxml
* @throws IOException : wirft Exception, wenn die Datei nicht gefunden/geladen werden konnte
*/
static void setRoot(String fxml) throws IOException {
scene.setRoot(loadFXML(fxml));
......@@ -30,10 +35,11 @@ public class App extends Application {
/**
* TODO Dokumentieren
* laedt die fxml-Datei
*
* @param fxml
* @return
* @throws IOException
* @param fxml : String : Ort der fxml
* @return fxml wird geladen
* @throws IOException : wirft Exception, wenn die Datei nicht gefunden/geladen werden konnte
*/
private static Parent loadFXML(String fxml) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
......@@ -42,8 +48,9 @@ public class App extends Application {
/**
* TODO Dokumentieren
* Standard-main-Methode, die die erweiterte Klasse Application startet
*
* @param args
* @param args : String[] : Terminalparameter
*/
public static void main(String[] args) {
Application.launch();
......@@ -51,9 +58,10 @@ public class App extends Application {
/**
* TODO Dokumentieren
* Deklariert und initialisiert die Stage.
*
* @param stage
* @throws IOException
* @param stage : Stage : Aufbau der Stage in der Scene
* @throws IOException : wirft Exception, wenn die Datei nicht gefunden/geladen werden konnte
*/
@Override
public void start(Stage stage) throws IOException {
......
......@@ -10,9 +10,9 @@ public class Main {
public static void main(String[] args) throws SQLException {
Thread app = new Thread(new ThreadApp());
// Thread funk = new Thread(new ThreadFunkraum());
Thread funk = new Thread(new ThreadFunkraum());
app.start();
// funk.start();
funk.start();
}
}
......@@ -2,14 +2,18 @@ package projekt.enigma.threads;
import projekt.enigma.App;
import java.sql.SQLException;
/**
* Thread fuer die Benutzeroberflaeche, wird durch das Interface Runnable erweitert
*/
public class ThreadApp implements Runnable {
private String[] args;
/**
* Ueberschriebene Funktion - fuehrt die Klasse App aus
*/
@Override
public void run() {
System.out.println("ThreadApp" + Thread.currentThread());
System.out.println("ThreadApp " + Thread.currentThread());
App app = new App();
app.main(args);
......
package projekt.enigma.threads;
import org.apache.http.HttpException;
import projekt.enigma.model.Codierer;
import projekt.enigma.model.Funkraum;
import java.io.IOException;
/**
* Thread fuer den Funkraum, wird durch das Interface Runnable erweitert
*/
public class ThreadFunkraum implements Runnable {
String kenngruppe = new Codierer().getKenngruppe();
// String funkspruch;
/**
* Ueberschriebene Funktion - fuehrt die Klasse Funkraum aus und startet
*/
@Override
public void run() {
Funkraum funkraum = new Funkraum();
System.out.println("Threadfunkraum" + Thread.currentThread());
System.out.println("Threadfunkraum" + Thread.currentThread());
funkraum.empfangeFunkspruch(kenngruppe);
// try {
// funkraum.sendeFunkspruch(funkspruch, kenngruppe);
// } catch (HttpException he) {
// System.err.println("Error");
// } catch (IOException io) {
// System.err.println("Error");
// }
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment