本文介绍了JScrollPane与多个JTextAreas的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个简单的方法来实现JScrollPane,我可以添加JTextAreas。
这应该像一个评论系统,你看到它在youtube和这里在Stackoverflow。

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.

它应该是在java代码,如果theres和其他简单的方法我想知道。

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()));

        }

我的评论对象包含:

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.

感谢您的帮助

推荐答案

您必须接受可以只放置一个到,在您的情况下只有一个

you have to accept that is possible to put only one JComponent to the JScrollPane, in your case only one JTextArea

这篇关于JScrollPane与多个JTextAreas的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 22:59