最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - JFrame cannot be converted to components - Stack Overflow

programmeradmin3浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论