I have 5-6 GUIs(seperate classes) one opens another according to their functionality, every GUI takes an object inside, I pass the final Object in a flight booking system like this to my GUI when a JButton "Book" is clicked from the seat selection menu in Book_GUI.java
Passenger_GUI frameP = new Passenger_GUI(eco.seats[x][z].getMyPassenger());
frameP.setVisible(true);
eco.seats[x][z].setBooked(true);
in Passenger_GUI.java I have:
private Passenger passenger_GUI;
later in Constructor without initializing passenger_GUI
I assign the input Passenger Object to it:
public Passenger_GUI(Passenger myPassenger) {
passenger_GUI = myPassenger;
Everything works no errors... I have 2 questions, do I have to initialize first passenger_GUI and then make the assigment or is it not necessary?
Second important question; the changes I make in the Passenger_GU to object myPassenger(eco.seats[x][z].myPassenger
), will they be saved in the previous GUI Book_GUI.java
I think not because the Passenger_GUI class does not have a return value... or am I wrong?How can I make the changes I apply on an Object stable and be used for the future in Book_GUI.java
?(previous GUI)
Thank you for your time!
Here full classes: http://www.copypastecode.com/643018/ http://www.copypastecode.com/643022/