How to put a component on top of others?

匆匆过客 提交于 2019-11-27 09:47:51
trashgod

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.

You could use

To overlay content on top of the other components on the screen

Couldn't you just put the content that you don't want to move in a separate JPanel that isn't the scrolling panel? I don't see any reason to include it in the scrolling panel if you don't want it to scroll.

So have one big panel (call it bigPanel or something) that doesn't scroll. Then have the panel that you don't want to scroll in bigPanel. Then also put the scrolling panel in bigPanel as well.

Perhaps I'm missing something, but wouldn't that solve your problem?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!