title: How to create Javafx save, read information from text file and letting user to edit their information
body: <p>How to create JavaFx RegisterGUI save user information(Username,password,name,email,phone number,address) and load into UserProfile GUI that allow the user to edit their profile information after login with their username and password? Hope you guys can help me with the problems.</p>
  
  <p>UserGUI:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import javafx.scene.control.Button?&gt;
  &lt;?import javafx.scene.control.TextArea?&gt;
  &lt;?import javafx.scene.control.TextField?&gt;
  &lt;?import javafx.scene.image.ImageView?&gt;
  &lt;?import javafx.scene.layout.ColumnConstraints?&gt;
  &lt;?import javafx.scene.layout.GridPane?&gt;
  &lt;?import javafx.scene.layout.RowConstraints?&gt;
  &lt;?import javafx.scene.text.Text?&gt;
  
  &lt;GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.GUIButton"&gt;
    &lt;columnConstraints&gt;
        &lt;ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /&gt;
        &lt;ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /&gt;
        &lt;ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /&gt;
        &lt;ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /&gt;
      &lt;ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /&gt;
        &lt;ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /&gt;
    &lt;/columnConstraints&gt;
    &lt;rowConstraints&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
      &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
      &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
      &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
    &lt;/rowConstraints&gt;
     &lt;children&gt;
        &lt;Button id="btnEdit" fx:id="btnEdit" mnemonicParsing="false" onAction="#setOnAction" text="Edit Profile" GridPane.columnIndex="1" GridPane.rowIndex="9" /&gt;
        &lt;Button id="btnSave" fx:id="btnSave" mnemonicParsing="false" onAction="#setOnAction" prefHeight="26.0" prefWidth="73.0" text="Save" GridPane.columnIndex="2" GridPane.rowIndex="9" /&gt;
        &lt;Button id="btnCancel" fx:id="btnCancel" mnemonicParsing="false" onAction="#setOnAction" prefHeight="26.0" prefWidth="66.0" text="Cancel" GridPane.columnIndex="3" GridPane.rowIndex="9" /&gt;
        &lt;Text id="txtName" strokeType="OUTSIDE" strokeWidth="0.0" text="Name" GridPane.columnIndex="1" GridPane.rowIndex="1" /&gt;
        &lt;Text id="txtPhoneNumber" strokeType="OUTSIDE" strokeWidth="0.0" text="Phone Number" GridPane.columnIndex="1" GridPane.rowIndex="3" /&gt;
        &lt;Text id="txtEmail" strokeType="OUTSIDE" strokeWidth="0.0" text="Email" GridPane.columnIndex="1" GridPane.rowIndex="5" /&gt;
        &lt;Text id="txtAddress" strokeType="OUTSIDE" strokeWidth="0.0" text="Address" GridPane.columnIndex="1" GridPane.rowIndex="7" /&gt;
        &lt;TextField id="txtfName" onAction="#setOnAction" prefHeight="26.0" prefWidth="203.0" GridPane.columnIndex="2" GridPane.rowIndex="1" /&gt;
        &lt;TextField id="txtfPhoneNumber" onAction="#setOnAction" GridPane.columnIndex="2" GridPane.rowIndex="3" /&gt;
        &lt;TextField id="txtfEmail" onAction="#setOnAction" GridPane.columnIndex="2" GridPane.rowIndex="5" /&gt;
        &lt;TextArea id="txtaAddress" onDragDetected="#setOnAction" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="7" /&gt;
        &lt;ImageView id="imgUser" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="4" GridPane.rowIndex="2" /&gt;
     &lt;/children&gt;
  &lt;/GridPane&gt;
  </code></pre>
  
  <p>RegisterGUI :</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import javafx.scene.control.Button?&gt;
  &lt;?import javafx.scene.control.TextArea?&gt;
  &lt;?import javafx.scene.control.TextField?&gt;
  &lt;?import javafx.scene.layout.ColumnConstraints?&gt;
  &lt;?import javafx.scene.layout.GridPane?&gt;
  &lt;?import javafx.scene.layout.RowConstraints?&gt;
  &lt;?import javafx.scene.text.Text?&gt;
  
  &lt;GridPane id="RegisterGUI" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/10.0.1" fx:controller="application.RegisterButton"&gt;
    &lt;columnConstraints&gt;
        &lt;ColumnConstraints hgrow="SOMETIMES" maxWidth="193.5999755859375" minWidth="10.0" prefWidth="151.20003662109374" /&gt;
        &lt;ColumnConstraints hgrow="SOMETIMES" maxWidth="193.5999755859375" minWidth="10.0" prefWidth="151.20003662109374" /&gt;
        &lt;ColumnConstraints hgrow="SOMETIMES" maxWidth="447.9999633789063" minWidth="10.0" prefWidth="447.9999633789063" /&gt;
    &lt;/columnConstraints&gt;
    &lt;rowConstraints&gt;
      &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
      &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
      &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
        &lt;RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /&gt;
    &lt;/rowConstraints&gt;
     &lt;children&gt;
        &lt;Text strokeType="OUTSIDE" strokeWidth="0.0" text="Email" GridPane.columnIndex="1" GridPane.rowIndex="1" /&gt;
        &lt;Text strokeType="OUTSIDE" strokeWidth="0.0" text="Username" GridPane.columnIndex="1" GridPane.rowIndex="2" /&gt;
        &lt;Text strokeType="OUTSIDE" strokeWidth="0.0" text="Name" GridPane.columnIndex="1" GridPane.rowIndex="4" /&gt;
        &lt;Text strokeType="OUTSIDE" strokeWidth="0.0" text="IC Number" GridPane.columnIndex="1" GridPane.rowIndex="5" /&gt;
        &lt;Text strokeType="OUTSIDE" strokeWidth="0.0" text="Phone Number" GridPane.columnIndex="1" GridPane.rowIndex="6" /&gt;
        &lt;Text strokeType="OUTSIDE" strokeWidth="0.0" text="Address" GridPane.columnIndex="1" GridPane.rowIndex="7" /&gt;
        &lt;TextField id="txtfEmail" fx:id="txtfEmail" GridPane.columnIndex="2" GridPane.rowIndex="1" /&gt;
        &lt;TextField id="txtfUsername" fx:id="txtfUsername" GridPane.columnIndex="2" GridPane.rowIndex="2" /&gt;
        &lt;TextField id="txtfName" fx:id="txtfName" GridPane.columnIndex="2" GridPane.rowIndex="4" /&gt;
        &lt;TextField id="txtfIC" fx:id="txtfIC" GridPane.columnIndex="2" GridPane.rowIndex="5" /&gt;
        &lt;TextField id="txtfPhone" fx:id="txtfPhone" GridPane.columnIndex="2" GridPane.rowIndex="6" /&gt;
        &lt;TextArea id="txtaAddress" fx:id="txtaAddress" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="7" /&gt;
        &lt;Button id="btnRegister" fx:id="btnRegister" mnemonicParsing="false" onAction="#OnRegister" text="Register" GridPane.columnIndex="2" GridPane.rowIndex="9" /&gt;
        &lt;Button id="btnExit" fx:id="btnExit" mnemonicParsing="false" onAction="#OnExit" prefHeight="26.0" prefWidth="56.0" text="Exit" GridPane.columnIndex="1" GridPane.rowIndex="9" /&gt;
        &lt;Text strokeType="OUTSIDE" strokeWidth="0.0" text="Password" GridPane.columnIndex="1" GridPane.rowIndex="3" /&gt;
        &lt;TextField id="txtfPassword" fx:id="txtfPassword" GridPane.columnIndex="2" GridPane.rowIndex="3" /&gt;
     &lt;/children&gt;
  &lt;/GridPane&gt;
  </code></pre>