Show a message dialog with JOptionPane
This code example shows how to easily display a message dialog using the Swing class JOptionPane. |
public class myFrame extends JFrame { //.... public void displayMessage() { JOptionPane.showMessageDialog(this, "The message", "The Title", JOptionPane.INFORMATION_MESSAGE); } } |
If you want an icon on the dialog, provide an instance of the Icon class as a fifth parameter to showMessageDialog(). |
Search for code examples on this site
