Good evening!
I'm working on an assignment, and I'm not seeing what is wrong with my logic here. Any assistance would be greatly appreciated.
It's a basic appointment book, and if there is an appointment at the current time, I would like the "New Appointment" button disabled. However, if I press the "Next" button, it disables the button whether there is an appointment there or not.
Here is the actionPerformed:
if (e.getSource()==this.nextButton){ //If "Next" is pressed
appointments.next(); //go to next appt time
timeField.setText(appointments.getTime());//display the new time
nameField.setText(appointments.getName());//display the appointment
if (appointments.getName() == null){
newButton.setEnabled(true);
}else {
newButton.setEnabled(false);
}
}
And the function from the class I'm trying to call:
public String getName(){ //function gets the text for appointment
return text[position]; //pulling the text that corresponds with
}
Thank you in advance for pointing out my (likely silly and blatanly obvious) mistake.
- Jim