I am working hard to finish up a relatively simple applet that displays some information in a textarea when you click on certain menuItems or JButtons.
If you run the code, you first start out by making a selection from the 'Contents' menu. After you select, say man(1), a heading comes up on the very top saying its title "man(1)", and then the "See Also" panel pops up with relevant links that are JButtons. Then in the text area below, the text for the applicable selection is displayed. So for man(1), the text area below says:
man - find and display reference manual pages
blah blah blah
The problem is that the menuItems (named content0 thru content4) and the JButtons(b0 thru b4) both call the exact same methods in their listeners, and hence should have the same responses when clicked, right? But they don't... if you click on any of the menuItems inside the Contents menu, that selection will always show up correctly with the correct 'headline' in the JPanel namePanel, like how i described above with the man(1) selection. however, if you hit the JButton links that are associated with that selection, the textArea and link buttons will come up correctly, but sometimes the namePanel (the headline on top) is not correct. For example, if I was looking at the apropos(1) selection and I clicked the whatis Button, then often the whatis textarea and buttons would be correctly displayed, but the headline would still say "apropos(1)"... and it might be stuck there for a little while until some other headline gets stuck up in the namePanel.
Here is the code, and I would be eternally grateful if someone could help me fix it:
(you only really need the .java file in this folder to get it to run)
Thanks so much!
Please post all suggestions as COMMENTS. thanks!