You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.4 KiB
69 lines
2.4 KiB
package launcher;
|
|
|
|
import javafx.application.Application;
|
|
import javafx.fxml.FXML;
|
|
import javafx.fxml.FXMLLoader;
|
|
import javafx.fxml.Initializable;
|
|
import javafx.scene.Group;
|
|
import javafx.scene.Parent;
|
|
import javafx.scene.Scene;
|
|
import javafx.scene.layout.BorderPane;
|
|
import javafx.scene.layout.StackPane;
|
|
import javafx.scene.text.Text;
|
|
import javafx.stage.Stage;
|
|
import model.Capteur;
|
|
import model.CapteurCPU;
|
|
import model.CapteurIntervalle;
|
|
import model.CapteurRealiste;
|
|
import view.CapteurView;
|
|
import view.ImageCtrlView;
|
|
import view.ThermostatView;
|
|
|
|
import java.io.IOException;
|
|
import java.net.URL;
|
|
import java.util.Random;
|
|
import java.util.ResourceBundle;
|
|
|
|
public class Launch extends Application {
|
|
public static void main(String[] args) {
|
|
launch(args);
|
|
}
|
|
|
|
@Override
|
|
public void start(Stage primaryStage) throws IOException, InterruptedException {
|
|
Capteur captorS = new Capteur(1,"Capteur Simple");
|
|
CapteurIntervalle captorI = new CapteurIntervalle(2,"Capteur Intervalle",0.0,10.0);
|
|
CapteurRealiste captorR = new CapteurRealiste(3,"Capteur Realiste", 5.0, 10.0);
|
|
CapteurCPU captorC = new CapteurCPU(4,"Capteur CPU");
|
|
|
|
// FXML NOT WORKING
|
|
/*Stage thermostatStage = new Stage();
|
|
CapteurView capteurView = new ImageCtrlView(captor,"view/Image.fxml","mon titre");
|
|
ThermostatView thermostatView = new ThermostatView(captor,"view/Thermostat.fxml","mon titre");
|
|
*/
|
|
//Random random = new Random();
|
|
|
|
Thread t = new Thread() {
|
|
public void run() {
|
|
while (true) {
|
|
captorS.genTemp();
|
|
captorI.genTemp();
|
|
captorR.genTemp();
|
|
captorC.genTemp();
|
|
try {
|
|
System.out.println(captorS.getNom() + ": " + captorS.getTemp().getValue() + " °C");
|
|
System.out.println(captorI.getNom() + ": " + captorI.getTemp().getValue() + " °C");
|
|
System.out.println(captorR.getNom() + ": " + captorR.getTemp().getValue() + " °C");
|
|
System.out.println(captorC.getNom() + ": " + captorC.getTemp().getValue() + " °C");
|
|
sleep(4000);
|
|
} catch (InterruptedException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
t.start();
|
|
}
|
|
}
|
|
|