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 "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

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

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.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
25
26
27
28
29
30
   
       
Today