2

I have a form and added four commands to it. When user click on menu option it displays command menu (Menubar within a dialog) which is scrollable. Having command menu scrollable is not user friendly for my app.

How can I disable command menu scrolling ?

Jayesh
  • 31
  • 2
  • I didn't get any option to disable scrolling on menubar. Even for three commands it gives scrollable list in command menu. For touch devices , its not user friendly. – Jayesh Dec 11 '12 at 06:53
  • Here is the code: [Created one form with some ui components and added few commands] Form form = new Form("Menu test"); // add few UI components ... ... // now add commands form.addCommand(CMD_BACK); form.addCommand(CMD_SEND); form.addCommand(CMD_ADD_CONTACTS); form.addCommand(CMD_RESET); form.addCommandListener(this); I didn't find any solution to disable scrolling on menu bar – Jayesh Dec 11 '12 at 07:02

1 Answers1

0

Got the solution... Its little tricky ( you need to Edit MenuBar.java source file of LWUIT lib)

Add following lines in createCommandList method

    // Add  your menu list rendered   
    l.setRenderer(new JMenuListRenderer());
    l.setSmoothScrolling(false);
    l.setScrollVisible(false);
    // specify the height you want ( you can make it configurable as well) 
    l.setPreferredH(getCommandCount()*30); 
    l.setPreferredW(Display.getInstance().getDisplayWidth()/2);

and set menuPrefSizeBool of your theme to true.

Jayesh
  • 31
  • 2