Problems and Solutions

We will be listing the problems and solutions that we've experienced with the program here:

Problem: The display to user entry just like, isn't working. I created an array of JLabels up on the top so it would display the headings, and..instead, this is what it looks like (yeah, it's so beautiful...)...: 
Solution: I've realized that maybe if I increase the width of the size, that the comments should be able to fit well. I don't really know how to make it so that the columns and lines are resizable, but I think we can worry about those bits later. OH MY GOSH I'M AN IDIOT I FOUND THE PROBLEM...I FORGOT TO ADD THE ARRAY TO THE GRIDLAYOUT :P WHOOPS. Also, instead of having them click somewhere else and be so stupid, I ended up creating a JScrollPane, so they have horizontal and vertical scrollers like this: 

Problem:  The readToFile method is the first thing that was called in the program. And the minute it was run, it crashed. 
Solution: The writeToFile method was consistently exporting it to OutFile rather than Outfile.txt. In addition, instead of printing out teachers.size(); the program printing out Number of Entries: 3

Problem: The code that we were trying to use to sort the array was removing it properly, but it didn't add the Node in the proper place. In fact, it didn't even add the node at all! O_o We went through the entire thing over and over, and the entire "adding" thing was a failure. 
Solution: We decided that instead of properly sorting it, we would just use the LinkedList default "add" method, which adds it at the end of the linked list. That way, as long as the members of Environmental Alliance add the entries in alphabetical order, then it'll stay in order. 

Problem: The export method wasn't exporting into an html file, it just turned into a file. And when I opened it, it opened in Safari and printed nothing. I changed the HTML code and the text, and neither of them worked. 
Solution: I didn't realize that the BufferedReader or the PrintWriter had to print out to "nameOfFile.txt" or "nameOfFile.html." It would have been so help to know this before, even though well, even though I kind of did, but really, truly, kind of didn't. 

Problem: The drop down list wasn't updating all the teacher' names after adding an entry. We went through writing the file to reading the file and doing everything in between, but nothing was solving the problem. 
Solution: First, we thought that we might have to write all the information to the file and then read it again. But that wasn't the best idea because then it would have generated a significant amount of extra code wasn't effective. It would just be duplicating what it had to do in the past and the process didnt really make sense. Instead, we chose to create an array that took the name information from the teacher's node one by one, and inserted into a String array which the JComboBox for the teacher drop down menu relied on. When we printed this out to the screen, we realized that they multiplied just like logarithmic functions...the string just kept getting larger and larger because the combo box was not clearing itself. We went onto the API's in search for a clear method or a remove method and realized that a nameOfComboBox.removeAllItems(); method existed. We ran this piece of code every single time a teacher's name was added or removed, so the drop down list would update by itself. 


No comments:

Post a Comment