JTable problem / Sudoku problem - Problem with if

Hi, I'm Joe and I have a problem with JTable.

Basically the problem is like this. I have 2 JTables, 1 with all the values, correct values. The other one has got some of the values (it represents a sudoku), and you have to fill it up inside the application. When I fill it up with the same numbers as these ones here (in tabela) it checks if the values in table (the one i'm filling up) are the same as the values in tabela (the one that is already finished). If everything is correct, the variable temp stays true, and it should say: "Good job! You're finished!".

Although all the numbers are the same, and the sequence is also the same, it doesn't say that I'm finished, that I've completed it, but it says "Incorrect". It always says it's wrong, whatever numbers (correct or not) i put in.

I've done a check with the numbers already put in the table (the fixed numbers, the ones you see here in the code), and the mistake doesn't get made. In other words, he recognizes that the value in row 2, column 0 in the JTable table is the same value as the one in row 2, column 0 in the tabela.

But when I write a number in the table manually (after I start the app), for instance i put the number 2 onto row 0, column 0 (the first place in the table), it says it's not the correct value as the one in tabela.

Basically it says that 2 isn't equal to 2 !?

I'm using eclipse-SDK-3.7.1

Any help is appreciated.

Basically the problem is like this. I have 2 JTables, 1 with all the values, correct values. The other one has got some of the values (it represents a sudoku), and you have to fill it up inside the application. When I fill it up with the same numbers as these ones here (in tabela) it checks if the values in table (the one i'm filling up) are the same as the values in tabela (the one that is already finished). If everything is correct, the variable temp stays true, and it should say: "Good job! You're finished!".

Although all the numbers are the same, and the sequence is also the same, it doesn't say that I'm finished, that I've completed it, but it says "Incorrect". It always says it's wrong, whatever numbers (correct or not) i put in.

I've done a check with the numbers already put in the table (the fixed numbers, the ones you see here in the code), and the mistake doesn't get made. In other words, he recognizes that the value in row 2, column 0 in the JTable table is the same value as the one in row 2, column 0 in the tabela.

But when I write a number in the table manually (after I start the app), for instance i put the number 2 onto row 0, column 0 (the first place in the table), it says it's not the correct value as the one in tabela.

Basically it says that 2 isn't equal to 2 !?

I'm using eclipse-SDK-3.7.1

Any help is appreciated.

table.getValueAt(i, j)!=tabela.getValueAt(i, j)

getValueAt() returns an object, so you may need to use .equals() for comparison

getValueAt() returns an object, so you may need to use .equals() for comparison

I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:

Thread Boost - a very different sort of advertising

https://coderanch.com/t/674455/Thread-Boost-feature
This thread has been viewed 1249 times.

All times above are in ranch (not your local) time.

The current ranch time is

Apr 20, 2018 16:29:51.

The current ranch time is

Apr 20, 2018 16:29:51.