Two of my branchces are shown below. Now I was curious if there is a better way to do this. Each if structure seems to be very similar to the last one. Can anybody help me come up with something that would clean this up a bit?
} else if (e.getActionCommand().equals("add_product")) {
// if the user is not already on the addProduct form
// take them there
if (f instanceof addProduct == false) {
// only close this form if it is not another instance of this form
new addProduct().setVisible(true);
f.dispose();
}
} else if (e.getActionCommand().equals("edit_product")) {
// if the user is not already on the editProduct form
// take them there
if (f instanceof editProduct == false) {
new editProduct().setVisible(true);
f.dispose();
}
}
Thanks :)


Sign In
Create Account


Back to top










