I'd like to add filtering/searching capability for all columns (so that it is generic) the logic is not a problem. However, I was thinking is that the best way to do that in terms of visualization is having a text field above each column header (or part of the column header)?
I've run into a couple of problems when trying to achieve that:
- Embedding within the column header demands implementing a new renderer + there's the problem that somehow I need to catch the event because the cell is drawn and does not respond to events. Looks like an overkill to me.
- Having a separate line (panel) of text field components above each column sounds much easier at first glance, however, aligning the text field with the columns is problematic since I didn't find an API in
JTable
orTableColumn
that returns the coordinates of the column. Moreover, moving the column around would mean adjusting the text fields as well (which is possible but another overhead).
Am I missing something or it is indeed that hard to achieve something as simple as that? Any other suggestions?