hi all. first post and all that.
ive done on-and-off amateur programming for a good number of years now, starting with C/C++ and just now moving onto java. that being said, im not awfully skilled yet.
im working on my final project for the introductory java course im taking presently. right now, im working on creating a virtual keyboard. here's what ive got.
int i = 0, j = 0; String[] keyboardText = {"QWERTYUIOP", "ASDFGHJKL", "ZXCVBNM"}; JButton[][] keyboardButton = {new JButton[10], new JButton[9], new JButton[7]}; for(i = 0; i < 3; i++) { for(j = 0; j < keyboardText[i].length(); j++) keyboardButton[i][j].setText(Character.toString(keyboardText[i].charAt(j))); }
in my mind, that creates a qwerty keyboard all ready to be laid out in a few JFrames. however, when it runs, i get a NullPointerException on the working line of the nested for loops ( kbB.setText(blahblah); ).
reading over this code again, it would seem that i dont initialize any of the JButtons in the 2d array. if thats actually causing the error, i have no idea how to fix it. haha. help?
if anyone wants me to post the rest of my source code, id be glad to.
thanks in advance for any replies. =)