Back to project page SmartTools.
The source code is released under:
GNU General Public License
If you think the Android project SmartTools listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.nj.simba.ctrls; //from w ww. j av a 2s. c om import java.awt.Color; import javax.swing.ImageIcon; import javax.swing.JButton; import com.nj.simba.utils.Utils; @SuppressWarnings("serial") public class ImageBtn extends JButton { public ImageBtn(String icon, int x, int y, int w, int h) { setHorizontalTextPosition(JButton.CENTER); ImageIcon icon1Img = Utils.getResImage(icon); if ( w == 0) { w = icon1Img.getIconWidth(); } if ( h == 0) { h = icon1Img.getIconHeight(); } setFocusable(false); //setBorder(new EmptyBorder(0, 0, 0, 0)); setText(""); setBounds(x, y, w, h); setIcon(icon1Img); setOpaque(false); setContentAreaFilled(false); setForeground(Color.WHITE); } public void setIcon(String iconUrl) { java.net.URL icon1Url = getClass().getResource(iconUrl); ImageIcon icon1Img = new ImageIcon(icon1Url); setIcon(icon1Img); } }