If you want it or not - you have to register your custom UIs somehow with the UIManager, how else could it know about them ;-)
What you don't need, though, is a custom subclass of the supported LAFs: you can register them manually (and update the registration when the LAF is changed, that is you'll need a propertyChangeListener on the UIManager to be notified in such a case).
Assuming a JCustom with a classID of "CustomUI" and ui implementations following the usual conventions (that is BasicCustomUI, WindowsCustomUI ... ) the registration would be something like:
String prefix = UIManager.getLookAndFeel().getID();
UIManager.getLookAndFeelDefaults().put("CustomUI", myUIPackage + "." + prefix + CustomUI);
Note that the custom ui needs a static createUI which returns an instance of the ui:
public static ComponentUI createUI(JComponent comp) {
return new BasicCustomUI();
}
and the component needs to publish its uiClassID, lookup and set its ui:
@Override
public String getUIClassID() {
return "CustomUI";
}
@Override
public void updateUI() {
setUI(UIManager.getUI(this));
}
The benefit of using SwingX is to provide the infrastructure to automagically register custom components. You'll need an additional class - CustomAddon - which provides the per-LAF configuration and the custom component has to contribute that addon:
// in JCustom
static {
LookAndFeelAddons.contribute(new CustomAddon());
}
// in CustomAddon
@Override
protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
super.addBasicDefaults(addon, defaults);
defaults.add("CustomUI",
"mypackage.BasicCustomUI");
}
@Override
protected void addMacDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
super.addMacDefaults(addon, defaults);
defaults.add("CustomUI",
"mypackage.MacCustomUI");
}
//... similar methods for all supported LAFs