2012-12-11 42 views
2

我有一個表單並向它添加了四個命令。當用戶點擊菜單選項 時,它將顯示可滾動的命令菜單(對話框中的菜單欄)。具有可滾動的命令菜單 對我的應用不方便用戶使用。禁用命令菜單滾動LWUIT J2me

如何禁用命令菜單滾動?

+0

我沒有得到任何選項來禁用菜單欄上的滾動。即使對於三個命令,它也會在命令菜單中提供可滾動列表。對於觸摸設備,它不是用戶友好的。 – Jayesh

+0

這裏是代碼: [用一些UI組件創建一個窗體並添加了一些命令] \t \t Form form = new Form(「Menu test」); \t \t //添加一些UI組件 \t \t ... \t \t ... \t \t \t \t //現在添加命令 \t \t form.addCommand(CMD_BACK); form.addCommand(CMD_SEND); form.addCommand(CMD_ADD_CONTACTS); form.addCommand(CMD_RESET); \t \t form.addCommandListener(this); \t \t \t我沒有找到任何解決方案來禁用菜單欄上的滾動 – Jayesh

回答

0

得到了解決......它有點複雜(需要編輯LWUIT LIB的MenuBar.java源文件)按照createCommandList方法

// 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); 

添加和設置的menuPrefSizeBool你的主題爲真。