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
1JOptionPane.showMessageDialog(frame, "A basic JOptionPane message dialog");
2
1
2package com.mkyong.inputDialog;
3
4import javax.swing.JOptionPane;
5
6public class SimpleInputDialog1 {
7
8 public static void main(String[] args){
9
10 String m = JOptionPane.showInputDialog("Anyone there?");
11 System.out.println(m);
12
13 }
14
15}
16