JSplitPane 中分隔线移动的动画
在我的代码中,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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
javax.swing.Timer
来控制动画,如本示例所示。请注意,调整帧大小时动画仍保持平滑。
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.