< prev index next >

src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java

Print this page




  81                     menuPeer = acc.getPeer(popup);
  82                 }
  83             } catch (Exception e) {
  84                 e.printStackTrace();
  85             }
  86         }
  87         return menuPeer;
  88     }
  89 
  90     private long createModel() {
  91         return nativeCreate();
  92     }
  93 
  94     private long getModel() {
  95         return ptr;
  96     }
  97 
  98     private native long nativeCreate();
  99 
 100     //invocation from the AWTTrayIcon.m
 101     public long getPopupMenuModel(){
 102         if(popup == null) {
 103             PopupMenu popupMenu = target.getPopupMenu();
 104             if (popupMenu != null) {
 105                 popup = popupMenu;










 106             } else {
 107                 return 0L;
 108             }
 109         }

 110         return checkAndCreatePopupPeer().getModel();
 111     }
 112 
 113     /**
 114      * We display tray icon message as a small dialog with OK button.
 115      * This is lame, but JDK 1.6 does basically the same. There is a new
 116      * kind of window in Lion, NSPopover, so perhaps it could be used it
 117      * to implement better looking notifications.
 118      */
 119     public void displayMessage(final String caption, final String text,
 120                                final String messageType) {
 121 
 122         if (SwingUtilities.isEventDispatchThread()) {
 123             displayMessageOnEDT(caption, text, messageType);
 124         } else {
 125             try {
 126                 SwingUtilities.invokeAndWait(new Runnable() {
 127                     public void run() {
 128                         displayMessageOnEDT(caption, text, messageType);
 129                     }




  81                     menuPeer = acc.getPeer(popup);
  82                 }
  83             } catch (Exception e) {
  84                 e.printStackTrace();
  85             }
  86         }
  87         return menuPeer;
  88     }
  89 
  90     private long createModel() {
  91         return nativeCreate();
  92     }
  93 
  94     private long getModel() {
  95         return ptr;
  96     }
  97 
  98     private native long nativeCreate();
  99 
 100     //invocation from the AWTTrayIcon.m
 101     public long getPopupMenuModel() {
 102         PopupMenu newPopup = target.getPopupMenu();
 103 
 104         if (popup == newPopup) {
 105             if (popup == null) {
 106                 return 0L;
 107             }
 108         } else {
 109             if (newPopup != null) {
 110                 if (popup != null) {
 111                     popup.removeNotify();
 112                     popup = newPopup;
 113                 } else {
 114                     popup = newPopup;
 115                 }
 116             } else {
 117                 return 0L;
 118             }
 119         }
 120 
 121         return checkAndCreatePopupPeer().getModel();
 122     }
 123 
 124     /**
 125      * We display tray icon message as a small dialog with OK button.
 126      * This is lame, but JDK 1.6 does basically the same. There is a new
 127      * kind of window in Lion, NSPopover, so perhaps it could be used it
 128      * to implement better looking notifications.
 129      */
 130     public void displayMessage(final String caption, final String text,
 131                                final String messageType) {
 132 
 133         if (SwingUtilities.isEventDispatchThread()) {
 134             displayMessageOnEDT(caption, text, messageType);
 135         } else {
 136             try {
 137                 SwingUtilities.invokeAndWait(new Runnable() {
 138                     public void run() {
 139                         displayMessageOnEDT(caption, text, messageType);
 140                     }


< prev index next >