Check out example codes for "java joptionpane". It will help you in understanding the concepts better.

Code Example 1

JOptionPane d = new JOptionPane();
d.showMessageDialog( laFrame, "le message", 
      "le titre", messageType);

Code Example 2

JOptionPane.showMessageDialog(frame, "A basic JOptionPane message dialog");

Code Example 3

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class ShowMessageDialogExample1
{
  public static void main(String[] args)
  {
    String backupDir = "/Users/al/backups";
    
    // create a jframe
    JFrame frame = new JFrame("JOptionPane showMessageDialog example");
    
    // show a joptionpane dialog using showMessageDialog
    JOptionPane.showMessageDialog(frame,
        "Problem writing to backup directory: '" + backupDir + "'.");
    System.exit(0);
  }
}

Code Example 4

JOptionPane.showMessageDialog(frame, "Eggs are not supposed to be green.");

Learn ReactJs, React Native from akashmittal.com