February 06, 2012

How to add a image on java button on mouse over

Setting Icon for button that changes on mouse over  



       ImageIcon icon = new ImageIcon("javacode/image.gif");
            ImageIcon iconOver = new ImageIcon("javacode/image_over.gif");
            btn = new JButton(icon);
            btn.setBackground(Color.white);
            btn.setRolloverIcon(iconOver);
            btn.setBorder(null);
            //btn.setToolTipText("java blog belazy");

This code will show you how to put image on button in java which change on mouse over .
//



java source codes

No comments:

Post a Comment

Your feedback may help others !!!

Facebook comments