I live in NJ but work in NY, how do I enter state tax?

I have only one NY income, and my W2 has two states taxable wages on box 16.

One is for NY and the other is for NJ.

I knew I should file a none residen tax return for NY and a resident tax return for NJ.

My question is how I should enter them in the wags & income section.

If I enter them according to the figures on the W2. something looks wrong.

Assuming my total earning is 10k, the NY taxable wage is 7k, and the NJ taxable wage is 9k.

When I file for NJ tax return, the systeam would consider that my total taxable wage is 16k.

However, it should be 9k.

Did I do anything wrong when I eneter the wags & income section.