How to import Excel file into JTable
Here are three way to do this.
- Use "JTableReadTableModelTask " to do this. ( recommended )
- Use "ReadTableModelTask" to do this
- Use ModelIO to do this.
1. Use "JTableReadTableModelTask "to do this. (recommended)
Here is the sample code to import excel file:
2.Use "ReadTableModelTask"to do this.Use ReadTableModelTask, you must inherit it first, and override its method done(),in the done method, you can use following statement to get a TableModel, this is not convenient, so we recommend the first way to do this:
3.Use ModelIO to do this.Here is the sample code, also you could put the following code into a background thread, For example: use javax.swing.SwingWorker.
导航： 博客园首页 知识库 新闻 招聘 社区 小组 博问 网摘 找找看