JTable with a column selector menu

From: Rogan Dawes (discard_at_dawes.za.net)
Date: 07/23/04


Date: Fri, 23 Jul 2004 09:46:27 +0200

Hi folks,

I'm looking to include a JTable in an application, but I would like to
be able to dynamically select which columns should be visible, and which
should not.

What I'm after is something like the Mozilla Thunderbird mail client,
where you can click on a button in the top right corner (basically the
little square above the scroll bar, and to the right of the column
header), and it drops down a menu of the candidate column names, with
checkboxes/tickmarks for each.

You can then click on the header name, and the column would be made
visible in the table.

Obviously I would need to extend JTable to implement this, but I'm not
really sure where to start.

I guess I'm looking for an API like:

public MyTable(TableModel model);

public void setColumnVisible(String headerName, boolean visible);

The rest should actually be automatic, or controlled internally by the
table itself.

Does anyone know of an existing free implementation of this, or have
suggestions of where to start?

Thanks

Rogan

-- 
Rogan Dawes
*ALL* messages to discard@dawes.za.net will be dropped, and added
to my blacklist. Please respond to "nntp AT dawes DOT za DOT net"