Beispiel #1
0
 // NOTE: This method is called by privileged threads.
 //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 public void action(final long when, final int modifiers) {
   MToolkit.executeOnEventHandlerThread(
       target,
       new Runnable() {
         public void run() {
           postEvent(
               new ActionEvent(
                   target,
                   ActionEvent.ACTION_PERFORMED,
                   ((TextField) target).getText(),
                   when,
                   modifiers));
         }
       });
 }
 // NOTE: This method is called by privileged threads.
 //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 void action(final int index) {
   final Choice c = (Choice) target;
   inUpCall = false; /* Used to prevent native selection. */
   MToolkit.executeOnEventHandlerThread(
       c,
       new Runnable() {
         public void run() {
           if (c.getItemCount() == 0) {
             /* Nothing to do when the list is empty. */
             return;
           }
           inUpCall = true; /* Prevent native selection. */
           c.select(index); /* set value in target */
           notifySelection(index);
           inUpCall = false;
         }
       });
 }
 // NOTE: This method is called by privileged threads.
 //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 void action(final int index) {
   final Choice c = (Choice) target;
   inUpCall = false; /* Used to prevent native selection. */
   MToolkit.executeOnEventHandlerThread(
       c,
       new Runnable() {
         public void run() {
           String item;
           synchronized (c) {
             if (index >= c.getItemCount()) {
               /* Nothing to do when the list is too short */
               return;
             }
             inUpCall = true; /* Prevent native selection. */
             c.select(index); /* set value in target */
             item = c.getItem(index);
             inUpCall = false;
           }
           notifySelection(item);
         }
       });
 }