Ejemplo n.º 1
0
 public SpeedPanel(final ApplicationEngine applicationEngine, final MessageSource messageSource) {
   this.applicationEngine = applicationEngine;
   speedSelector = createSpeedSelector();
   setupLayout(messageSource);
   applicationEngine.addListener(this, ApplicationEngineEvent.SPEED);
   setMaximumSize(getPreferredSize());
 }
Ejemplo n.º 2
0
 /** Convert non-linear mapping : engine to selector. */
 @Override
 public void propertyHasChanged() {
   speedSelector.setValue((int) Math.sqrt(applicationEngine.getSimulationSpeed()));
 }
Ejemplo n.º 3
0
 /** Convert non-linear mapping : selector to engine. */
 private void updateEngineSpeed() {
   applicationEngine.setSimulationSpeed((short) Math.pow(speedSelector.getValue(), 2));
 }