Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8204819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:00:47+00:00 2026-06-07T08:00:47+00:00

I have created a table which i want to filter it in two different

  • 0

I have created a table which i want to filter it in two different level.
first filter it with radio button on the file extension like(.jpg, .doc, the rest).
Second filter it with textField to search something inside the first filtered.
As below you can see in demo i can filter the table with radio button but i don’t know how to apply the second level filter (JTextField) on the table.

Does any body know how to do it?

enter image description here

public class TwoLevelFilterTablePanel extends OeVubPanel {
private static final File DirectoryEngine = new File("C:\\Users\\Public\\Pictures\\Sample Pictures");
private JRadioButton jpg,doc,others;
private ButtonGroup radioSet;
private JTextField txtFilter;
private JTable glazedTable;
private BasicEventList<MyCode> eventList;
private JPanel filterPanel,radioSetPanel;

public TwoLevelFilterTablePanel(BasicEventList<MyCode> eventList) {
    this.eventList=eventList;
    createComponents();
    layoutComponents();
}

public void createComponents() {
    jpg = new JRadioButton("jpg");
    doc= new JRadioButton("doc");
    others= new JRadioButton("other");
    radioSet = new ButtonGroup();
    radioSet.add(jpg);
    radioSet.add(doc);
    radioSet.add(others);
    txtFilter = new JTextField();

    radioSetPanel = new JPanel();
    radioSetPanel.setLayout(new BoxLayout(radioSetPanel, BoxLayout.X_AXIS));
    radioSetPanel.add(jpg);
    radioSetPanel.add(doc);
    radioSetPanel.add(others);
    filterPanel=new JPanel();
    filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.Y_AXIS));
    filterPanel.add(radioSetPanel);
    filterPanel.add(txtFilter);

    final BarcodeMatcherEditor barcodeMatcherEditor = new BarcodeMatcherEditor(jpg,doc,others);
    final FilterList filteredRadioSet = new FilterList(eventList, barcodeMatcherEditor);

    // build a JTable
    String[] propertyNames = new String[] {"name", "size","date"};
    String[] columnLabels = new String[] {"Name", "Size","Date"};
    TableFormat tf = GlazedLists.tableFormat(MyCode.class, propertyNames, columnLabels);
    glazedTable = new JTable(new EventTableModel(filteredRadioSet, tf));
}

public void layoutComponents() {
    setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
    add(filterPanel);
    add(new WebScrollPane(glazedTable));
}

public static void main(String[] args) {
    BasicEventList<MyCode> eventList  = new BasicEventList<MyCode>();
    for(File file : DirectoryEngine.listFiles()){
        eventList.add(new MyCode(file.getName(),file.length(),new Date(file.lastModified())));
    }
    TwoLevelFilterTablePanel demo = new TwoLevelFilterTablePanel(eventList );
    JFrame frame = new JFrame();
    Container cp = frame.getContentPane();
    cp.add(demo);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(500, 500);
    frame.setLocation(500, 500);
    frame.setVisible(true);
}
} 

MatcherEditor class:

public class BarcodeMatcherEditor extends AbstractMatcherEditor implements ActionListener {
    private JRadioButton jpg,doc,others;
    public BarcodeMatcherEditor(JRadioButton jpg, JRadioButton doc, JRadioButton others) {
        this.jpg = jpg;
        this.doc=doc;
        this.others =others;
        this.jpg.addActionListener(this);
        this.doc.addActionListener(this);
        this.others.addActionListener(this);
    }

    public void actionPerformed(ActionEvent e) {
        final String filter = ((JRadioButton)e.getSource()).getText();
        if (filter == null)
            this.fireMatchAll();
        else
            this.fireChanged(new BarcodeFilterMatcher(filter));
    }

    private static class BarcodeFilterMatcher implements Matcher {
        private final String filter;
        public BarcodeFilterMatcher(String filter) {
            this.filter = filter;
        }
        public boolean matches(Object item) {
            final MyCode code = (MyCode) item;
            return return filter.equals("other") || code.getName().endsWith(this.filter);
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:00:48+00:00Added an answer on June 7, 2026 at 8:00 am

    You simply chain two FilterLists together:

    EventList<Person> personLists = ...
    ...
    FilterList<Person> filterListByGender = new FilterList<Person>(personList, genderMatchEditor);
    FilterList<Person> filterListBySurname = new FilterList<Person>(filterByGender, textSurnameMatchEditor);
    // Continue using the filterListBySurname as you usually would
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a table which contains a bunch of dynamically created radio button lists,
I have multiple buttons that gets created in a table which all look like
I have a SQL Server table which has 625 columns created with different datatypes
I have created an archive table which will store data for selecting only. Daily
I have a dynamically created table which in the last <td> there is a
I have created a table layout in which my table row height is too
I have a custom table created which has a foreign constraint on the core_website
I have a table which is dynamically created based on the amount of results
I have created programme in which we navigate from table view to a simple
I have created mysql to delete table rows, which have lower DATETIME value than

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.