java实现jframe透明窗体示例

时间:2021-08-04 18:07:54

代码如下:


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);
    }
}