Skip to main content

1.0 - 1.6 upgrade, missing ColumnHeaderRenderer

2 replies [Last post]
bbrtki
Offline
Joined: 2009-07-08
Points: 0

The new version is looking alright so far - hoping we get some demos up and running soon(ish).

Only one error here though which occurs when replacing swingX 1.0 with 1.6
--
import org.jdesktop.swingx.table.ColumnHeaderRenderer; can not be resolved
ColumnsHeaderRenderer cannot be resolved to a type
--
I had this class extended to be able to display some custom icons in the header.
What would be the new way to do this?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kleopatra
Offline
Joined: 2003-06-11
Points: 0

> The new version is looking alright so far - hoping we
> get some demos up and running soon(ish).
>

good to hear that. They are - see the thread about the demos for a link - too early to advertise loudly. Feel free to contribute :-)

> Only one error here though which occurs when
> replacing swingX 1.0 with 1.6
> --
> import
> org.jdesktop.swingx.table.ColumnHeaderRenderer; can
> not be resolved
> ColumnsHeaderRenderer cannot be resolved to a type
> --

not an error, it's a feature: the only reason for having the custom renderer was to support sort icons (the enhanced configuration never really worked in the general case for several reasons) which is done in core now.

> I had this class extended to be able to display some
> custom icons in the header.
> What would be the new way to do this?

grab the old code and install in your header - but beware: there are issues as java6 sort icons are placed as the icon in the label (last time I looked), so your custom icons most probably clash with that.

CU
Jeanette

bbrtki
Offline
Joined: 2009-07-08
Points: 0

> grab the old code and install in your header - but beware: there are issues as java6 sort icons are > placed as the icon in the label (last time I looked), so your custom icons most probably clash with that.

Yeah it is, I wasn't showing an arrow in that case.

So basically I'll have to grab that part of the old swingx 1.0 code to get custom icons working again. No biggie.
But, I don't suppose a feature request for showing the sort arrow + a custom icon in a column header cell was already on the list of things to do? There's that nasty limitation of JLabels only supporting a single icon.

In theory that could be worked around by having something like:
[code]
JPanel Panel = new JPanel( new FlowLayout( FlowLayout.CENTER, 0, 0));
JLabel Icon1 = new JLabel(); // Add icon url here
JLabel Icon2 = new JLabel(); // Add icon url here-

Panel.add(Icon1);
Panel.add(Icon2);
[/code]

And then returning the panel at the icon display location to display it in front or behind the label header text as desired.