April 2005 Archives

PopupFactory gotchas

| 2 Comments

I've spent some time figuring this out, hopefully will save time of people reading this.
PopupFactory creates instances of Popup that one can show/hide in their Swing application. Quick and easy, the Popup javadoc suggests it can cache the popups etc. Great! And it actually worked pretty well on my MacOSX. However when I tried the same piece of code on Linux, it didn't repaint. I showed the popup, but never repainted the content, was more a picture or screenshow than a live component. Well, that was quite troubling because the popup component consisted of multiple progress bars. (As part of my daily work at Netbeans, I'm currently working on the Progress Indication component)

After endless hours and hints from coworkers, I figured that the problem was cause by a visible glasspane which was painting the wait cursor. Funny enough the visibility of the wait cursor correlates with the visibility of the progress bar in my case. Ensuring the glasspane stays invisible is hard to achieve. And it did work on Mac. The reason for that is that Apple's JDK enforces heavyweight popup. Oh, I didn't tell you that yet.
There are internally 3 kinds of popups, lightweight, mediumweight and heavyweight. On Linux I was consistently getting mediumweight popup, while on Mac the heavy version.
So how to force a heavyweight popup? The answer is non-obvious, I figured by looking at the code. In PopupFactory's createPopup() method don't specify the owner parameter. Passing null will magically create a heavyweight popup and everything starts working.

Hope that helps.

Daily routine at Netbeans Prague office

Check out the epic saga of a lost PET bottle at Prague Sun site. (or was it stolen/abducted ?)

Maven's Hidden Dragon

A few days ago, I was blogging about features that are part of Maven and it's javadoc plugin but are not used. Today I figured that the javadoc plugin has more suprises in the sleeves. It includes features that don't seem to be described anywhere on the maven-javadoc-plugin site.

Maven: Unused features

While Maven provides a lot of features in various plugins, some of them seem not to be used at all. One example I've encountered lately is javadoc:upload. If you try to google ibiblio.org's repository for javadocs uploaded, you won't find *any*. Well, there a 2 or 3 examples of javadocs but these were not uploaded using the javadoc:upload goal apparently because they are in the wrong place.

Why do I write about it? Since Mevenide 0.3 (Netbeans version) I've looked up javadocs for project's dependencies in the local repository and made them available to the project. The IDE then can enhance the code completion for the classes of that dependency. Version 0.6 now allows to check the remote repository for the javadocs and downloads them if available. (Screenshot here ) Unfortunately I've written the feature without consulting Google first.

Makes me wonder how many other Maven features end up being unused. Is it because there was no real benefit in uploading them or is the whole repository upload workflow not streamlined enough? Or even flawed?

About this Archive

This page is an archive of entries from April 2005 listed from newest to oldest.

March 2005 is the previous archive.

July 2005 is the next archive.

Find recent content on the main index or look in the archives to find all content.