问题描述
我需要将半透明的 AWT 组件/容器放置在其他组件的顶部,以接收鼠标事件.
I'm in the need of a translucent AWT component/container to be placed on top of other components to receive the mouse events.
这里的问题是创建一个半透明组件.到目前为止,我的调查表明,Swing可以在例如一个JPanel. AWT有什么类似之处吗?
The problem here is to create a translucent component. My investigation so far showed that Swing has the possiblity to do setOpaque(false)
on e.g. a JPanel. Is there something similiar for AWT?
这个想法是使ScrollPane可以滚动,方法是简单地单击某个位置并四处移动鼠标.这就是为什么我需要一个透明的组件将其放置在所有其他组件之上.
The idea is to make a ScrollPane scrollable by simply clicking somewhere and moving the mouse around. Thats why I need a transparent component to place it above all other components.
长话短说,无论哪个组件,我都需要一个半透明的组件放置在其他元素的顶部以接收鼠标事件.
Long story short, I need a translucent component, no matter which one, to place on top of other elements to receive the mouse events.
预先感谢
推荐答案
史前AWT Container and Components
无法正确使用AFAIK,您可以尝试通过更改,半透明仅受Swing JComponents
支持
AFAIK not possible correctly for prehistoric AWT Container and Components
you can to try that with changing this code from Swing to the AWT, Translucency is supported for Swing JComponents
only
这篇关于透明的AWT组件,可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!