0
我使用的是定制JToolBar中使用下面的代码:JToolBar中的背景图片
public class GeneralToolbar extends JToolBar{
public GeneralToolbar() {
super();
setBackground(Color.white);
setOpaque(true);
setPreferredSize(new Dimension(54,54));
setMinimumSize(new Dimension(54,54));
setMaximumSize(new Dimension(54,54));
setSize(new Dimension(54,54));
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
Dimension size = this.getSize();
ImageIcon image = DefaultAction.createImageIcon("/com/aaa/resources/tabback");
g.drawImage(image.getImage(), 0,0, size.width, size.height, this);
}
}
现在看到图像。但是我的按钮周围有一个不透明的矩形。 我试图设置按钮不透明为false,但没有添加任何影响。 谢谢大家的支持
完成工作! 谢谢。 – Guy 2010-01-01 21:51:34