This was not simple by any means. Each character received a variable in the Skills panel that is called when the corresponding value is chosen in the JComboBox for character selection. Originally I wanted to simply have these character panels extend JPanel and create a panel that is automatically added to the main program. As it turned out, an easier way was to pass a panel from Skills to the character sub-panel and allow that panel to be the framework for the character skill display.
After that is was simply a matter of copying the first character panel into 6 more copies and changing a few variable names. Along with this the Save button that was initially used to populate the characterField JTextField in the Stats panel was removed. The logic behind the button was Incorporated into the character panels. This lead to a new problem, a NullPointerException error occurs when the program is launched. NullPointerException occurs for one of a few reasons:
- Calling the instance method of a null object
- Accessing or modifying the field of a null object
- Taking the length of null as if it were an array
- Accessing or modifying the slots of null as if it were an array
- Throwing null as if it were a Throwable value
With that out of the way the listeners for all 210 JComboBoxes in Skills had to be created and then linked to associated int arrays to store the selected data. While time consuming, it wasn't extremely difficult to do. In the end I was also able to put in checks to ensure that a skill wasn't assigned points if it's requirements did not already have points assigned. If that is the case an error message is generated.
This basically finished off the groundwork for the Skills tab. All that is left is to locate the equations that govern each of the 210 skills and create a separate method for each. These equations must be stored somewhere, I'm hoping the good folks at Diabloii.net will be able to point me in the right direction. I'm hoping it is an equation that drives each skill. If not then I'll have to store each skills values in an array of arrays and then create my own equation to generate the necessary information.
Once this is done I'll have a standalone skill calculator ready to go.
No comments:
Post a Comment