Skip to main content

New JXTitledSeparator Implementation

No replies
mattnathan
Offline
Joined: 2005-02-20
Points: 0

I have just implemented a new version of JXTitledSeparator which uses UI delegates instead of having layout and child components in the JXTitledSeparator itself. The code is in my incubator but is called JXTitledSeparator2 so that it can be used without namespace conflicts.

The original reason for implementing this again was because the current JXTitledSeparator does not support the enabled property which was something I needed for my current project. I thought, after looking through the source code, that it shouldn't be too hard to implement this via look and feel so that's what I did.

As well as supporting the enabled property I also wrote the new implementation so that it fully supports the foreground and background painters properly, that is to say you can add effects to the foreground painter and they will be applied to the separator content (or even replace the entire separator painting code with your own painter if needed). This is something that was not available in the current version as it uses child components and layout to create the title/icon and separator.

Apart from the back end implementation there should be no differences between the behaviour and look of the two versions of the component (so no demo, sorry) and the public API has not been changed.

As a side note the implementation uses the JXComponent and XComponentUI classes also in my incubator and provides a simple example and 'best' practices for how to use these classes to create your own custom components. I'd really like it if these made it into the core SwingX library but that's a discussion for another time :).