Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Swing : communication/events between components

Thread Tools

Swing : communication/events between components

Posts: n/a
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?


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Swing Model Classes Updating Swing Components on a Thread Other Than AWT mkrause Java 0 05-06-2005 04:32 PM
SWING components adjustment in different resolutions - Should show scrollbars less than 800X600 and expand components over this resolution Bluetears76 Java 1 07-01-2004 09:01 PM
Which swing components to use? Javaman1003 Java 2 02-12-2004 02:01 PM
Can Choice components respond to keyboard input like HTML Choice components? Mickey Segal Java 0 02-02-2004 10:59 PM
Import swing-components in J2ME-Applications Christian Marko Java 2 01-06-2004 05:40 PM