JIDE 3.2.0 Release - Awesome Swing Components
JIDE Software is a software company focusing on providing rich client solutions and services using Java/Swing technology. Founded in 2002, JIDE Software has developed 16 products and over 200 professional Swing components that cover almost every aspect of Java/Swing development. Today, we are pleased to announce JIDE 3.2.0 release. There are many exciting features in this release.
Line Wrapping Support for StyledLabel and Styled TableHeader
StyledLabel is a very popular component that is available in our open source JIDE Common Layer. It adds styles (foreground, background, line decoration etc.) to plain labels. In the 3.2 release, we have implemented a new line wrapping feature for StyledLabel. By calling setLineWrap(true), the styled label will wrap automatically, without you needing to explicitly add line breaks to the text. You can independently control text layout by setting the preferred, minimum and maximum row counts, as well as the preferred width. To better leverage this new feature, we also enhanced our table header to use a StyledLabel to paint the header text. This means you can now display all kinds of styles in the table header including the line wrap. You want to have multi-line text in your table header? Now you can do it. Please refer to our newly-added WrapStyledLabelDemo and StyleTableHeaderDemo for demos of these features. You must use CellStyleTableHeader or its subclasses to benefit from this feature.
Keep the Native Look of Table Headers
In order to paint a custom header on JTableHeader, you can use the header cell renderer. However, one major problem with the renderer approach is that you lose the native look of the header. On Windows 7, Vista or Mac OS X, there is a nice rollover effect and gradients on the header. As soon as you set your own renderer, they are gone. So it has always been troublesome to place a sort arrow and/or filter icon on the header, implement a nested table header, a group table header or an auto filter table header. In the 3.1 release, we started to roll out a new concept called TableHeaderCellDecorator. The decorator pattern is designed to work with the renderer pattern, not to replace it. The renderer will do the painting first, then the decorators paint some decorations (such as icon, arrows etc.) around it. To avoid overlapping, the decorators can reserve insets so that the renderer will not paint over it. Again, you have to use CellStyleTableHeader or its subclasses to benefit from this feature. Both SortableTableHeader and AutoFilterTableHeader use this feature to paint the sort arrows and the filter button respectively.
Here is a screenshot the table header under different L&Fs with both the sort arrow and the auto filter button.
Marker and Margin Support for JTable, JList, JTree and JTextArea
We have added support for MarkerArea and MarginArea to the CodeEditor. A MarkerArea can be placed next to a vertical scroll bar to display an overview of errors or warnings in a large component. Sometimes only part of the component content is visible in the viewport, but the MarkerArea will always display the whole thing without scrolling. A MarginArea can also be placed next to a component that has a vertical scroll bar. However it scrolls with the content in the viewport. People use it to display row/line numbers, break points, code folding and other status information related to its corresponding row. These two features actually are very generic so they can be used for other large components such as JTable, JList, JTree, JTextArea etc. In this release, we did some refactoring to ensure these components are all supported. Please refer to MarkerSupportDemo and MarginSupportDemo for more information.
Diff for Tables
When it was originally introduced, JIDE Diff was a diff utility for just the CodeEditor, but sometimes our users wanted to compare data that was not in text format. What if the data can be represented only as a table? To address this, we have introduced TableDiffPane to support the diff of two tables. It looks and functions similarly to CodeEditorDiffPane, except that you now see two tables instead of two CodeEditors.
Here is a screenshot of the diff pane for tables. You can see both TableDiffPane and the marker/margin area for the table in this screenshot.
Hyperlinks and Buttons in Table Cells
This is probably one of the most-requested features. Swing developers know it is not very easy to implement because JTable uses a cell renderer to paint the cell, with the consequence that mouse events will not be delegated to the cell renderer component. We googled and found some interesting ideas but so far we haven't seen a perfect solution from anyone. I saw an approach that returns a new component for every table cell which of course defeats the purpose of the cell renderer pattern and also hurts performance. Another suggested approach was to delegate mouse events directly, which causes the whole table to be repainted on every mouse movement. Needless to say, we didn't follow any of these suggestions in our implementation.
JDK 7 Support
As you might already know, Oracle has officially announced JDK7. JIDE is committed to supporting two recent major versions of the JDK simultaneously, currently JDK6 and JDK7. This means we will now officially stop supporting JDK5. Even though this release should still run fine on JDK5, from now on we will not invest any extra effort to avoid using, or provide workarounds for, JDK6-only methods/features.
The JIDE 3.2.0 release is the first release officially supporting JDK7. Due to the JDK7 changes (which changed Synth related to UI classes from package local to public), we now have to provide two versions of the same jar, jide-plaf.jar and jide-plaf-jdk7.jar, to support JDK6 and JDK7 respectively. So depending on the JDK you are using, please choose the right jar for your JDK. Note the jide-plaf.jar is the only jar that has two versions. All other JIDE jars will work for both JDK6 and JDK7.
Until next time!
JIDE Software, Inc.
We make you love being a Swing developer!
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)




