• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scrolling JMenu

 
Jeff Storey
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to add a scrollbar to a JMenu for menus with a long list of items?

Thanks.
Jeff Storey
 
Craig Wood
Ranch Hand
Posts: 1535
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's an idea:
 
Jeff Storey
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Craig:

I have actually been working on a solution similar to this one, although the problem seems to be when this scrolling menu is used as an item in a popup menu. I have a popup menu with 3 items, one of which is another menu (the scrolling menu), so I should be able to mouse over that and display the scrolling list of items. It works until I want to press the scroll bar. The popup menu thinks that I have clicked on another component and hides itself. Do you see what I'm saying and have any thoughts on how to get around this?

Thanks.
Jeff
 
Craig Wood
Ranch Hand
Posts: 1535
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The popup menu thinks that I have clicked on another component and hides itself. Do you see what I'm saying and have any thoughts on how to get around this?
Yes, I ran into the same problem. You may have to write some plaf code to get around this. I'd start with both JMenu and BasicMenuUI and look for the behavior that you want to modify. You can often extend the class and override/modify a few things to get what you want. The behavior seems complex so I would guess that it wouldn't be productive to replicate everything in your custom component. You never know...
 
Jeff Storey
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the meantime, I think I've found a hack to this solution. I use a second popup menu that is not actually an item in the first and just trick the menu to show that second popup menu (a BasicComboPopup) when the mouse is in the appropriate location. Seems to be doing the trick for the most part. I appreciate the help.

Jeff
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic