1import javax.swing.JOptionPane;
2
3public class Main {
4 public static void main(String[] argv) throws Exception {
5
6 JOptionPane.showMessageDialog(null, "I am happy.");
7
8 }
9}
10
1import javax.swing.ImageIcon;
2import javax.swing.JFrame;
3import javax.swing.JOptionPane;
4
5public class ShowMessageDialogExample1
6{
7 public static void main(String[] args)
8 {
9 String backupDir = "/Users/al/backups";
10
11 // create a jframe
12 JFrame frame = new JFrame("JOptionPane showMessageDialog example");
13
14 // show a joptionpane dialog using showMessageDialog
15 JOptionPane.showMessageDialog(frame,
16 "Problem writing to backup directory: '" + backupDir + "'.");
17 System.exit(0);
18 }
19}
20