示例#1
0
 void onMnemonic(TraverseEvent event) {
   char mnemonic = _findMnemonic(text);
   if (mnemonic == '\0') return;
   if (Character.toLowerCase(event.character) != mnemonic) return;
   Composite control = this.getParent();
   while (control != null) {
     Control[] children = control.getChildren();
     int index = 0;
     while (index < children.length) {
       if (children[index] == this) break;
       index++;
     }
     index++;
     if (index < children.length) {
       if (children[index].setFocus()) {
         event.doit = true;
         event.detail = SWT.TRAVERSE_NONE;
       }
     }
     control = control.getParent();
   }
 }
示例#2
0
 @Override
 public void keyTraversed(TraverseEvent e) {
   if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
     e.doit = false;
   }
 }