JLayer初体验。。

Java最近推出的JLayer虽然和sharped window or translucent window一起有位JavaFX的开发做准备之嫌,但是试了一下还是感觉不错滴。。


JLayer 和 glass pane 的用法刚刚相反。
JFrame.setGlassPane()用于截取用户鼠标事件,以及之后的重新dispatch events,还有就是painting over all the components laid in JFrame。
而JLayer用于接收用户对于components的鼠标事件,以及处理process这些事件等当然也可以设置event mask来选择处理。但是和glass pane的事件传递路径是相反的。绘制的graphics是可以单独和某个Component绑定。

原文地址:https://www.cnblogs.com/pangblog/p/3244053.html