JidePopupMenu not showing scroll buttons

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

JidePopupMenu not showing scroll buttons

Postby Mojo » Fri Apr 25, 2008 7:54 am

Hello, I want to use the JidePopupMenu for its scrolling capabilities. My understanding is that if there's a long list of items in the JidePopupMenu then it'll display scroll buttons on the top and bottom of the list. I tried it out with the code below, which contains 50 items in the popup and goes out of the screen, but the scroll buttons don't appear. What am I doing wrong?

Code: Select all
public static void main(String[] args)
{   
    final JFrame d = new JFrame();
    final JidePopupMenu ppm = new JidePopupMenu();
    for (int i = 1; i <= 50; i++)
    {
        ppm.add(new JMenuItem("Option " + i));
    }

    d.addMouseListener(new MouseAdapter()
    {
        public void mouseClicked(MouseEvent e)
        {
            ppm.show(d, e.getX(), e.getY());
        }
    });
    d.setPreferredSize(new Dimension(200,100));
    d.setVisible(true);
    d.pack();
}
Mojo
 
Posts: 2
Joined: Fri Apr 25, 2008 7:46 am

Postby JIDE Support » Fri Apr 25, 2008 8:24 am

I don't know why but it does work for me.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby Mojo » Fri Apr 25, 2008 8:48 am

I'm using IntelliJ and I moved the "jide-oss-2.2.4.jar" up in my dependencies hierarchy and then it worked fine. Not sure why...maybe it was conflicting with another version of JidePopupMenu in another jar. Oh well, it works.
Mojo
 
Posts: 2
Joined: Fri Apr 25, 2008 7:46 am

Postby ruslan » Wed Jul 30, 2008 5:10 am

I am using JideMenu.setPopupMenuCustomizer

considering the number of items of the customized menu, there is too many to fit on the screen, however the popup menu does not show scroll buttons.

additionaly, the customize paramater takes a "JPopupMenu" instead of a JidePopupMenu, which has the scrolling interface. I casted it to JidePopupMenu, and got exception..


Code: Select all
myMenu.setPopupMenuCustomizer(new JideMenu.PopupMenuCustomizer() {
         public void customize(JPopupMenu menu) {
//try to cast to see if its really a JidePopupMenu
            JidePopupMenu mnu = (JidePopupMenu)menu;
ruslan
 
Posts: 54
Joined: Wed Jan 10, 2007 1:35 pm

Postby JIDE Support » Wed Jul 30, 2008 6:48 am

JideMenu which extends JMenu uses JPopupMenu which doesn't have the scrolling feature. If you look at JMenu code (see below), I am not sure how to intercept it to create JidePopupMenu. The method is private and the popupMenu field is not assignable from outside.

Code: Select all
    private void ensurePopupMenuCreated() {
        if (popupMenu == null) {           
            final JMenu thisMenu = this;
            this.popupMenu = new JPopupMenu();
            popupMenu.setInvoker(this);
            popupListener = createWinListener(popupMenu);
        }
    }
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby Walter Laan » Thu Jul 31, 2008 12:17 am

See also this thread on java.net. It points to a RFE in the Sun bug parade open since 2002.

You could maybe hack it by overriding createWinListener and reflection.[/url]
Walter Laan
 
Posts: 383
Joined: Mon May 01, 2006 12:13 am

Postby ruslan » Thu Jul 31, 2008 5:11 am

thanks, will do
ruslan
 
Posts: 54
Joined: Wed Jan 10, 2007 1:35 pm


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 63 guests

cron