// add listeners to all state changes
stateMachine.addTransitionListener(this);
// set the default image
ScanningState state = stateMachine.getState();
button.setImage(buttonImages[state.ordinal()]);
button.setText(buttonTexts[state.ordinal()]);
}
/**
* Called when scanning button is clicked