In this exercise, you will program the My Company Directory application to delete an employee record.
To program the Delete button to be enabled or disabled, add a listener to the table that enables the button when a row is selected.
Add an actionPerformed event to the Delete button, and program the event to open the Confirm Delete dialog box.
Bind the text field in the Confirm Delete dialog box to display the first name of the employee to be deleted.
Bind the Yes button to call the removeEmployee(java.lang.Integer) method on the Web service.
In this step you add an event to the Yes button's binder (not the Yes button itself). You want the Confirm Delete dialog box to close after the employee is removed, which means after the binder has successfully called the service on the data source.
removeEmployeeAction.addActionBinderListener(new jve.generated.IActionBinder.ActionBinderListener() { public void afterActionPerformed(jve.generated.IActionBinder.ActionBinderEvent e) { getConfirmDialog().setVisible(false); } public void beforeActionPerformed(jve.generated.IActionBinder.ActionBinderEvent e) {} });
This event code hides the Confirm Delete dialog box after the binder's action is performed.