1
我的工作是分析文本,並打印這樣表中的Java Swing
LS 1 -> 3
LS 2 -> 3
LS 3 -> 2
PRP itself -> 2
PRP it -> 5
DT all -> 7
DT All -> 11
DT no -> 9
DT a -> 77
NNP Milwaukee -> 2
NNP D65 -> 1
NNP STD -> 1
NNP Gimp -> 3
NNP Constitution -> 1
的輸出,而不是我想要的東西,像
我嘗試使用JTable的一個程序3個小時,仍然無法弄清楚如何將文本排序到表格。請幫忙。
示例代碼
public String getTagsList() throws IOException {
String output = "";
for (Map.Entry<String, Map<String, Integer>> entry : tagMap.entrySet()) {
String oa = entry.getKey();
Map<String, Integer> words = entry.getValue();
for (Map.Entry<String, Integer> entryWords : words.entrySet()) {
String ob = entryWords.getKey() + " -> " + entryWords.getValue();
output += oa + "\t" + ob + "\n";
}
}
return output;
}
而且
try {
if (cmd == cmdOpen) {
int code = chooser.showOpenDialog(myPane);
if (code == JFileChooser.APPROVE_OPTION) {
File selectedFile = chooser.getSelectedFile();
fileName = selectedFile.getName();
TagText tagText = new TagText(selectedFile.getAbsolutePath(), 4);
myPane.setText(tagText.getTagsList());
}
}
}
行之間的關係是什麼?如果按「LS」列排序,其他列的效果如何? – MadProgrammer
3小時不是很長時間..! –
是的,它是......,以一個may ... ... –