You could have prevented your earlier troubles if you immediately had used the constants. The 1 was not the problem, that's the value of ItemEvent.SELECTED. Your fault was that you assumed ItemEvent.DESELECTED is 0, but it is not - it's 2. By using ItemEvent.DESELECTED from the start you probably would have encountered this new error sooner.
That error is easy to troubleshoot. Something on line 358 of class org.nit.StudentDatabase2 is null, inside the itemEvent method. If your last post contains the up-to-date code that would be either name or nametext. That would mean that you are trying to access them before they are initialized, possibly by adding the listener and then changing the state all while still initially constructing the user interface.