X

Geertjan's Blog

  • July 26, 2012

Plug A Custom BasicTabbedPaneUI into the Mavenized NetBeans Platform

Geertjan Wielenga
Product Manager

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 "org.netbeans.core.windows".

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 "org.netbeans.core.windows" 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"?>
    <nbm>
    <dependencies>
    <dependency>
    <id>org.netbeans.modules:org-netbeans-core-windows</id>
    <type>impl</type>
    <explicitValue>org.netbeans.core.windows/2 = 201207171143</explicitValue>
    </dependency>
    </dependencies>
    </nbm>

    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:

http://java.net/projects/nb-api-samples/sources/api-samples/show/versions/7.2/misc/MVNTabPaneDemo

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha