Swing : communication/events between components

M

Marcos

I'm new to Swing, and need to get something working pretty quickly.

Basically, I have a table and I want to sort when I click on the
headers (done) and filter acording to some text (so if I type in, say,
'Foo' I only get rows where a particular column matches or starts with
that value). So my questions are

1) I want to be able to have a filter on every column, so I opted for
another JTable on top of main one, just with the same number of columns
and no TableModel. Is there another way? The only problem I can see
with it is that when the main table gets too long, a scroll bar appears
(which I want), but then the 'filter' table cells no longer match up
with the main table (as the main table squashes up slightly)

2) The biggest problem I have is how to do something on the main table
when a KeyPress event happens on the filter table? I can't find any
example on the net. So, when I type 'Foo' in JTable 'filter', I want to
be able to filter the results shown in the JTable 'main', for the same
column index as the one where the text was typed in...

3) Am I going about this all wrong? Is there another way? :)

Marcos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top