Skip to content
Snippets Groups Projects
Commit 93c45de6 authored by Salles Coralie's avatar Salles Coralie
Browse files

button interface bluetooth

parent 373ecec5
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@
<Font name="Trebuchet MS Bold" size="28.0" />
</font>
</Label>
<GridPane fx:id="accueil" style="-fx-background-color: white;" visible="false" GridPane.rowIndex="1">
<GridPane fx:id="accueil" style="-fx-background-color: white;" GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" minWidth="10.0" prefWidth="20.0" />
......@@ -119,7 +119,7 @@
<Insets bottom="10.0" left="10.0" right="10.0" />
</GridPane.margin>
</GridPane>
<GridPane fx:id="configuration" style="-fx-background-color: white;" GridPane.rowIndex="1">
<GridPane fx:id="configuration" style="-fx-background-color: white;" visible="false" GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
......@@ -161,7 +161,7 @@
<VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0" spacing="10.0" GridPane.halignment="CENTER" GridPane.rowIndex="3" GridPane.valignment="CENTER">
<children>
<Button fx:id="buttonBluetooth" mnemonicParsing="false" onAction="#clickActivationBluetooth" text="Activation bluetooth" />
<Label fx:id="activationMessage" />
<Label fx:id="activationMessage" text="Connection bluetooth désactivée" />
</children>
<GridPane.margin>
<Insets bottom="10.0" top="10.0" />
......
......@@ -68,22 +68,14 @@ public class FXMLVueController implements Initializable {
private Label activationMessage;
private boolean isConnected = false;
private BluetoothManager bluetoothManager;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
/**
BluetoothManager bluetoothManager = new BluetoothManager(this);
bluetoothManager.launch();
try {
bluetoothManager.startThread();
} catch (Exception ex) {
Logger.getLogger(FXMLVueController.class.getName()).log(Level.SEVERE, null, ex);
}
**/
bluetoothManager = new BluetoothManager(this);
//Put the gridPane Accueil visible
accueil.setVisible(true);
......@@ -151,6 +143,21 @@ public class FXMLVueController implements Initializable {
@FXML
private void clickActivationBluetooth(ActionEvent event) {
if(!this.isConnected){
isConnected = bluetoothManager.launch();
}
if(isConnected){
try {
bluetoothManager.startThread();
this.activationMessage.setText("Connection bluetooth activée");
this.buttonBluetooth.setDisable(true);
} catch (Exception ex) {
Logger.getLogger(FXMLVueController.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
public void update(BluetoothThread t){
......
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