Absolutely right, and I have done it just like what you have said. Taht is, I have made a JMenuBar, put 3 JMenu into the JMenuBar, and put several JMenuIdems into the JMenu. But it doesn't work. when I click the mainmenu, the menuitem can not be displayed. I just can not understand.
Well, let's see. One thing that might be wrong is if you've put a heavyweight component like Canvas into your JApplet's content area; that would stop the menus from appearing. Otherwise, let's see the menu-related code -- as little code as you can post and still show what you've done, please.
Hi, yesterday I have tested the code and I have found where the problem is, but I don't know yet, how can I solve the problem. I post the source code up. The code is really a little bit complex. I try to explain it clearly. There are 2 classes. One is a abstract basic class, named GraphGame. The other is subclass, named TSPGame. The problem is in the first basic class, GraphGame. Its main function is to make the User Graphic Interface. What I have found is all because this code: 'contentPane.add(_p, BorderLayout.CENTER);', the line 157. _p is a panel, this panel ist the container of other elements. I put the other elements onto this panel, and then put this panel into JApplet. But whenever I add the panel _p on the JApplet, this panel will cover the submenus up. Whenever I delete this line, the submenus will be appeared, (the mainmenu can always be seen). That is, when I add the panel onto JApplet and then click the mainmenu, the submenu works, but we can not see them, because they are covered by the panel _p. when I change the code like this: 'contentPane.add(_p, BorderLayout.EAST);', then we can see all the submenus, and the panel is on the right side of the JApplet. Of cause, this is not the way to solve the problem and there must be anything wrong with these elements.
Weil die Code nicht von mir gemacht wird, habe ich sie gel�scht. [ May 21, 2006: Message edited by: Baosheng Ma ]
I added CODE tags to your code, so that it stays formatted and is more easily readable. You should use those when posting ocde of any length. Look for the "CODE" button underneath the text editing box when posting.
posted 14 years ago
das Problem habe ich gel�st. Und alles wegen des Zusammenhang zwischen der leichten Component und schweren Component. Ich habe das Panel auch zu JPanel umgesetzt, und es funktioniert wunderbar!
[EJFH: Babelfish says: ]
I solved the problem. And everything because of connection between the easy Component and heavy Component. I converted the panel also to JPanel, and it functions marvelously!
[ May 21, 2006: Message edited by: Ernest Friedman-Hill ]
do you understand also German? Are you German? I am only a little neugieri! And thanks for your reference!
No, I'm using http://babelfish.altavista.com . I get questions by email all the time that aren't in English; apparently there are people who are convinced I can speak Portuguese, especially. But no, I'm terrible with languages -- despite studying Spanish for four years, I can't even do a passable job with that.