如何将组件置于其他组件之上? [英] How to put a component on top of others?
问题描述
我有一个 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屋!