Пример #1
0
 /**
  * Sets the default menu item to the argument or removes the default emphasis when the argument is
  * <code>null</code>.
  *
  * @param item the default menu item or null
  * @exception IllegalArgumentException
  *     <ul>
  *       <li>ERROR_INVALID_ARGUMENT - if the menu item has been disposed
  *     </ul>
  *
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  *     </ul>
  */
 public void setDefaultItem(MenuItem item) {
   checkWidget();
   if (item != null) {
     if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
     if (item.parent != this) return;
     OS.QMenu_setDefaultAction(handle, item.handle);
   } else {
     OS.QMenu_setDefaultAction(handle, 0);
   }
 }
Пример #2
0
 void releaseChildren_pp(boolean destroy) {
   MenuItem[] items = getItems();
   for (int i = 0; i < items.length; i++) {
     MenuItem item = items[i];
     if (item != null && !item.isDisposed()) {
       item.release(false);
     }
   }
   super.releaseChildren_pp(destroy);
 }