Skip to content

Instantly share code, notes, and snippets.

@cfierbin
Created October 24, 2014 15:51
Show Gist options
  • Save cfierbin/f0102ce5e555cc3f349b to your computer and use it in GitHub Desktop.
Save cfierbin/f0102ce5e555cc3f349b to your computer and use it in GitHub Desktop.
public class Controller implements BidListener{
//Bid emulator
private static BidEmulator bidEmulator;
@FXML
TextArea simulatorConsole;
@FXML
private void handleStartSimulationButtonClicked(ActionEvent ae){
//Initialize bid emulator
bidEmulator = new BidEmulator();
//Register this class as a listener
bidEmulator.addListener(this);
//start bidding process emulation
Timer timer = new Timer();
timer.scheduleAtFixedRate(bidEmulator, 0, 100);
}
@Override
public void bidEvent(Bid bid) {
Platform.runLater(() -> simulatorConsole.setText(simulatorConsole.getText() +"Received a new bid!\n" ));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment