I'm writing code and at the end it's showing an error as JFrame cannot be converted to components.
public addNewQuestion() {
initComponents();
try {
Connection con=ConnectionProvider.getCon();
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select count(id) from question");
if(rs.first())
{
int id=rs.getInt(1);
id=id+1;
String str=String.valueOf(id);
jLabel4.setText(str);
}
else
jLabel4.setText("1");
}
catch(Exception e)
{
JFrame jf=new JFrame();
jf.setAlwaysOnTop(true);
JOptionPane.showMessageDialog(jf, e);
}
}
The end part where it's JOptionPane it's showing error when I write jf
.
I'm very new to coding pls help