I have 2 Field Text in a BankAccount class, 1 for deposit, 1 to withdraw.
Both of the field text take only double values:
TextField depositInput = new TextField();
TextField withdrawInput = new TextField();
And 1 button to execute these field texts (can be both).
Button button = new Button("Execute");
The problem is I don't know how to tell Java which TextField has been executed. Since I want to display different messages when the user wants to either deposit or withdraw:
For example:
if(FieldText executed is deposit){
println("User deposits X amount");
double depositAmount = X;
}
if(FieldText executed is withdraw){
println("User withdraws X amount");
double withdrawAmount = -X;
}
I have tried:
if(FieldText == depositInput){
}
but Java shows me an error.