正在加载图片...
Handling menu Selection public void actionPerformed( ActionEvent event String menuNamei menuName event. getActioncommand ()i if( menuName equals(Quit") System. exit(0)i else I response. setText("Menu item t menuName is selected)i Here we simply display the label of the selected menu. In a more realistic program, call appropriate private methods to process the menu selection C 2000 McGraw-Hill troduction to Object-Oriented Programming with Java--Wu Chapter 13-11© 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 13 - 11 Handling Menu Selection public void actionPerformed( ActionEvent event ) { String menuName; menuName = event.getActionCommand(); if ( menuName.equals("Quit") ) { System.exit(0); } else { response.setText("Menu item '" + menuName + "' is selected"); } } Here we simply display the label of the selected menu. In a more realistic program, call appropriate private methods to process the menu selection
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有