2

I have a JXTable in my swing app. When I press ctrl+F on the table, default search panel is opening.

enter image description here

This panel finds only substrings. I need to find similar words with my InputText. For example, I write "test" result may be "tost", "tests", "est", "tst" and etc. How do i change this searching method to my own algorithm ? Is it possible ? Or Should I disable default seaching and create my own ?

Robin
  • 36,233
  • 5
  • 47
  • 99
N0D1R
  • 313
  • 2
  • 11

1 Answers1

1

Override the JXTable#getSearchable method and return your own custom Searchable implementation.

Note that the default implementation always returns the same instance (lazily created):

public Searchable getSearchable() {
    if (searchable == null) {
        searchable = new TableSearchable(this);
    }
    return searchable;
}

You might want to keep this in mind when overriding the method. I have no idea what the effect would be to always return a new instance.

Robin
  • 36,233
  • 5
  • 47
  • 99