怎么实现 窗体 透明 而 内容不透明!!!!!!!!!!!!!!
窗口总是和内容一起透明做不出不规则界面
import java.awt.*;
import javax.swing.*;
public class chuangti extends JFrame{
JLabel jl1;
public chuangti() {
super("【123】透明窗体");
jl1=new JLabel(new ImageIcon("Image/qq.jpg"));//添加图片
this.add(jl1);
this.setLayout(new FlowLayout());
this.add(new JButton("按钮"));
this.add(new JCheckBox("复选按钮"));
this.add(new JRadioButton("单选按钮"));
this.add(new JProgressBar(20, 100));
this.setSize(new Dimension(400, 300));
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
JFrame.setDefaultLookAndFeelDecorated(true);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Window w = new chuangti();
w.setVisible(true);
com.sun.awt.AWTUtilities.setWindowOpacity(w, 0.7f);
}
});
}
}