I am creating a Chess program on NetBeans using jButtons as squares, and my java knowledge is limited to what I have learnt at school.
So this line
int verticalValue = Integer.parseInt(newButton.substring(1,1));
returns a nullPointerException and I can't figure it out whatsoever. Here is the relevant code:
static void pawnMovement(JButton but){
String buttonName = but.getName();
String newButton = buttonName;
int verticalValue = Integer.parseInt(newButton.substring(1,1));
The names of all buttons are in the format letterNumber, so I don't see why this shouldn't work.
Thanks!