Hi! This project is awesome. I wonder if there is a neat way of adding a popup-menu (like setComponentPopupMenu) to a BrowserPanel?
Thanks for your all your work!
Have you tried overriding onContextMenu on the HtmlRendererContext? That lets you do per-element context as well, but presumably you could just hard-code it to show the same one for anywhere.
This problem is really driving me nuts. What I want to do is to detect right-clicks so that I can display a popup menu. I'm using BrowserPanel, and no matter what hacks I've tried I can't get ahold of whatever component is displayed in the panel.
I have no idea of how to access HtmlRendererContext, or how to inject it into a BrowserPanel. I would really like that, because it might solve other problems I have too.
BrowserPanel doesn't provide that capability right now. HtmlRendererContext is in Cobra, not Lobo.
I assume you've tried adding a MouseListener to BrowserPanel and that didn't work?
I'm not sure how to solve it, other than changing the source code. Context menues are of course a must-have to complete the browser.
I've read the source code, and through a hack that makes me blush I've managed to add a mouse listener to the browser.
One problem is that whenever new content is rendered, a new component is created and put in the BrowserPanel.
I don't know how to post code in this forum, but this is how I did it:
1. Added a NavigatorListener to my BrowserPanel and implemented documentRendering(evt).
2. From the event I got a reference to the NavigatorFrame
3. From the NavigatorFrame I got ahold of its ComponentContent
4. From the ComponentContent I got a component (an HtmlPanel)
5. Added a mouse listener to the (only) child component of the HtmlPanel.
6. Stored a weak reference to the child component, so that I could...
0. Remove the mouse listener from the previous component.
Should I add a request for context menues? I feel really bad for wishing things in a project that I don't contribute to, but I don't have time to spare.
Sure, go ahead and add a feature request for it. That not only serves as a reminder, but you can also monitor it and get notified of progress.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.