Link to home
Start Free TrialLog in
Avatar of jenniferx
jenniferx

asked on

i need applet help bad (and quickly)

Hi everyone,

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:

NAME

     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:
http://www.cs.uoregon.edu/~jenni/ee/
(you only really need the .java file in this folder to get it to run)

Thanks so much!
jennifer.

Please post all suggestions as COMMENTS.  thanks!
Avatar of black
black

Hi Jennifer,
I believe it's because you don't refresh your frame after you change it's title, for example if you get the problem just resize the window you'll get the correct title popping up. The values aren't changed unless the frame is repainted.
ASKER CERTIFIED SOLUTION
Avatar of black
black

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jenniferx

ASKER

Thank you so much, black!  You are my new hero and that's no joke.  I had given up on repaint() earlier because it wasn't working for something else... but i'm happy to see it again.

thanks again,
Jennifer.