I tried compiling this code but got an error in line 14. I don't understand what my problem is.
Here is the error that I encountered:
JOptionPane.java:14: error: cannot find symbol
JOptionPane.showMessageDialog(frame,"Content");
^
symbol: method showMessageDialog(JFrame,String)
location: class JOptionPane
1 error
Can anyone help me?
import java.awt.*;
import javax.swing.*;
class JOptionPane
{
JFrame frame;
public void CreateFrame()
{
frame = new JFrame("Testing");
frame.setLayout(null);
frame.setBounds(0,0,500,400);
JOptionPane.showMessageDialog(frame,"Content");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
frame.setVisible(true);
}
public static void main(String args[])
{
JOptionPane obj = new JOptionPane();
obj.CreateFrame();
}
}