首先在JFrame中加入一个JTable。
private void formAllBrandPanel() {
JTable table = new JTable(new MyTableModel(singleDataInfo , etColumnNames));
JScrollPane scrollPane = new JScrollPane(table);
}输入检索条件后,点击检索按钮,进行数据检索,请问如何刷新页面,显示检索出来的数据
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
。
if (command.equals("検索")) {
selStock = codeText.getText();
String[][] singleData = retrieveStock.searchByStock(selStock);
if (singleData == null) {
} else {
singleDataInfo = singleData;
} }
private void formAllBrandPanel() {
JTable table = new JTable(new MyTableModel(singleDataInfo , etColumnNames));
JScrollPane scrollPane = new JScrollPane(table);
}输入检索条件后,点击检索按钮,进行数据检索,请问如何刷新页面,显示检索出来的数据
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
。
if (command.equals("検索")) {
selStock = codeText.getText();
String[][] singleData = retrieveStock.searchByStock(selStock);
if (singleData == null) {
} else {
singleDataInfo = singleData;
} }
DefaultTableModel defTable=new DefaultTableModel();
Jtable jtable=new Jtable();
....
public void init(){ jtable.setModel(defTable);
defTable.setDataVector(object obj,Strng[] colname); ...(搜索完后,形成你自己的新数据源(二维数组))
//再用一次这个方法就可以了.
defTable.setDataVector(搜索后的数据,列名)
}
很久不写swing的东西了,参数记不清了.你可以结合javadoc看一下..
我已经指定了jtablemodel
public class MyTableModel extends AbstractTableModel {
}
改成你那样,又产生了其他错误,有没有针对我的程序的做法。