showMessageDialog() function gives an error

Hello,

Here is a working example that replaced frame with null:

Adding this to your code will also work:

    import javax.swing.JFrame;
    JFrame frame = new JFrame("JOptionPane showMessageDialog example");

Insight gleaned from here:
Java: JOptionPane showMessageDialog examples (part 1) | alvinalexander.com

:)

1 Like