Transparent JFrame background

后端 未结 5 862
温柔的废话
温柔的废话 2021-02-15 16:31

Is it possible to make a JFrame that has a transparent background and draw an image on it, so only the image will be visible with no border or background?

5条回答
  •  既然无缘
    2021-02-15 17:09

    You should make content pane transparent too.

    frame.setUndecorated(true);
    frame.getContentPane().setBackground(new Color(1.0f,1.0f,1.0f,0.0f));
    frame.setBackground(new Color(1.0f,1.0f,1.0f,0.0f));
    

提交回复
热议问题