We would like to know how to create JButton from both text and icon.
//w ww . j a va 2s.c o m import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JOptionPane; public class Main { public static void main(final String args[]) { Icon icon = new ImageIcon("dog.jpg"); JButton button = new JButton("Dog", icon); JOptionPane.showMessageDialog(null, button); } }