Re: Make XUL application visible
sunitha <[email protected]> Wed, 18 Mar 2009 04:38:27 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.java |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <ec2cb348-1e86-4aa2-bf39-4aa18866f825__9138.35803880847$1237376539$gmane$org@s38g2000prg.googlegroups.com> |
On Mar 17, 9:43 am, [email protected] wrote: > Hi > > I am using Java XPCOM and xulrunner-1.8.0.4. Im trying to embed > xulrunner in Java, as I am sure many people are. I seem to be stuck, I > believe my Java code is starting xulrunner correctly, but I see no > visible window. Should the window be visible? > > The code: > // First, get the event queue service. This handles all event queues > in > // XPCOM. > nsIEventQueueService eventQueueServive = (nsIEventQueueService) > serviceManager > .getServiceByContractID("@mozilla.org/event-queue-service;1", > nsIEventQueueService.NS_IEVENTQUEUESERVICE_IID); > > // Next, we want to get the UI thread, since we want to open a > window. > // There is a static variable on the > // nsIEventQueueService that contains the id of the special UI event > // queue. > nsIEventQueue eventQueue = eventQueueServive > .getSpecialEventQueue(nsIEventQueueService.UI_THREAD_EVENT_QUEUE); > > // Now create a proxy for the proxy object manager. > nsIProxyObjectManager proxy = (nsIProxyObjectManager) > componentManager > .createInstanceByContractID("@mozilla.org/xpcomproxy;1", null, > nsIProxyObjectManager.NS_IPROXYOBJECTMANAGER_IID); > > // and use the proxy object manager to create a proxy for the > // nsIWindowWatcher instance we created above. > nsIWindowWatcher windowProxy = (nsIWindowWatcher) proxy > .getProxyForObject(eventQueue, > windowWatcher.NS_IWINDOWWATCHER_IID, windowWatcher, > nsIProxyObjectManager.INVOKE_SYNC); > > // now we use the proxy to call the method as usual. > nsIDOMWindow domWindow = windowProxy.openWindow(null, > "chrome://myapp/content/main.xul", "bob", "centerscreen", null); > > Cheers > Greg I think you are supposed to create nsIWindowCreator instance and then set that to window watcher using setWindowCreator(windowCreator) on window watcher before trying to open window.