Make a JPanel not draw its background (Transparent)

后端 未结 5 1196
孤城傲影
孤城傲影 2020-12-05 17:50

Is it possible, in Java, to make a JPanel skip drawing its background thus being transparent except for the components on it?

5条回答
  •  执念已碎
    2020-12-05 18:29

    setOpaque(false)

    It'll pass off painting the background to its parent, which may draw its own background.

    You can do a screen capture and then use that to paint the background of the panel.

提交回复
热议问题