I have created a jcombbox when clicked it inserts information into the appropriate textfields, there is also a remove function so that when the remove button is pressed the information is removed from the array, but when I try and remove the last piece of information from the array it comes up with this message
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
i tried correcting the issue myself, but to no avail.
if (e.getSource() == RemoveMethod)
{
zclass.getMethods().getZMethod().remove(MethodSelect.getSelectedIndex());
MethodSelect.removeItemAt(MethodSelect.getSelectedIndex());
MethodName.setText("");
MethodReturnType.setText("");
MethodVisibility.setText("");
MethodParameters.setText("");
MethodAbstract.setSelected(false);
MethodStatic.setSelected(false);
}