5 Replies - 250 Views - Last Post: 12 June 2019 - 09:02 AM Rate Topic: -----

#1 IMINNOCENT11   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 12-June 19

Cannot Find Symbol getmodel. Netbeans

Posted 12 June 2019 - 07:52 AM

I made the method for getModel but for some reason it is below in 'jTable4MouseClicked' whereas it should be above I think, above 'jButton1ActionPerformed' because this is where the error is. Please help been trying to fix now for 2 hours, cant copy paste above because cannot delete original line of jTable4MouseClicked and cannot move code element up either.
Is This A Good Question/Topic? 0
  • +

Replies To: Cannot Find Symbol getmodel. Netbeans

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15116
  • View blog
  • Posts: 60,494
  • Joined: 12-June 08

Re: Cannot Find Symbol getmodel. Netbeans

Posted 12 June 2019 - 08:04 AM

Please copy/paste the relevant code.
Please copy/paste the entire error message.
Was This Post Helpful? 1
  • +
  • -

#3 IMINNOCENT11   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 12-June 19

Re: Cannot Find Symbol getmodel. Netbeans

Posted 12 June 2019 - 08:10 AM

prepStat.executeUpdate();
            DefaultTableModel model = (DefaultTableModel)ClientTable.getModel();
            model.setRowCount(0);
            Show_client_table();
            JOptionPane.showMessageDialog(null, "Record saved."); 


Gives error message "cannot find symbol method getModel();

getModel code that is lower down and I can't move up is:

 int i =jTable4.getSelectedRow();
        DefaultTableModel model = (DefaultTableModel)jTable4.getModel();
        jTextField1.setText(model.getValueAt(i,0).toString());
        jTextField2.setText(model.getValueAt(i, 1).toString()); 

Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15116
  • View blog
  • Posts: 60,494
  • Joined: 12-June 08

Re: Cannot Find Symbol getmodel. Netbeans

Posted 12 June 2019 - 08:20 AM

I would go review the docs and see if 'getModel' is a valid function for a what ever type jTable4 is.
Was This Post Helpful? 0
  • +
  • -

#5 IMINNOCENT11   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 12-June 19

Re: Cannot Find Symbol getmodel. Netbeans

Posted 12 June 2019 - 09:00 AM

Nevermind, thanks for trying to help. I actually managed to find the error it was just a stupid mistake. ClientTable should've been labelled something else, feels bad wasted 3 hours on it.
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15116
  • View blog
  • Posts: 60,494
  • Joined: 12-June 08

Re: Cannot Find Symbol getmodel. Netbeans

Posted 12 June 2019 - 09:02 AM

Welcome to the world of programming. Thankfully IDEs help a bit, but a misplaced comma, semi colon, or the like can be a day long search for that errant stroke.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1