怎样实现透明的panel,在线等待
如在上面透明panel上画线,
同时能看到下面panel上的线。
问题点数:20、回复次数:3Top
1 楼henry_cn(学问:要学,要问!)回复于 2002-11-22 19:28:46 得分 20
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class CSDNTest extends JFrame
{
public CSDNTest()
{
JPanel a = new JPanel(null);
a.setPreferredSize(new Dimension(300,300));
a.setBackground(Color.red);
a.setLayout(new BorderLayout());
a.add(new JLabel("This is Test."),BorderLayout.NORTH);
a.setOpaque(false);//设置JPanel为透明
Container contentPane = getContentPane();
contentPane.add(a,BorderLayout.NORTH);
setTitle("CSDN");
setBounds(0,0,600,600);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
public static void main(String[] args)
{
JFrame frame = new CSDNTest();
frame.setVisible(true);
}
}
希望对你有所帮助!Top
2 楼telenths(_非法操作_)回复于 2002-11-22 19:43:18 得分 0
为什么不用
glassPane?Top
3 楼mercury1231(为论文而拼搏,老板就是上帝)回复于 2002-11-22 21:00:23 得分 0
setOpaque(boolean b)Top




