Creating array of JButtons
Hey
I am using the Netbeans IDE and created 9 JButtons using their GUI Builder. I want to store these buttons into one array. I don't know if Netbeans is doing something to prevent me to not do this but a NullPointerException pulls up.
This is the code that I use to store my 9 buttons:
Code:
private JButton button_array [] = {Button1, Button2, Button3, Button4, Button5, Button6, Button7, Button8, Button9};
I am accessing the array properly using a for loop from index 0 - 8.
Any help will be much appreciated! If you need to see more of the code just ask.