如何将组件置于其他组件之上? [英] How to put a component on top of others?

查看:250
本文介绍了如何将组件置于其他组件之上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 JScrollPanel ,其中包括一个大面板,它自己包含3个内部面板。我想把一个面板(例如)放在一个特殊的地方,以便始终可以看到,我的意思是用户可以滚动到任何想要的地方,但该面板始终位于其他组件的顶部,并且不会移动。我尝试通过 JLayeredPane 来做到这一点,但我做不到。我怎么能这样做?

解决方案

有一个 >。




I have a JScrollPanel that includes a big panel which it's self includes 3 inner panels. i want to put a panel (for example) in a special place so that always could be seen, I mean the user can scroll to anywhere wants but that panel always is in top of the other components and doesn't move. I tried to do that via JLayeredPane but I couldn't. how may I do that?

解决方案

There's a JLayeredPane example here, but OverlayLayout, seen here, may be of interest. It's not included in the conventional gallery.

Also consider this example that paints on the scroll pane's JViewport.

这篇关于如何将组件置于其他组件之上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆