Bouton pour choix de type de connexion
This commit is contained in:
parent
6fb2e95c05
commit
4e188d0258
4 changed files with 57 additions and 39 deletions
|
@ -1 +0,0 @@
|
|||
/chatapp/
|
|
@ -1,12 +1,12 @@
|
|||
chatapp/Launcher.java
|
||||
chatapp.Launcher
|
||||
chatapp/View/ConnexionScreen.java
|
||||
chatapp.View.ConnexionScreen
|
||||
chatapp/View/Clavardage.java
|
||||
chatapp.View.Clavardage
|
||||
chatapp.View.Clavardage$1
|
||||
chatapp/View/DemarrerSession.java
|
||||
chatapp.View.DemarrerSession
|
||||
chatapp/View/FenetreSession.java
|
||||
chatapp.View.FenetreSession
|
||||
chatapp.View.FenetreSession$1
|
||||
chatapp/Protocol/RunnerEcouteUDP.java
|
||||
chatapp.Protocol.RunnerEcouteUDP
|
||||
chatapp/Model/Utilisateur.java
|
||||
chatapp.Model.Utilisateur
|
||||
chatapp/View/View_Utilisateurs.java
|
||||
|
@ -28,12 +28,12 @@ chatapp/Controller/ChatApp.java
|
|||
chatapp.Controller.ChatApp
|
||||
chatapp/Main.java
|
||||
chatapp.Main
|
||||
chatapp/View/Clavardage.java
|
||||
chatapp.View.Clavardage
|
||||
chatapp.View.Clavardage$1
|
||||
chatapp/Protocol/SessionClavardage.java
|
||||
chatapp.Protocol.SessionClavardage
|
||||
chatapp/Model/DataBase.java
|
||||
chatapp.Model.DataBase
|
||||
chatapp/Protocol/RunnerEcouteUDP.java
|
||||
chatapp.Protocol.RunnerEcouteUDP
|
||||
chatapp/Protocol/SessionClavardage.java
|
||||
chatapp.Protocol.SessionClavardage
|
||||
chatapp/View/FenetreSession.java
|
||||
chatapp.View.FenetreSession
|
||||
chatapp.View.FenetreSession$1
|
||||
chatapp/View/ConnexionScreen.java
|
||||
chatapp.View.ConnexionScreen
|
||||
|
|
|
@ -13,6 +13,7 @@ import javafx.scene.Parent;
|
|||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
|
@ -21,6 +22,8 @@ public class ConnexionScreen {
|
|||
public Button connexionButton;
|
||||
|
||||
public TextField pseudonyme;
|
||||
public RadioButton remoteButton;
|
||||
public RadioButton localButton;
|
||||
|
||||
@FXML // ResourceBundle that was given to the FXMLLoader
|
||||
private ResourceBundle resources;
|
||||
|
@ -41,20 +44,20 @@ public class ConnexionScreen {
|
|||
*/
|
||||
public void connexion(ActionEvent actionEvent) {
|
||||
Boolean connexion = false;
|
||||
if(this.localButton.isSelected()) {
|
||||
try {
|
||||
connexion = ChatApp.getInstance().connexion(pseudonyme.getText());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(!connexion){
|
||||
if (!connexion) {
|
||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||
alert.setTitle("Connexion");
|
||||
// Header Text: null
|
||||
alert.setHeaderText(null);
|
||||
alert.setContentText("Echec de Connexion: le pseudo "+pseudonyme.getText()+" est deja pris");
|
||||
alert.setContentText("Echec de Connexion: le pseudo " + pseudonyme.getText() + " est deja pris");
|
||||
alert.showAndWait();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
Stage stage = (Stage) connexionButton.getScene().getWindow();
|
||||
Parent root = null;
|
||||
try {
|
||||
|
@ -67,4 +70,8 @@ public class ConnexionScreen {
|
|||
stage.show();
|
||||
}
|
||||
}
|
||||
else{
|
||||
// PARTIE CONNEXION DISTANTE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.RadioButton?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.control.ToggleGroup?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
|
@ -24,24 +26,34 @@
|
|||
</Text>
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
|
||||
<HBox alignment="CENTER" prefHeight="304.0" prefWidth="598.0" style="-fx-background-color: #3299a8;">
|
||||
<children>
|
||||
<GridPane alignment="CENTER" prefHeight="302.0" prefWidth="279.0">
|
||||
<GridPane alignment="CENTER" prefHeight="275.0" prefWidth="448.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="254.19998168945312" minHeight="10.0" prefHeight="123.19998779296876" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="107.20001220703125" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="254.19998168945312" minHeight="10.0" prefHeight="111.80001831054688" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="69.39998168945314" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="33.60002441406249" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="27.400000000000034" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="217.80000152587894" minHeight="10.0" prefHeight="79.39999999999998" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<TextField fx:id="pseudonyme" prefHeight="26.0" prefWidth="447.0" promptText="Pseudonyme" GridPane.columnSpan="2" />
|
||||
<Button fx:id="connexionButton" alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#connexion" prefHeight="38.0" prefWidth="287.0" style="-fx-background-color: #b0c926;" text="Connexion" textFill="#3299a8" GridPane.columnSpan="2" GridPane.rowIndex="1">
|
||||
<TextField fx:id="pseudonyme" prefHeight="26.0" prefWidth="447.0" promptText="Pseudonyme" GridPane.columnSpan="3" />
|
||||
<Button fx:id="connexionButton" alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#connexion" prefHeight="38.0" prefWidth="453.0" style="-fx-background-color: #b0c926;" text="Connexion" textFill="#3299a8" GridPane.columnSpan="3" GridPane.rowIndex="1">
|
||||
<font>
|
||||
<Font name="OCR A Extended" size="27.0" />
|
||||
</font>
|
||||
</Button>
|
||||
<RadioButton fx:id="remoteButton" mnemonicParsing="false" selected="true" text="Connexion distante" GridPane.columnIndex="1" GridPane.rowIndex="3">
|
||||
<toggleGroup>
|
||||
<ToggleGroup fx:id="lieu" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="localButton" mnemonicParsing="false" text="Connexion locale" toggleGroup="$lieu" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
|
|
Loading…
Reference in a new issue