日期:2014-05-20 浏览次数:20743 次
import java.awt.*;
import javax.swing.*;
import com.sun.awt.AWTUtilities;
public class MyJFrame extends JFrame {
public MyJFrame() {
super("透明窗体");
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);
// this.setUndecorated(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Window w = new MyJFrame();
com.sun.awt.AWTUtilities.setWindowOpacity(w, 0.63f);
w.setVisible(true);
}
});
}
}