// sample use of JOptionPane.showMessageDialog import javax.swing.JOptionPane; JOptionPane.showMessageDialog( this, "That name is already taken.", "Duplicate Name", JOptionPane.ERROR_MESSAGE );