【发布时间】:2015-03-02 14:03:11
【问题描述】:
能否请一些人帮助我了解如何实现这一目标?
// 查询是通过 API 完成的,然后返回结果,但是它们会被聚集。
try {
QBC qc = new QBC("user@gmail.com", "P@ssw0rd");
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("user@gmail.com", "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
【问题讨论】:
-
你想把它打印到哪个表上?
-
Jtable.. 我有点失去希望尝试解决这个问题
标签: java arrays string swing api