826220679@qq.com
2023-07-22 674747e1ccde2707bf4d4c02d52b7ef5af5a97dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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;
    }
    
    
 
}