有些人可以幫我理解如何做到這一點?如何將此api結果更改爲Jtable格式?
//通過API &完成查詢,然後返回結果,但它們被聚集。
try {
QBC qc = new QBC("[email protected]", "[email protected]");
Vector<Vector<String>> evec = new Vector<>(qc.doQuery("xyz","1", "5","4,5,6","10"));
String Results = evec.toString();
jTextArea2.setText(Results);
// Need to learn to print this data to table
} catch (Exception e) {
JOptionPane.showMessageDialog(rootPane, e);
}
代碼工作現在更改後
try {
QBC qc = new QBC("[email protected]", "password", "https://domain.com/api/", "token");
Vector<Vector<String>> evec = new Vector<>(qc.doQuery("bjp43iquh","1", "5","4,5,6","10"));
Vector<String> columnNames = new Vector<>();
columnNames.addElement("Column1");
columnNames.addElement("Column2");
JTable table = new JTable(evec, columnNames);
JScrollPane scrollPane = new JScrollPane(table);
Component add = jInternalFrame1.add(scrollPane);
}
catch (Exception e) {
JOptionPane.showMessageDialog(rootPane, e);
}
}
但得到一個異常現在>>>>>>> java.lang.Class.CastException:java.util.HaskMap不能轉換爲java.util.Vactor < < < < < < < < <
你想打印哪張表? – SMA 2015-03-02 14:05:13
Jtable ..我有點失去希望試圖找出這個 – 2015-03-02 17:03:00