diff --git a/chat/src/main/java/rtgre/chat/ChatApplication.java b/chat/src/main/java/rtgre/chat/ChatApplication.java index e17c67f..d825b9a 100644 --- a/chat/src/main/java/rtgre/chat/ChatApplication.java +++ b/chat/src/main/java/rtgre/chat/ChatApplication.java @@ -9,10 +9,7 @@ import javafx.stage.Stage; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.util.Locale; -import java.util.Objects; -import java.util.Properties; -import java.util.ResourceBundle; +import java.util.*; import java.util.logging.Level; import java.util.logging.LogManager; import java.util.logging.Logger; @@ -53,8 +50,6 @@ public class ChatApplication extends Application { if (!properties.getProperty("width").isEmpty() && !properties.getProperty("height").isEmpty()) { stage.setWidth(Double.parseDouble(properties.getProperty("width"))); stage.setHeight(Double.parseDouble(properties.getProperty("height"))); - - } if (properties.getProperty("posx").isEmpty() || properties.getProperty("height").isEmpty()) { stage.centerOnScreen(); @@ -77,7 +72,8 @@ public class ChatApplication extends Application { properties.setProperty("posx", String.valueOf(stage.getX())); properties.setProperty("posy", String.valueOf(stage.getY())); - + properties.setProperty("split1", String.valueOf(controller.senderSplitPane.getDividerPositions()[0])); + properties.setProperty("split2", String.valueOf(controller.exchangeSplitPane.getDividerPositions()[0])); LOGGER.finest(properties.toString()); properties.store(new FileOutputStream(getClass().getResource("config.properties").getPath()), null); } catch (IOException e) { diff --git a/chat/src/main/java/rtgre/chat/ChatController.java b/chat/src/main/java/rtgre/chat/ChatController.java index 2dee228..830772f 100644 --- a/chat/src/main/java/rtgre/chat/ChatController.java +++ b/chat/src/main/java/rtgre/chat/ChatController.java @@ -69,6 +69,7 @@ public class ChatController implements Initializable { public Label statusLabel; public Label dateTimeLabel; public Contact contact; + public SplitPane senderSplitPane; private ContactMap contactMap = new ContactMap(); private ObservableList contactObservableList = FXCollections.observableArrayList(); private ObservableList postsObservableList = FXCollections.observableArrayList(); @@ -101,6 +102,13 @@ public class ChatController implements Initializable { } hostComboBox.setValue(!properties.getProperty("lasthost").isEmpty() ? properties.getProperty("lasthost") : hostComboBox.getItems().get(0)); loginTextField.setText(!properties.getProperty("login").isEmpty() ? properties.getProperty("login") : ""); + if (!properties.getProperty("split2").isEmpty()) { + exchangeSplitPane.setDividerPositions(Double.parseDouble(properties.getProperty("split2"))); + } + if (!properties.getProperty("split1").isEmpty()) { + exchangeSplitPane.setDividerPositions(Double.parseDouble(properties.getProperty("split2"))); + } + } catch (IOException e) { LOGGER.warning("Impossible de charger le fichier de configuration! Configuration par défaut chargée"); System.out.println(e.getMessage()); diff --git a/chat/src/main/resources/rtgre/chat/chat-view.fxml b/chat/src/main/resources/rtgre/chat/chat-view.fxml index 5db502c..a9aeeb3 100644 --- a/chat/src/main/resources/rtgre/chat/chat-view.fxml +++ b/chat/src/main/resources/rtgre/chat/chat-view.fxml @@ -74,7 +74,7 @@ - +