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

Code Example 1

alert('Message');

Code Example 2

JOptionPane.showMessageDialog(yourFrame,
    "WARNING.",
    "Warning",
    JOptionPane.WARNING_MESSAGE);

Code Example 3

JOptionPane.showMessageDialog(yourFrame,
    "WARNING.",
    "Warning",
    JOptionPane.WARNING_MESSAGE);

Learn ReactJs, React Native from akashmittal.com