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 { dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0' 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' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.22' compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.22'
runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:win" runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:win"

View file

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

View file

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

View file

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

View file

@ -45,6 +45,7 @@ public class ChangementPseudo {
@FXML @FXML
void retourMenu(ActionEvent event) { void retourMenu(ActionEvent event) {
System.out.println("Retour au menu principal");
Stage stage = (Stage) MenuButton.getScene().getWindow(); Stage stage = (Stage) MenuButton.getScene().getWindow();
Parent root = null; Parent root = null;
try { try {
@ -83,5 +84,6 @@ public class ChangementPseudo {
chatApp = ChatApp.getInstance(); chatApp = ChatApp.getInstance();
pseudonyme1.setText(chatApp.getMe().getPseudo()); pseudonyme1.setText(chatApp.getMe().getPseudo());
this.validationButton.setDefaultButton(true); 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 class Clavardage implements Initializable, PropertyChangeListener {
public Button plusButton;
@FXML // ResourceBundle that was given to the FXMLLoader @FXML // ResourceBundle that was given to the FXMLLoader
private ResourceBundle resources; private ResourceBundle resources;
@ -41,38 +42,32 @@ public class Clavardage implements Initializable, PropertyChangeListener {
private TextArea ChatText; // Value injected by FXMLLoader private TextArea ChatText; // Value injected by FXMLLoader
@FXML // fx:id="MenuButton" @FXML // fx:id="MenuButton"
private Button MenuButton; // Value injected by FXMLLoader
private Utilisateur u2; private Utilisateur u2;
private SessionClavardage session; private SessionClavardage session;
public int Clav = 3;
@FXML @FXML
void envoyerMessage(ActionEvent event) { void envoyerMessage(ActionEvent event) {
String msg = AEnvoyer.getText(); String msg = AEnvoyer.getText();
AEnvoyer.clear(); AEnvoyer.clear();
session.envoiMsg(msg); if(!msg.equals("")) {
msg= "Moi: "+msg+"\n"; session.envoiMsg(msg);
ChatText.appendText(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 @FXML // This method is called by the FXMLLoader when initialization is complete
void initialize() { void initialize() {
} }
public void printsalut(){
System.out.println("wesh");
}
public void setSession(SessionClavardage session) { public void setSession(SessionClavardage session) {
//this.printsalut();
this.session = session; this.session = session;
System.out.println("1");
this.session.addPropertyChangeListener(this); this.session.addPropertyChangeListener(this);
System.out.println("2");
this.u2=session.getU2(); this.u2=session.getU2();
System.out.println("3");
this.pseudonyme1.setText(u2.getPseudo()); this.pseudonyme1.setText(u2.getPseudo());
} }
@ -107,4 +102,7 @@ public class Clavardage implements Initializable, PropertyChangeListener {
EnvoyerButton.setDefaultButton(true); EnvoyerButton.setDefaultButton(true);
this.ChatText.setEditable(false); 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" /> <Button fx:id="EnvoyerButton" mnemonicParsing="false" onAction="#envoyerMessage" prefHeight="27.0" prefWidth="73.0" text="Envoyer" GridPane.columnIndex="1" GridPane.rowIndex="1" />
</children> </children>
</GridPane> </GridPane>
<GridPane> <GridPane prefHeight="34.0" prefWidth="345.0">
<columnConstraints> <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 hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Moi "> <Text fill="#b0c926" strokeType="OUTSIDE" strokeWidth="0.0" text="Chat avec : ">
<font> <font>
<Font size="19.0" /> <Font size="19.0" />
</font> </font>
</Text> </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>
<Font size="19.0" /> <Font size="19.0" />
</font> </font>
</Text> </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> </children>
</GridPane> </GridPane>
<TextArea fx:id="ChatText" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" /> <TextArea fx:id="ChatText" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1" />
@ -77,15 +83,7 @@
</GridPane> </GridPane>
</children> </children>
</HBox> </HBox>
<HBox alignment="BOTTOM_RIGHT" prefHeight="63.0" prefWidth="600.0" style="-fx-background-color: #3299a8;"> <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>
</children> </children>
</VBox> </VBox>
</children> </children>