I have written a dice roller program with "File" and "Help" menus. The File menu has "New Game" and "Exit" menu items. When the program first starts, I can click on "File" and see the "New Game" and "Exit" menu items, but after the first dice roll, I can't see the "Exit" menu item any more. I'm guessing that the repaint() call has done something to cover it up. The accelerator keys still work.
Does this problem sound familiar? I can't find any obvious refernce to it when I Google or search this site. I can post code if necessary.
I have tried this with same result with:
Eclipse Juno, Linux Iced Tea 1.6
Eclipse Helios, Linux Iced Tea 1.6
Eclipse Juno Windows 32 (Vista), Java 1.7
1. Does your code respect Swing's single threaded rule?
2. does your GUI mix AWT and Swing components?
There are no new questions, but there may be new answers.
Joined: Sep 20, 2012
I did my best to trim the code down and do the SSCCE thing. Below are the DiceRoller (main) class and the Roll Dice class. I have also attached one graphic image of a die. I guess you can copy it 5 times and name the new files "two.jpg" etc.
There are still two calls to update(), but they're commented out.
While trimming the code down and making sure it would still compile, I ran into something interesting. When I removed the scroll area from the center region, the problem went away. When I put the scroll area back in, the problem re-appeared. Why would that happen??
The teacher for the class I'm taking compiled the program on his computer, and he did not see the problem. I think he's using a Mac.
When I first start the program, I can get to File | Exit ok. After the first dice roll, I can get to File, but Exit is gone.
All insight is appreciated.
I tried to attach the source as files. But I got a scolding from the forum program, first saying that I couldn't attach files with extension .java, and then that I couldn't attach files with an extension .txt. I couldn't find anything about this in a FAQ, but I concluded that source should be posted in the message. So it's below.
Joined: Sep 20, 2012
That should be, call to updateUI(), not call to update().