package publicclass;
|
import java.awt.Color;
|
import java.awt.Cursor;
|
import java.awt.Font;
|
import javax.swing.ImageIcon;
|
import javax.swing.JButton;
|
|
public class JButtonImage extends JButton {
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
|
public JButtonImage(String title) {
|
Font f=new Font("΢ÈíÑźÚ",Font.PLAIN,15);//°´Å¥×ÖÌåÉèÖÃ
|
this.setText(""+title+"");
|
this.setFont(f);
|
ImageIcon image = new ImageIcon("image/tip/tip.png");
|
this.setContentAreaFilled(false); //ÉèÖð´Å¥±³¾°Í¸Ã÷
|
this.setIcon(image);
|
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));//Êó±êÖ¸ÔÚ°´Å¥ÉϱäÊÖÐÍ
|
this.setSize(30, 30);
|
this.setForeground(Color.white);
|
this.setBackground(Color.white);
|
this.setBorderPainted(false);
|
this.setFocusPainted(false);//È¥µôÐéÏß
|
|
}
|
|
public static JButton JButton_image(String imagepath,String tiptex) {
|
|
JButton jbt=new JButton(new ImageIcon(imagepath));
|
jbt.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));//Êó±êÖ¸ÔÚ°´Å¥ÉϱäÊÖÐÍ
|
jbt.setToolTipText(tiptex);
|
jbt.setSize(25, 25);
|
jbt.setForeground(Color.white);
|
jbt.setBackground(UIColor.getMenuBarcolor());
|
jbt.setBorderPainted(false);
|
jbt.setFocusPainted(false);//È¥µôÐéÏß
|
|
|
return jbt;
|
}
|
|
|
|
}
|