I am in need of an easy way to implement a JScrollPane where i can add JTextAreas. This should work like a comment system as you see it on youtube and here on Stackoverflow.
it should be in java code and if theres and other easy way I would like to know about it.
List<Comment> comments = businessLogicRepair.getComments(oid, "Internal");
for (Comment comment : comments) {
jInternalCommentScrollPane.add(new JTextArea(comment.getText()));
}
My comment objects contain:
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;
}
I save the comments in a database and i can get em up easily. The problem is the showing part.
Thanks for the help
Maybe a JTable would be easier to use than a JTextArea.
See: How to Use Tables.
Here's a simple example that adds new text areas to a scrolling
GridLayout
.you have to accept that is possible to put only one JComponent to the JScrollPane, in your case only one JTextArea