处理菜单项单击事件的方法不包含()A、使用onOptionsItemSelected(MenuItem item)响应B、使用onMenuItemSelected(int featureId.MenuItem item)响应C、使用onMenuItemClick(MenuItem item)响应D、使用onCreateOptionsMenu(Menu menu)响应

题目

处理菜单项单击事件的方法不包含()

  • A、使用onOptionsItemSelected(MenuItem item)响应
  • B、使用onMenuItemSelected(int featureId.MenuItem item)响应
  • C、使用onMenuItemClick(MenuItem item)响应
  • D、使用onCreateOptionsMenu(Menu menu)响应

相似考题
更多“处理菜单项单击事件的方法不包含()A、使用onOptionsItemSelected(MenuItem item)响应B、使用onMenuItemSelected(int featureId.MenuItem item)响应C、使用onMenuItemClick(MenuItem item)响应D、使用onCreateOptionsMenu(Menu menu)响应”相关问题
  • 第1题:

    处理菜单项单击事件的方法包含以下那几个()。

    A.使用onOptionsItemSelected(MenuItem item)响应

    B.使用onMenuItemSelected(int featureId ,MenuItem item)响应

    C.使用onMenuItemClick(MenuItem item)响应

    D.使用 onCreateOptionsMenu(Menu menu)响应


    正确答案:ABC

  • 第2题:

    假定有一菜单项,名为MenuItem,为了运行时使该菜单项失效(变灰),应使用的语句为

    A.MenuItem.Enabled=False

    B.MenuItem.Enabled=True

    C.MenuItem.Visible=False

    D.MenuItem.Visible=True


    正确答案:A
    解析:同普通控件一样,菜单控件也具有属性、事件与方法,许多属性的用途和使用方法与普通控件的相关属性没有区别,比如说本题的失效(Enabled)属性。该属性的属性值为True或False,默认为True,当属性值为False时,相对应的控件失效。

  • 第3题:

    请完成下列Java程序:实现2个下拉式菜单,一个包含exit菜单项,另一个包含item1和item2共2个菜单项。要求选择exit菜单项时,退出程序;选择item1菜单项之后,item1项变为不可选而item2可选;选择item2菜单项时,item2变为不可选而item1可选。

    注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。

    程序运行结果如下:

    import java.awt.*;

    import java.awt.event.*;

    public class ex18_2 extends Frame. implements ActionListener {

    private choiceHandler ch;

    private MenuItem item1;

    private MenuItem item2;

    public static void main(String[] arg) {

    new ex18_2 ( );

    }

    ex18_2 ( ) {

    setTitle("ex18_2");

    MenuItem item;

    ch = new choiceHandler();

    MenuBar mb = new MenuBar();

    Menu fm = new Menu("File");

    fm.addSeparator();

    fm.add(item = new MenuItem("Exit"));

    item.addActionListener(this);

    fm.add(item);

    mb.add(fm);

    Menu mm = new Menu("Choice");

    mm.add(item1 = new MenuItem("item1"));

    item1.addActionListener(ch);

    mm.add(item2 = new MenuItem("item2"));

    item2.addActionListener(ch);

    mb.add(mm);

    setMenuBar(mb);

    setSize(200,200);

    show();

    }

    public void actionPerformed(ActionEvent ae) {

    if(ae.getActionCommand().equals("Exit"))

    System.exit(0);

    else

    System.out.println(ae.getActionCommand());

    }

    class choiceHandler implements ActionListener {

    public void actionPerformed(ActionEvent ae) {

    String strCommand = ae.getActionCommand();

    if(_________________) {

    item2.setEnabled(true);

    item1.setEnabled(false);

    } else if(______________________) {

    item2.setEnabled(false);

    item1.setEnabled(true);

    }

    }

    }

    }


    正确答案:strCommand.equals(”item1”) strCommand.equals(”item2”)
    strCommand.equals(”item1”) strCommand.equals(”item2”) 解析:本题主要考查AWT建立菜单的基本方法和事件处理机制,以及控制菜单项的可选与否。解题关键是熟悉菜单的创建和设置方法,掌握菜单的事件处理模型,通过事件处理机制实现对菜单项的设置。本题中,第1个空,判断菜单命令是由选择 item1项发出的,则进行相关的设置;第2个空,判断菜单命令是由选择item2项发出的,则进行相关的操作。

  • 第4题:

    若有一菜单项(名为MenuItem),为了在运行时使该菜单项失效(变灰),应使用的语句是()

    A、MenuItem.Enabled=True

    B、MenuItem.Visible=False

    C、MenuItem.Checked=True

    D、MenuItem.Enabled=False


    正确答案:D

  • 第5题:

    上下文菜单与其他菜单不同的是()

    • A、上下文菜单项上的单击事件可以使用onMenuItemSelected方法来响应
    • B、上下文菜单必须注册到指定的view上才能显示
    • C、上下文菜单的菜单项可以添加,可以删除
    • D、上下文菜单的菜单项可以有子项

    正确答案:B

  • 第6题:

    已知xml文档包含如下内容(list为根元素): <list> <item id="0001"> <price>18</price> </item> <item id="0002"> <price>15</price> </item> <item/> <product> <item id="01"></item> </product> </list> 使用xslt进行转换时,语句<xsl:template match=”/list/item[@id]”>能够匹配到()个item元素。

    • A、3
    • B、2
    • C、1
    • D、0

    正确答案:B

  • 第7题:

    假定有一个菜单项,名为menuItem,为了在运行时使该菜单项失效(变灰),应使用的语句为()

    • A、menuItem.Enable=False
    • B、menuItem.Visible=True
    • C、menuItem.Enable=True
    • D、menuItem.Visible=False

    正确答案:A

  • 第8题:

    What does the FIND_MENU_ITEM built-in function return?()

    • A、The internal ID of a menu. 
    • B、The internal ID of a menu item. 
    • C、The internal ID of a menu module. 
    • D、The internal ID of form module to which the menu is attached.

    正确答案:B

  • 第9题:

    多选题
    Which three menu item types are valid in a menu module?()
    A

    Magic

    B

    Plain

    C

    Check

    D

    List item

    E

    Divider


    正确答案: D,A
    解析: 暂无解析

  • 第10题:

    单选题
    处理菜单项单击事件的方法不包含()
    A

    使用onOptionsItemSelected(MenuItem item)响应

    B

    使用onMenuItemSelected(int featureId.MenuItem item)响应

    C

    使用onMenuItemClick(MenuItem item)响应

    D

    使用onCreateOptionsMenu(Menu menu)响应


    正确答案: A
    解析: 暂无解析

  • 第11题:

    单选题
    如果希望使用任意形状的响应区域来响应用户的操作,应使用()响应类型。
    A

    热区响应

    B

    目标区响应

    C

    按钮响应

    D

    热对象响应


    正确答案: B
    解析: 暂无解析

  • 第12题:

    单选题
    在Menu中添加菜单项(MenuItem)的方法是哪个?()
    A

    AddMenu()

    B

    menu()

    C

    add()

    D

    AddId()


    正确答案: C
    解析: 暂无解析

  • 第13题:

    请选择正确的语句填入下列程序的横线处。 import java.awt.*; public class ex40 { static Frame. f; public static void main(String[] args) { f = new Frame("ex40"); MenuBar mb = new MenuBar(); f.setMenuBar (mb); Menu m1 = new Menu("menu"); ______ m1.add (mil); mb. add (m1); f. setSize (200, 200); f. setVisible (true); } }

    A.Menu mil = new MenuItem("iteml");

    B.MenuItem mil = new MenuItem("iteml");

    C.Menu mil = new MenuItem("iteml");

    D.Menu mil = MenuItem("iteml");


    正确答案:B

  • 第14题:

    假定有一个菜单项,名称为MenuItem,为了在运行时使该菜单项失效(变灰),应使用的语句为______。

    A.MenuItem. Enabled = False

    B.MenuItem. Enabled= Ture

    C.MenuItem. Visible = True

    D.MenuItem. Visible= False


    正确答案:A

  • 第15题:

    假定有一个菜单,名为MenuItem,为了运行时使该菜单项失效,应使用的语句为().

    A:MenuItem.Enabled = True

    B:MenuItem.Enabled = False

    C:MenuItem.Visible = True

    D:MenuItem.Visible = False


    正确答案:B

  • 第16题:

    在Authorware中,如果希望使用任意形状的响应区域来响应用户的操作,应使用()响应类型。

    A.按钮响应
    B.热对象响应
    C.目标区响应
    D.热区域响应

    答案:B
    解析:

  • 第17题:

    在android中使用Menu时可能需要重写的方法有()。

    • A、onCreateOptionsMenu()
    • B、onCreateMenu()
    • C、onOptionsItemSelected()
    • D、onItemSelected()

    正确答案:A,C

  • 第18题:

    在Menu中添加菜单项(MenuItem)的方法是哪个?()

    • A、AddMenu()
    • B、menu()
    • C、add()
    • D、AddId()

    正确答案:C

  • 第19题:

    Which datatype is returned by the FIND_MENU_ITEM built-in function?()

    • A、number 
    • B、Boolean 
    • C、menuitem 
    • D、VARCHAR2 

    正确答案:C

  • 第20题:

    You established access to menu modules using roles. You have allowed the sales role to access the menu module, but prevented access to the Update menu item. Which item property would you alter to gray out the menu option for the role?()

    • A、Item Roles. 
    • B、Menu Item Roles. 
    • C、Display without Privilege. 
    • D、Use Security. 
    • E、Command Type.

    正确答案:C

  • 第21题:

    单选题
    You established access to menu modules using roles. You have allowed the sales role to access the menu module, but prevented access to the Update menu item. Which item property would you alter to gray out the menu option for the role?()
    A

    Item Roles. 

    B

    Menu Item Roles. 

    C

    Display without Privilege. 

    D

    Use Security. 

    E

    Command Type.


    正确答案: C
    解析: 暂无解析

  • 第22题:

    单选题
    上下文菜单与其他菜单不同的是()
    A

    上下文菜单项上的单击事件可以使用onMenuItemSelected方法来响应

    B

    上下文菜单必须注册到指定的view上才能显示

    C

    上下文菜单的菜单项可以添加,可以删除

    D

    上下文菜单的菜单项可以有子项


    正确答案: D
    解析: 暂无解析

  • 第23题:

    单选题
    What does the FIND_MENU_ITEM built-in function return?()
    A

    The internal ID of a menu. 

    B

    The internal ID of a menu item. 

    C

    The internal ID of a menu module. 

    D

    The internal ID of form module to which the menu is attached.


    正确答案: B
    解析: 暂无解析