|
Do you need help with your Java programming?
Click here for instant help with your Java code. |
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(). |
| Do you know your Java? | |
| Take a Ten-Question-Java-Quiz! | |
Search for code examples on this site
