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