hey there programers,
I am making a very simple graphical booking system and im facing a problem with the hashmap.
So what im trying to do is that the user enters some information at textboxes and i save them in a hashmap.
The problem is that when i print that hashmap at the end of the program it only shows me the last entry of the user and not the previous ones.
Here is the code. [the code is a bit rough atm , maybe is a litle hard to read]
these are the parts of the code that have to do with my problem.
b18 is the button that the user press when he has placed his information.
for any further info, let me know.
Thanks in advance fellas.
I am making a very simple graphical booking system and im facing a problem with the hashmap.
So what im trying to do is that the user enters some information at textboxes and i save them in a hashmap.
The problem is that when i print that hashmap at the end of the program it only shows me the last entry of the user and not the previous ones.
Here is the code. [the code is a bit rough atm , maybe is a litle hard to read]
Code
public class GUI extends Application {
static HashMap<String, String> RoomsMap = new HashMap(); //dimiourgia hashmap wste na peraso mesa oles tis kratiseis
TextField textField1 = new TextField ();
TextField textField2 = new TextField ();
TextField textField3 = new TextField ();
TextField textField4 = new TextField ();
TextField textField5 = new TextField ();
void FillHashMapRooms() { //gemizei ta hashmap simfona me ta stoixeia p edose o xristis
RoomsMap.put("Eidos-Domatiou ",textField1.getText());
RoomsMap.put("Domatio-Name ",textField2.getText());
RoomsMap.put("Domatio-Code ",textField3.getText());
RoomsMap.put("Domatio-Price ",textField5.getText());
RoomsMap.put("Domatio-Date ", textField4.getText());
}
b18 = new Button();
b18.setText("CONFIRM & ADD");
b18.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
FillHashMapRooms();
window.setScene(s1);
}});these are the parts of the code that have to do with my problem.
b18 is the button that the user press when he has placed his information.
for any further info, let me know.
Thanks in advance fellas.


