For glasspane purposes, why are input elements in Swing seemingly not considered part of a JPanel?

纵饮孤独 提交于 2019-12-02 02:38:10

You can forward mouse events to the underlying components, as shown in The Glass Pane demo's method, redispatchMouseEvent().

You appear to be using glasspane in a way that I feel it shouldn't be used.

As far as I know, a glasspane typically shouldn't be holding components at all but rather cover over the top-level window and then can act as a gate-keeper for the components that are below it, all held by the top level window's contentPane.

mKorbel
  • you can use GlassPane for overlay required Container or JComponent by @camickr, or my questions based on his code here or here,

  • another suggestion could be use JLayer (required Java7 for Java6 is there JXLayer)

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