Automatic content resizing of JLayeredPane

我怕爱的太早我们不能终老 提交于 2019-12-11 01:28:00

问题


I'm trying to create an app with a JLayeredPane that scales automatically with the size of the parent JFrame (this is the easy part using BorderLayout as layout manager on the frame's content pane). The hard part is the fact that I want the content of the JLayeredPane to automatically resize with the JLayeredPane (and thus the JFrame too).

In fact the functionality I want to achieve is a lot like the dockable console in Netbeans, that just like comes "on top" of the editor when clicked, and when dismissed hides again and docks into the "console" word in the status bar. Obviously I also want resizing behavior to work correctly. What would be the best way to achieve this (if not with JLayeredPane)?


回答1:


You'll need to use a ComponentListener added to the JLayeredPane and have its content responds to the void componentResized(ComponentEvent e) method.



来源:https://stackoverflow.com/questions/12755083/automatic-content-resizing-of-jlayeredpane

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