Skip to content
Snippets Groups Projects
Commit c6727ad8 authored by NikolaBabic's avatar NikolaBabic
Browse files

Added demo thread

parent 27cb8e4f
No related branches found
No related tags found
2 merge requests!45Prototype to Master for Milestone 5,!44Demo
import javafx.application.Application;
import javafx.stage.Stage;
import model.Demo;
import model.OSInterface;
import ui.MainScreen;
......@@ -16,7 +17,9 @@ public class Main extends Application {
public static void main(String[] args) {
Thread thread = new Thread(OSInterface.getInstance());
Thread demoThread = new Thread(new Demo());
thread.start();
demoThread.start();
launch(args);
......
package model;
public class Demo implements Runnable {
int id = 0;
boolean stop = false;
public Demo() {
}
public void run() {
while (!stop) {
if (OSInterface.getInstance().wasPressed(id)) {
}
}
}
public void stop() {
stop = true;
}
}
......@@ -6,6 +6,7 @@ import javafx.scene.control.ComboBox;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import model.Hotkey;
import model.Modifier;
import model.OSInterface;
/**
......@@ -144,7 +145,7 @@ public class MainScreen extends Pane {
save.setStyle("-fx-background-color: #2c2f33; -fx-text-fill: white; -fx-font-size: 16; -fx-vertical-align: middle; " +
"-fx-pref-width: 100px; -fx-pref-height: 50px; -fx-text-align: center;");
save.setOnAction(e -> {
Hotkey newHotkey = new Hotkey(KBV.getKeyToBind(), id, KBV.getKeyAction());
Hotkey newHotkey = new Hotkey(KBV.getKeyToBind(), id, Modifier.NONE.val());
id ++;
boolean register = OSInterface.getInstance().registerHotkey(newHotkey);
primaryStage.setScene(mainScreenScene);
......
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