代码如下:
import javax.swing.JFrame;
public class TansluFrame extends JFrame
{
public TansluFrame()
{
com.sun.awt.AWTUtilities.setWindowOpacity(this, 0.6f);
}
public static void main(String[] args)
{
TansluFrame frame = new TansluFrame();
frame.setTitle("半透明的窗口");
frame.setSize(400, 300);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}