当然可以,Button透明背景设置方法:
方法1:JButton b1=new JButton();
b1.setOpaque(false);
b1.setColor(new Color(2,2,2)); //此颜色值随便设置,只起占位作用,但是必须加上此句,否则不会出现透明背景效果。
b1..setIcon(new ImageIcon("bin/filechooser/image/rec.gif"));
方法2:JButton b2=new JButton();
b2.setContentAreaFilled(false); //只须加上此句
b2.setIcon(new ImageIcon("bin/filechooser/image/rec.gif"));
width:72px;
height:21px;
background-image:url(../images/btn_login.gif);
background-repeat: no-repeat;
align:center;
cursor:pointer;
display:block;
font-size:0;
line-height:0;
text-indent:-9999px;
background-color:transparent;
border:0;
border-collapse:collapse;"
buttonObj.setOpaque(true)