简体   繁体   中英

How to disable JXTable default search action?

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

在此处输入图片说明

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 ?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM