JSplitPane 中分隔线移动的动画

发布于 2025-01-05 02:51:56 字数 319 浏览 2 评论 0原文

在我的代码中,UI 具有以下组件:

JSplitPane:    
    pane1: JTable
    pane2: JPanel with some texutal information.

我正在监听表上的行选择事件,然后适当地设置分割窗格的分隔符位置,以便文本信息对某些行可见,而对其他行隐藏。

然而,这种方法的一个问题是切换到分隔线位置非常突然,这使得用户了解发生了什么的时间非常少。

您能否让我知道如何添加一些动画,以便分隔符位置切换缓慢发生,并让用户知道文本信息针对特定行选择显示,而针对其他行选择隐藏。

In my code, the UI has the following components:

JSplitPane:    
    pane1: JTable
    pane2: JPanel with some texutal information.

I am listening to the row selection events on the table and then setting the divider location of the splitpane appropriately so that the textual information is visible for some row and is hidden for some other rows.

However, one problem with this approach is the switching to the divider location is very abrupt which gives very less time to the user to understand what happened.

Could you please let me know how to add in some animation so that the divider location switching happens slowly and gives user an idea that textual information is shown for a particular row selection and hidden for some other row selection.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

累赘 2025-01-12 02:51:56

我尝试在 AWT 线程上缓慢地将分隔符位置从一个值更改为下一个值,但随后 UI 似乎无法正确响应。

使用 javax.swing.Timer来控制动画,如本示例所示。请注意,调整帧大小时动画仍保持平滑。

I tried changing the divider location slowly from one value to the next on the AWT thread, but then the UI seemed to not respond properly.

Use a javax.swing.Timer to control the animation, as shown in this example. Note that the animation remains smooth as the frame is resized.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文