Thursday Jul 26, 2012

Plug A Custom BasicTabbedPaneUI into the Mavenized NetBeans Platform

Two NetBeans Platform developers, Bo Conroy and Adriana, mentioned at the end of my blog entry here that plugging in a new tabbed component factory doesn't work for them in their Maven-based NetBeans Platform application. The reason for that is that, in my example code, I used JTabbedPaneAdapter, which is an implementation class in "".

So, you could do different things. (1) Create an issue to make that class public (that's something I'll be doing soon), though there may be reasons why this isn't done already. (2) Create your own implementation of "org.netbeans.swing.tabcontrol.customtabs.Tabbed", which could be a bit of work and currently isn't documented. That's something I'll be working on soon. (3) Set the "" module as a friend module of your own module, which means that you're conscious that you're using an internal NetBeans Platform class and that if it changes unexpectedly you can't complain because you knew up front that you're not going to be using a public API.

This is how you do that:

  1. Find the Module Descriptor (module.xml) file in the module where you want to use an internal class: 

  2. In that file, paste this content:
    <?xml version="1.0" encoding="UTF-8"?>
                <explicitValue> = 201207171143</explicitValue>

    The pattern for impl dependencies is XXX = IMPL_VERSION where XXX is the codenamebase and IMPL_VERSION is the implementation version from the module's manifest. (Read here.)

    The explicitValue element can be constructed by looking in the manifest of the JAR that you want to make your friend:

Then build the application and everything will work as expected:

Sources of this sample are here:


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.


« July 2012 »