Nouvelle interface graphique

This commit is contained in:
Nabzzz 2020-12-28 00:00:49 +01:00
parent 5d3daf66aa
commit 338e52671e
7 changed files with 34 additions and 33 deletions

View file

@ -22,6 +22,7 @@ javafx {
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.22'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.22'
runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:win"

View file

@ -15,8 +15,8 @@ chatapp/View/FenetreSession.java
chatapp.View.FenetreSession$1
chatapp/Controller/ChatApp.java
chatapp.Controller.ChatApp
chatapp/View/ChangementPseudo.java
chatapp.View.ChangementPseudo
chatapp/View/DemarrerSession.java
chatapp.View.DemarrerSession
chatapp/Protocol/RunnerEcouteUDP.java
chatapp.Protocol.RunnerEcouteUDP
chatapp/Protocol/UDPEchange.java
@ -35,5 +35,5 @@ chatapp/View/View_Utilisateurs.java
chatapp.View.View_Utilisateurs
chatapp/View/View_Menu.java
chatapp.View.View_Menu
chatapp/View/DemarrerSession.java
chatapp.View.DemarrerSession
chatapp/View/ChangementPseudo.java
chatapp.View.ChangementPseudo

View file

@ -7,6 +7,8 @@ import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
public class Main extends Application {
ChatApp chatapp;

View file

@ -62,7 +62,7 @@ public class SessionClavardage extends Thread {
}
this.derniersMsg = new ArrayList<MessageHorodate>();
this.pcs = new PropertyChangeSupport(this);
//db.CreationTableHistorique("Doudou","Marvel");
db.CreationTableHistorique("Doudou","Marvel");
this.start();
Platform.runLater( () ->
new FenetreSession(this)

View file

@ -45,6 +45,7 @@ public class ChangementPseudo {
@FXML
void retourMenu(ActionEvent event) {
System.out.println("Retour au menu principal");
Stage stage = (Stage) MenuButton.getScene().getWindow();
Parent root = null;
try {
@ -83,5 +84,6 @@ public class ChangementPseudo {
chatApp = ChatApp.getInstance();
pseudonyme1.setText(chatApp.getMe().getPseudo());
this.validationButton.setDefaultButton(true);
//System.out.println(this.validationButton.isDefaultButton());
}
}

View file

@ -22,6 +22,7 @@ import javafx.stage.Stage;
public class Clavardage implements Initializable, PropertyChangeListener {
public Button plusButton;
@FXML // ResourceBundle that was given to the FXMLLoader
private ResourceBundle resources;
@ -41,38 +42,32 @@ public class Clavardage implements Initializable, PropertyChangeListener {
private TextArea ChatText; // Value injected by FXMLLoader
@FXML // fx:id="MenuButton"
private Button MenuButton; // Value injected by FXMLLoader
private Utilisateur u2;
private SessionClavardage session;
public int Clav = 3;
@FXML
void envoyerMessage(ActionEvent event) {
String msg = AEnvoyer.getText();
AEnvoyer.clear();
if(!msg.equals("")) {
session.envoiMsg(msg);
msg = "Moi: " + msg + "\n";
ChatText.appendText(msg);
}
@FXML
void retourMenu(ActionEvent event) {
}
@FXML // This method is called by the FXMLLoader when initialization is complete
void initialize() {
}
public void printsalut(){
System.out.println("wesh");
}
public void setSession(SessionClavardage session) {
//this.printsalut();
this.session = session;
System.out.println("1");
this.session.addPropertyChangeListener(this);
System.out.println("2");
this.u2=session.getU2();
System.out.println("3");
this.pseudonyme1.setText(u2.getPseudo());
}
@ -107,4 +102,7 @@ public class Clavardage implements Initializable, PropertyChangeListener {
EnvoyerButton.setDefaultButton(true);
this.ChatText.setEditable(false);
}
public void ajouterMessagesHistorique(ActionEvent actionEvent) {
}
}

View file

@ -51,25 +51,31 @@
<Button fx:id="EnvoyerButton" mnemonicParsing="false" onAction="#envoyerMessage" prefHeight="27.0" prefWidth="73.0" text="Envoyer" GridPane.columnIndex="1" GridPane.rowIndex="1" />
</children>
</GridPane>
<GridPane>
<GridPane prefHeight="34.0" prefWidth="345.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Moi ">
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Chat avec : ">
<font>
<Font size="19.0" />
</font>
</Text>
<Text fx:id="pseudonyme1" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Pseudo" textAlignment="RIGHT" wrappingWidth="201.16357421875" GridPane.columnIndex="1">
<Text fx:id="pseudonyme1" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Pseudo" textAlignment="CENTER" wrappingWidth="133.16357421875" GridPane.columnIndex="1">
<font>
<Font size="19.0" />
</font>
</Text>
<Button fx:id="plusButton" mnemonicParsing="false" onAction="#ajouterMessagesHistorique" style="-fx-background-color: #b0c926;" text="+" textAlignment="RIGHT" textFill="WHITE" GridPane.columnIndex="2">
<font>
<Font name="OCR A Extended" size="16.0" />
</font>
</Button>
</children>
</GridPane>
<TextArea fx:id="ChatText" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" />
@ -77,15 +83,7 @@
</GridPane>
</children>
</HBox>
<HBox alignment="BOTTOM_RIGHT" prefHeight="63.0" prefWidth="600.0" style="-fx-background-color: #3299a8;">
<children>
<Button fx:id="MenuButton" alignment="CENTER" mnemonicParsing="false" onAction="#retourMenu" style="-fx-background-color: #b0c926;" text="Retour au menu" textFill="WHITE">
<font>
<Font name="OCR A Extended" size="18.0" />
</font>
</Button>
</children>
</HBox>
<HBox alignment="BOTTOM_RIGHT" prefHeight="63.0" prefWidth="600.0" style="-fx-background-color: #3299a8;" />
</children>
</VBox>
</children>