Topic: 这样做的图片按钮文字和背景图片有脱离感的问题该怎么改?

  Print this page

1.这样做的图片按钮文字和背景图片有脱离感的问题该怎么改? Copy to clipboard
Posted by: LeadenSky
Posted on: 2004-09-15 16:14

ImageIcon rollover = new ImageIcon("D:/grass.png");
ImageIcon general = new ImageIcon("D:/wall.png");
ImageIcon press = new ImageIcon("D:/wood.png");
JButton b = new JButton("KKK",general);
b.setRolloverEnabled(true);
b.setIcon(general);
b.setRolloverIcon(rollover);
b.setPressedIcon(press);
b.setBounds(0,0,press.getIconWidth(),press.getIconHeight());
b.setBorderPainted(false);
b.setFocusPainted(false);
b.setBackground(Color.BLUE);
b.setVerticalTextPosition(SwingConstants.CENTER);
b.setHorizontalTextPosition(SwingConstants.CENTER);
当按钮按下时,文字不会往右下方移,和图片有脱离感,该怎么解决?总觉得这样做图片按钮好象不是正途。各位老大都是怎么作图片背景的按钮的呀?


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923