正在加载图片...
Adding menus to a frame Menu fileMenu new Menu(File) Create a Menu object MenuItem menuItem new MenuItem(Open. Create a menuitem item addActionListener( this object, associate an fileMenu. add( item )i action listener to it. and add it to the Menu object MenuBar menuBar new MenuBar()i Create a menu Bar object setMenuBar( menuBar and add it to a frame Add menuBar. add( filemenu )i Menu objects to it C 2000 McGraw-Hill troduction to Object-Oriented Programming with Java--Wu Chapter 13-10© 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 13 - 10 Adding Menus to a Frame Menu fileMenu = new Menu( “File” ); . . . MenuBar menuBar = new MenuBar( ); setMenuBar( menuBar ); menuBar.add( fileMenu ); Create a MenuItem object, associate an action listener to it, and add it to the Menu object. Create a MenuBar object and add it to a frame. Add Menu objects to it. MenuItem menuItem = new MenuItem( “Open…” ); item.addActionListener( this ); fileMenu.add( item ); . . . Create a Menu object
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有