Пример #1
0
 @EventHandler
 protected void onEvent(final KyPressedEvent event) {
   if (event.getCode() == KeyCode.ESCAPE) {
     final Display<?> disp = event.getDisplay();
     if (disp != null) {
       if (disp == display) userHasQuit = true;
     } else { // disp == null : event from application bar
       if (imgDispService.getActiveImageDisplay() == display) {
         userHasQuit = true;
       }
     }
   }
 }
Пример #2
0
 @Override
 public void onKeyDown(final KyPressedEvent evt) {
   if (evt.getCode() == CODE[index]) {
     index++;
     if (index > CODE.length - 2) evt.consume();
     if (index == CODE.length) {
       index = 0;
       final ThreadService threadService = getContext().getService(ThreadService.class);
       threadService.run(this);
       final CommandService commandService = getContext().getService(CommandService.class);
       commandService.run(COMMAND);
     }
   } else index = 0;
 }
Пример #3
0
 /** Stops animation if ESC key is pressed. */
 @EventHandler
 protected void onEvent(final KyPressedEvent event) {
   final ImageDisplay imageDisplay = toImageDisplay(event.getDisplay());
   if (imageDisplay == null) return;
   if (event.getCode() == KeyCode.ESCAPE) stop(imageDisplay);
 }