Here you can find the source of getbtnIcon(String iconpath)
public static JButton getbtnIcon(String iconpath)
//package com.java2s; //License from project: Apache License import javax.swing.ImageIcon; import javax.swing.JButton; public class Main { public static JButton getbtnIcon(String iconpath) { JButton button = new JButton(); button.setIcon(new ImageIcon(iconpath)); button.setBorder(null);/* w ww . j a v a2 s . com*/ button.setFocusPainted(false); button.setContentAreaFilled(false); return button; } }