向JTable添加加载循环
我有一个从数据库加载数据的 JTable。因为有时数据太多,我想在Jtable内添加一个加载圆圈来通知用户数据正在加载。这是我希望的图像:
这可能吗?在 Swing 中如何实现呢?
PS:我不想使用进度条,我只想要表格内的圆圈。
更新: 该表是 GUI 的一部分,我只想禁用或显示 JTable 内的加载,并保持其他组件不变。
I have a JTable that loads data from a database. Because sometimes there's too much data, I would like to add a loading circle inside the Jtable to notify the user that the data is being loaded. Here is an image of how I would like it to be:
Is this possible? How can it be done in Swing?
PS: I don't want to use the progress bar, I just want the circle inside the table.
UPDATE: The table is part of the GUI and I only want to disable or show the loading inside the JTable and leave the other components intact.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是 JLayer(Java 1.7.0) 版本,基于 How to Decorate Components with JLayer 类(Java 教程 > 使用 JFC/Swing 创建 GUI > 使用其他 Swing 功能)
Here's JLayer(Java 1.7.0) version, based on How to Decorate Components with the JLayer Class (The Java Tutorials > Creating a GUI With JFC/Swing > Using Other Swing Features)
1) 半透明&莫代尔un_decorated JDialog(阻止父级的鼠标事件)
2)到GlassPane(可以阻止鼠标事件)
3)到JViewport
编辑
如果您的
SQL解释器
支持分页
,则 ,然后拆分SQL ResultSet
(5 - 20 块)并使用JProgressBar
而不是循环Images
,1) to Translucent & Modal & un_decorated JDialog (block Mouse event to the parent)
2) to GlassPane (can block Mouse event)
3) to JViewport
EDIT
if your
SQL interpreter
supportsPaginations
, then splitSQL ResultSet
(5 - 20 pieces) and useJProgressBar
rather than cycledImages
,我认为玻璃板足以完成这项任务。它允许绘制窗口的内容。这是 教程 中的示例(红色圆圈是涂在按钮上):
I think Glass Pane fits enough for this task. It allows to draw over content of window. Here is the example from tutorial (red circle is painted over button):