Пример #1
0
 public void keyTyped(java.awt.event.KeyEvent e) {
   if (e.getKeyChar() != java.awt.event.KeyEvent.CHAR_UNDEFINED
       && !e.isActionKey()
       && (e.getModifiers() & getToolkit().getMenuShortcutKeyMask()) == 0) {
     org.nlogo.window.ButtonWidget button = findActionButton(e.getKeyChar());
     if (button != null) {
       button.keyTriggered();
     }
   }
 }
Пример #2
0
 private void enableButtonKeys(boolean enabled) {
   java.awt.Component[] comps = getComponents();
   for (int i = 0; i < comps.length; i++) {
     if (comps[i] instanceof WidgetWrapper) {
       Widget widget = ((WidgetWrapper) comps[i]).widget();
       if (widget instanceof org.nlogo.window.ButtonWidget) {
         org.nlogo.window.ButtonWidget button = (org.nlogo.window.ButtonWidget) widget;
         button.keyEnabled(enabled);
       }
     }
   }
 }
Пример #3
0
 private org.nlogo.window.ButtonWidget findActionButton(char key) {
   java.awt.Component[] comps = getComponents();
   for (int i = 0; i < comps.length; i++) {
     if (comps[i] instanceof WidgetWrapper) {
       Widget widget = ((WidgetWrapper) comps[i]).widget();
       if (widget instanceof org.nlogo.window.ButtonWidget) {
         org.nlogo.window.ButtonWidget button = (org.nlogo.window.ButtonWidget) widget;
         if (Character.toUpperCase(button.actionKey()) == Character.toUpperCase(key)) {
           return button;
         }
       }
     }
   }
   return null;
 }
Пример #4
0
 @Override
 public boolean isFocusable() {
   java.awt.Component[] comps = getComponents();
   for (int i = 0; i < comps.length; i++) {
     if (comps[i] instanceof WidgetWrapper) {
       Widget widget = ((WidgetWrapper) comps[i]).widget();
       if (widget instanceof org.nlogo.window.ButtonWidget) {
         org.nlogo.window.ButtonWidget button = (org.nlogo.window.ButtonWidget) widget;
         if (button.actionKey() != '\0' && button.actionKey() != ' ') {
           return true;
         }
       }
     }
   }
   return false;
 }