< prev index next >

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

Print this page




  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                     }




  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 newPopup = target.getPopupMenu();
 104             if (popup != newPopup) {
 105                 if (newPopup != null) {
 106                     popup = newPopup;
 107                 } else {
 108                     return 0L;
 109                 }
 110             }
 111         } else {
 112             return 0L;
 113         }
 114 
 115         return checkAndCreatePopupPeer().getModel();
 116     }
 117 
 118     /**
 119      * We display tray icon message as a small dialog with OK button.
 120      * This is lame, but JDK 1.6 does basically the same. There is a new
 121      * kind of window in Lion, NSPopover, so perhaps it could be used it
 122      * to implement better looking notifications.
 123      */
 124     public void displayMessage(final String caption, final String text,
 125                                final String messageType) {
 126 
 127         if (SwingUtilities.isEventDispatchThread()) {
 128             displayMessageOnEDT(caption, text, messageType);
 129         } else {
 130             try {
 131                 SwingUtilities.invokeAndWait(new Runnable() {
 132                     public void run() {
 133                         displayMessageOnEDT(caption, text, messageType);
 134                     }


< prev index next >