Need feedback from Sun
I am utter frustrated with Swing ;)
I've been trying to rework JPopupMenu to support poping up a menu over the taskbar (for the system tray) and like most of the other Swing classes, it is a total mess. It is practically impossible to do anything with JPopupMenu.
The only thing I wanted to do was modify the field "popupPostionFixDisabled" from a per-class setting to a per-object setting. The only way I found to do that is copy/paste the contents of JPopupMenu into a new file, modify it to my liking, then stick it onto the bootclasspath.
The problem then is that one cannot modify the bootclasspath under Java Webstart, which my application absolutely requires, so all of this work is for nothing.
Surely there has to be a better way to do all this. Can someone from Sun please help me with this? To get a background of what I'm trying to do, read here: http://www.javadesktop.org/forums/thread.jspa?threadID=6309&tstart=0
I've gotten everything to work except this:
1) If I use a JPopupMenu with no invoker: I make the JPopupMenu visible, but then keyboard navigation does not work. The owner window has isFocusableWindow() set to false and invoking setFocusableWindow(true) does not change anything. Without this window being focusable, keyboard navigation does not work and I absolutely need it to work.
2) If I use a JPopupMenu with an invoker: I make the invoker visible, then the JPopupMenu visible, then call toFront() on the invoker to give it focus. Now keyboard navigation works -- toFront() was required to make this possible. The problem is that now I would like to reposition the invoker such that it covers the taskbar. As you recall, it is impossible to make set JPopupMenu's location such that it covers the taskbar; the "popupPostionFixDisabled" property makes this impossible. So what I do is display the JPopupMenu, then move the underlying window that is containing it. This works fine *except* the JPopupMenu closes itself, as if someone clicked on it or something. So I'm stumped.
I believe that if I could just display the JPopupMenu in the correct position to begin with (by modifying popupPostionFixDisabled to true) then I could get everything working. However, I don't want to modify this property globally because other JPopupMenus are not taskbar popups and I may not modify their behavior. Even if I was willing to change this behavior globally (which, again, is far from ideal) setting this property using "-Djavax.swing.adjustPopupLocationToFit=false" is not an option because, as mentioned before, Java Webstart won't allow one to set JVM command-line options for my application.
From my point of view what I need is:
1a) The ability to modify "popupPostionFixDisabled" on a per-object basis; or,
1b) The ability for JNLP files to specify JVM arguments
2) A solution as soon as possible, not having to wait until Mustang.
I think the best course of action is "1a". Specifically, please make this property a per-object field, and add a setter/getter for it. I know normally this would be construed as a RFE (hence having to wait for Mustang) but I feel that in this case we can make an exception because no real functionality is changing: you are simply exposing getter/setter methods for a preexisting field. There is almost no chance of this breaking anything.
I would like to close by adding that I plan on contributing my library to JDIC in the hopes that others will benefit from it. I hope Sun will show its commitement to supporting grass-root projects such as this.
I look forward to your feedback,