On Tue, 01 Mar 2005 07:09:16 -0500, Thomas DeWeese <[EMAIL PROTECTED]> wrote: > Glen Simmons wrote: > > OK, I guess I spoke too soon. I tried the code below in a Cocoa-Java > > app and it hangs. I checked with the debugger and it's hanging down in > > some Swing code that's trying to instantiate menus. This is a problem > > because there are already menus. > > The JSVGComponent does _not_ create menu's, the JSVGViewerFrame > (from the svgbrowser/squiggle application) does create menus but > you aren't using that. I would look carefully at the stack trace > that is creating menus to try and figure out who is trying to > create them.
Here's the stack trace when calling JSVGComponent.loadSVGDocument: JavaBug> bt 0: com.apple.mrj.application.SystemMenu.createAppleMenu() line -1 1: com.apple.mrj.application.SystemMenu.addAppleMenu() line 73 2: com.apple.buckyball.app.Application.setUpStandalone() line 72 3: com.apple.buckyball.app.Application.createStandalone() line 61 4: com.apple.mrj.internal.awt.publicpeers.VToolkit.<init>() line 281 5: java.lang.Class.newInstance0() line -1 6: java.lang.Class.newInstance() line 232 7: java.awt.Toolkit$2.run() line 519 8: java.security.AccessController.doPrivileged() line -1 9: java.awt.Toolkit.getDefaultToolkit() line 498 10: java.awt.Toolkit.getEventQueue() line 1145 11: java.awt.EventQueue.isDispatchThread() line 434 12: org.apache.batik.swing.svg.JSVGComponent$BridgeUserAgentWrapper.getXMLParserClassName() line -2 13: org.apache.batik.bridge.DocumentLoader.<init>() line -2 14: org.apache.batik.swing.svg.JSVGComponent$1.run() line -2 15: org.apache.batik.swing.svg.JSVGComponent.stopThenRun() line -2 16: org.apache.batik.swing.svg.JSVGComponent.loadSVGDocument() line -2 17: Controller.loadAction() line 85 It hangs here forever. Apparently the AWT implementation on Mac OS X does some odd things, b/c I don't know why java.awt.EventQueue.isDispatchThread() should lead to trying to add menus, but it does. > > So I tried to implement the basics of > > what JSVGComponent does in the loadSVGDocument() method: > > This code looks about right to me. > > > This starts to work b/c documentLoadingStarted() gets called, but > > that's as far as it gets. Also, an extra menu gets added to the > > menubar, so apparently some Swing code is still getting called. > > > > Anyone have any suggestions? > > I don't think it is Batik calling the Swing code. In fact > at the point you reach (document load) nothing having anything > to do with Java2D/AWT has been called by Batik, it's all just > XML Parsing and DOM Document construction. Not until you start > the GVT builder does it do anything real with AWT/Swing stuff. > > I strongly suspect the problem is somewhere else in your code. > Does your system use any custom DOM elements with our > DOMImplementation? No custom anything. And I would have to disagree that the problem is somewhere else in my code since the code that I pasted was pretty much all of the code in the app. From the above backtrace, I'm thinking it's a Mac AWT implementation / Batik interaction problem, but I'm not sure what to do about it. Thanks, Glen --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
