Netbeans version of state pattern