Java - set opacity in JPanel

前端 未结 6 692
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-09 10:16

Let\'s say I want to make the opacity of a JPanel %20 viewable? I don\'t mean setOpaque (draw or not draw) or setVisible (show or hide)... I mean make it see-through JPanel.

6条回答
  •  爱一瞬间的悲伤
    2020-12-09 10:37

    panel.setBackground( new Color(r, g, b, a) );
    

    You should also look at Backgrounds With Transparency to understand any painting problems you might have when you use this.

提交回复
热议问题