If the action does not have an icon or a different icon must be used, add or change the icon using setIcon():
import javax.swing.ImageIcon;
import javax.swing.JButton;
publicclass Main {
publicstaticvoid main(String[] argv) throws Exception {
JButton button = new JButton();
// Add or change the icon; it will appear to the left of the text
button.setIcon(new ImageIcon("icon.gif"));
// Set to null to remove icon
button.setIcon(null);
}
}