I have this progrom which is compiling and running.Only Iam tryin to understand how to change the action listener Next en previous such that,If i have 5 employees in record it when you reach the last employee in record the Next and previous buttons should be disabled.please advise
here is the action listener part of the code.
public Employee1(EmployeeDataSet employees)
{
this.numberOfEmployees = employees.getEmployeeCount();
this.employees = employees;
}
public void loadEmployeeInGUI(Employee e)
{
// set text field with name
Q1Field.setText(e.getName());
// set text field with title
Q2Field.setText(e.getName());
// set textfield with salary
Q3Field.setText(String.valueOf(e.getSalary()));
}
public void actionPerformed(ActionEvent x)
{
if (x.getSource() == Next)
{
index++;
if(index == this.numberOfEmployees) index=0;
Employee e = employees.getEmployeeAtIndex(index);
loadEmployeeInGUI(e);
}
}
if (x.getSource() == Previous) index--;
if (index ==-1) index = this.numberOfEmployees -1;
}