简体   繁体   中英

Swing Bean Binding for tables in NetBeans

I want to know how to filter data in a database table and insert into a swing table with bean binding in NetBeans. I read NetBeans beanbinding tutorial.But is not much helpful.(It shows how to load data directly from a database table)I want to know how to query and select relevant data and insert into the table.

Also, I want to know how to add data in text fields into table with Beanbinding in netbeans.I still code manually.

Also how to remove/delete a selected row/rows in Beansbinding and get data from table and do calculations(no of rows, total value in a particular column).?

Thank you

What about displaying fisrt some data in a JTable and, after, work with your database?

1°) Extend an AbstractTableModel that will represente your DB Table. This is a good and short example .

2°) Then, with the appropriate JDBC driver, you'll be able to execute your Select queries on your database and retrieve data.

3°) By firing right events through your AbstractTableModel (see fireTableDataChanged() ), your screen will be updated automaticaly

4°) About delete record(s): you need to work with the selected row(s). With it, you're able to reach your data (find primary key) and execute JDBC delete query. If and only if, your query is successfully executed, then update your internal data and fire events: fireTableRowsDeleted(int, int) , fireTableRowsInserted(int, int) , etc.

Good luck!

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