Tip of the Day Functionality for NetBeans Platform Applications

Thanks to R.J. Lorimer's excellent Javalobby article on the SwingLabs project's JXTipOfTheDay (click here to read it), I've created a simple module that provides this functionality for NetBeans IDE:

The interesting bit is that the tips are defined in the application's user directory, in a properties file, which means that you can change the tips whenever you feel like it. So you're not locked into the tips provided by the module. Also, thanks to this snippet in the layer.xml file...

<folder name="Favorites">
    <file name="tipsproperties.shadow">
        <attr name="originalFile" stringvalue="Preferences/tips.properties"/>
        <attr name="originalFileSystem" stringvalue="SystemFileSystem"/>

...the tips properties file is automatically available in the Favorites window, so that you can use the Properties Editor to add/modify the tips:

I've tried the same module in other applications on the NetBeans Platform and, as one might expect, it works there too. I'd make the module available on the Plugin Portal, but I don't know (and can't find) the SwingLabs licensing conditions. By the way, because of usage of the NbPreferences API, the module only works from 6.0 onwards.

But, considering the fact that there are now several new/changed keyboard shortcuts, because of the many 6.0 improvements, isn't this a cool way to learn them, one by one? Whenever the IDE starts, you see a new tip. You can also call up the dialog from a menu item, so that you can scroll through all the available tips whenever you want them. And, as pointed out above, you can delete all the tips, if you want, and then just add your own!


The swing labs license is LGPL and can be found at https://swinglabs.dev.java.net/. I think that this feature should have been in NetBeans some time ago. Sooo, now that you know the licensing restrictions can I have the source? ;)

Posted by Adam on June 13, 2007 at 04:23 AM PDT #

Decided not to include SwingLabs, just distributing the NetBeans side, here in the Plugin Portal. You'll need to drop the module into your own module suite and also add a library wrapper module containing the SwingLabs JAR, as instructed in the module's description. There are one or two problems, like the checkbox is always checked, even after you've unchecked it. Also, not sure if I should have used an Installer rather than coding in the Action's constructor. But for the rest it works, interesting example if you want to learn about NbPreferences or about how to write a template in a module to the NetBeans user directory.

Posted by Geertjan on June 13, 2007 at 06:22 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« June 2016