• Post Reply Bookmark Topic Watch Topic
  • New Topic

JMenuItem

 
Gary Down
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My menu displays the menu items but;
the menu items don't respond to clicks.

Any clues?

Thanks,
Gary.


 
Amy Phillips
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gary,

I managed to get your code working (after removing your package and the two private variables ) but everything seemed to be working fine for me. When I clicked the menu items the word Listener appeared in the Console window.

maybe try the code without those lines I mentioned above and see what happens?

Amy
 
Gary Down
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that.

On my sytstem is gets to the point where all the menus/menuitems are displayable...

then the menuitems will drop down..
Now the fun part, sometimes if I click an item enough times (or sometimes even the first time) they fire off to the listeners.
Other times they just don't respond.

So it obviously not a simple JAVA problem but most likely an environmental
problem. I will follow up in other forums.

Gary.
 
Amy Phillips
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gary,

Sounds very strange - maybe a memory problem?

Good Luck, I hope you manage to get it working

Amy
 
Gary Down
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem fixed,
I installed Windows XP (I had ME) and it works fine.

Gary.
 
Gary Down
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The next step....

I would like to use the menuitems (when selected) to display different content in the panel area. I hane added a main panel and which displays fine. How would I change the content of that panel and make is redisplay.
I have tried to use (excuse the names) mainPanel = new otherPanel() in
the action performef of the listener. But it doesn't change.....
I also addeda setBackground(color) for the mainPanel (just to see it do something) and that works.

Thanks,
slow but sure I'm getting this,
Gary.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gary Down:
Problem fixed,
I installed Windows XP (I had ME) and it works fine.

Gary.


EWE!! Windows ME. That was like Windows XP Alpha RC1.

Anyway, on to your other problem. Depending on how many components in the Panel you need to change.

If you want to change just a few components, you need to issue a panel.remove(component) and then add whatever components and then call panel.revalidate() or panel.validate() for the changes to reflect. If you are changing everything on the JPanel, the best way is to remove the panel from the container all together and add a brand new panel with the components you need.

myNewPanel = myOtherPanel won't work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!