Implementing Cursor in Java with some Transparency

后端 未结 4 1426
情深已故
情深已故 2021-01-18 14:52

I have a 35x40 px. png image I want to use as a custom cursor in a Swing application. The image has a glow so contains alpha transparency values. Problem is when I attempt t

4条回答
  •  余生分开走
    2021-01-18 15:31

    An alternative is to fake a cursor.

    Take a look at Alexander Potochkin's Well Behaved GlassPane.

    In particular, run the sample code, choose Options>GlassPane is Visible and Options>Final GlassPane.

    Starting from this, load up a cursor image that is completely transparent, then paint a proper, alpha-blended cursor on the glasspane.

提交回复
热议问题