909192939495969798
// 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()]); }