1 package com.ca.commons.cbutil; 2 3 import javax.swing.*; 4 import java.awt.*; 5 import java.awt.event.MouseAdapter ; 6 import java.awt.event.MouseEvent ; 7 8 9 15 16 public class CBButton extends JButton 17 { 18 19 20 26 27 public CBButton(String text, String tooltip) 28 { 29 this(text, tooltip, null); 30 } 31 32 33 39 40 public CBButton(String text, Icon icon) 41 { 42 this(text, "", icon); 43 } 44 45 46 54 55 public CBButton(String text, String tooltip, Icon icon) 56 { 57 super(text, icon); 58 59 if (tooltip != null) 60 setToolTipText(tooltip); 61 62 addMouseListener(new MouseAdapter () 63 { 64 public void mouseEntered(MouseEvent e) 65 { 66 setForeground(Color.blue); 67 } 68 69 public void mouseExited(MouseEvent e) 70 { 71 setForeground(Color.black); 72 } 73 }); 74 } 75 } 76 | Popular Tags |