在Int中转换字符串

jul*_*iee 0 java string

在我的私有void jButtonOKActionPerformed(java.awt.event.ActionEvent evt)我有错误信息:

不兼容的类型:String不能转换为int

我的第一个字段(IdentCat)通常是Int.但是我不知道如何在INT中这样做?

ap.setIdentCat(jTextIdent.getText().toUpperCase());
Run Code Online (Sandbox Code Playgroud)

更多代码

private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        Categorie ap = new Categorie();
        ap.setIdentCat(jTextIdent.getText().toUpperCase());
        ap.setDenomCat(jTextDescr.getText());

        boolean ok = daoCat.insertCategorie(ap);
        if (!ok)
            JOptionPane.showMessageDialog(null,"Insertion impossible !","Avertissement",JOptionPane.ERROR_MESSAGE);
        this.dispose();
    }         
Run Code Online (Sandbox Code Playgroud)

And*_*ner 5

使用Integer.parseInt("123456").