JPanel 下的滑动窗口
我有一个 JPanel,我想要它,以便每当用户单击它时,面板下方就会出现一个滑动窗口,并为 JPanel 中已有的内容提供更多信息。我该怎么做?
I have a JPanel and I want it so that whenever a user clicks on it, a sliding window appears just below the panel and giving more information to what is already in the JPanel. How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
要将某些内容放在某些内容上,您可以使用 JLayeredPane 或 zorder 的事情。
To put something on something, you can use a JLayeredPane or the zorder thing.
试试这个
http://java-sl.com/tip_slider.html
Try this
http://java-sl.com/tip_slider.html
你的问题的要求很糟糕,所以我们无法提供太多细节。
如果您想要动画,请使用 Swing Timer。每次计时器触发时,您都会更改组件的高度,使其看起来像在滑动。
The requirements of your question are terrible so we can't give much detail.
If you want to to animation then use a Swing Timer. Each time the timer fires you change the height of the component to make it look likes its sliding.
也许向 jpanel 添加一个鼠标侦听器,然后在按下鼠标时添加一个内部面板,或者拉出不同的卡,或者执行适合您的特定 Swing 布局的任何操作。
Perhaps add a mouselistener to the jpanel, then upon mousepressed add an inner panel, or pull up a different card, or do whatever it is that works for your particular swing layout.