Requirements (we have read):
- re-download daniani.jar (for newer version)
- 008. Add Database to JTable (JTable Part 1)
- 006. Container: JSplitPane by Netbeans
- Open a project that we have made in 008. Add Database to JTable (JTable Part 1) and do a modification.
- Add container JSplitpane.
- Set orientation property = VERTICAL SPLIT
- Set dividerLocation = 30
- Add container JPanel, and put on Top JSplitpane.
- Set JPanel layout = Box Layout
- Move table to Bottom JSplitpane.
If TopSplitpane disappear, then resize the dividerLocation, for example to 31.
- Add JTextField (have to) to JPanel, named=txSearch, set horizontalAlignment = CENTER, set Text property to be empty.
- Add JLabel (optional) named=lbRowCount, and put on the right of JTextField. set horizontalAlignment = CENTER, maximumSize = [50, 30], minimumSize = [50, 30], preferredSize = [50, 30]
- The design will look like:
- Go to source code, and add script below dtble.buildtable(...) :
dtble.tableFilter(txSearch, lbRowCount);
We can set null for JLabel, example: dtble.tableFilter(txSearch, null); - Try it by type some character in txSearch. It will filter for all column.
- What about filtering per-column?
Just click the button inside txSearch. - Click a row on certain column, then right click.
- Try to add criteria by click on the other column, then right click.
- To display the criteria that we have made, doubleclick the txSearch.
- Click the button to switch to all column mode.
For boolean class-type, we can set criteria = true or false
I hope it work..