我需要一個簡單的方法來實現一個JScrollPane,我可以添加JTextAreas。 這應該像一個評論系統一樣工作,就像你在YouTube上和Stackoverflow上看到的那樣。JScrollPane與多個JTextAreas
它應該是在java代碼中,如果theres和其他簡單的方法我想知道它。
List<Comment> comments = businessLogicRepair.getComments(oid, "Internal");
for (Comment comment : comments) {
jInternalCommentScrollPane.add(new JTextArea(comment.getText()));
}
我的評論的對象包括:
public Comment(String id, String type, String text, String author, String postDate, String repairId) {
super(id);
this.type = type;
this.text = text;
this.author = author;
this.postDate = postDate;
this.repairId = repairId;
}
我保存的評論在數據庫中,我可以舉起手來容易。問題是顯示部分。
感謝您的幫助
爲了更快提供更好的幫助,請發佈[SSCCE](http://pscode.org/sscce.html)。顯然,要成爲SC,有必要將數據庫分解出來。作爲一個觀點,在某個時候提出明確的問題是值得的。你的問題是什麼? –
獲取'JPanel'並將所有'JTextArea'添加到該面板並將面板放入一個'JScrollPane' –
感謝您對Adil Soomro的幫助,它像一個魅力一樣工作。 –