如何在添加了许多行时添加滚动窗格?

huangapple 未分类评论43阅读模式
英文:

How do I add ScrollPane when many rows are added?

问题

以下是翻译好的内容:

我正在尝试创建一个框架(Frame),其中将显示学生的姓名和Roll号。所有具有相同姓名的学生都将显示在其中,以及他们的Roll号。例如,如果有人搜索harry,我希望所有名字是harry的学生都出现在框架中。我有一个查询语句的结果集,语句是 select * from student where name = 'harry'

但是我不明白如何在JFrame中添加滚动条,如果有太多的行(当数据库中有太多名为harry的记录时,情况就会如此)。

我是Java Swing的初学者,所以请帮助我解决这个问题。非常感谢你的帮助。

英文:

I am trying to create a Frame where Student's name and Roll no. will be shown. All the student with the same name will be shown there along with their roll no. For example if someone search for harry i want all the students whose name is harry to appear in the frame. I have a ResultSet of statement select * from student where name = 'harry'.

But I am not able to understand how would I add scrollbars to the JFrame if there are too many rows(which would be the case when there are too many harry in the database).

I am beginner in Java Swing, so please help me out in this problem. Thank you in advance.

huangapple
  • 本文由 发表于 2020年7月27日 14:43:28
  • 转载请务必保留本文链接:https://java.coder-hub.com/63109968.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定