- 0
- 0
- 约1.07万字
- 约 10页
- 2016-06-01 发布于辽宁
- 举报
毕业设计--计算机外文翻译 -菜单和工具栏
中文1972字
毕业设计(论文)文献翻译
题 目
学生姓名 学 号
专业名称 计算机科学与技术 年 级 2009级
指导教师 职 称 讲 师
所 在 系(院) 计算机科学与技术
2013 年 3 月 1 日
Menus and Toolbars
Excerpted from Java Swing(2Nd Edition)(OReilly)by Marc Loy,Robert Eckstein etc.
The JMenuBar Class
SwingsJMenuBar class supersedes the AWTMenuBar class. This class creates a horizontal menu bar component with zero or more menus attached to it. JMenuBar uses theDefaultSingleSelectionModel as its data model because the user can raise, or activate , only one of its menus at a given time. Once the mouse pointer leaves that menu, the class removes the menu from the screen (or cancels it, in Swing lingo), and all menus again become eligible to be raised Figure 14-4 shows the class hierarchy for the JMenuBar component.
Figure 14-4. JMenuBar class diagram
You can add JMenu objects to the menu bar with theadd( ) method of theJMenuBar class. JMenuBar then assigns an integer index based on the order in which the menus were added. The menu bar displays the menus from left to right on the bar according to their assigned index. In theory, there is one exception: the help menu. You are supposed to be allowed to mark one menu as the help menu; the location of the help menu is up to the LF. In practice, trying to do this results in JMenuBar throwing an Error.
Menu Bar Placement
You can attach menu bars to Swing frames or applets in one of two ways. First, you can use thesetJMenuBar( ) method of JFrame, JDialog, JApplet, or JInternalFrame:
JFrame frame = new JFrame(Menu);
JMenuBar menuBar = new JMenuBar( );
// Attach the menu bar to the frame.
frame.setJMenuBar(menuBar);
The setJMenuBar( ) method is analogous to thesetMenuBar( ) method ofjava.awt.Frame. Like its predecessor, setJMenuBar( ) allows the LF to determine the location of the menu (typically, it anchors the menu bar to the top of a frame, adjusting the frame
您可能关注的文档
最近下载
- 大数据技术融合人力资源管理.docx VIP
- 2026年中国大型广告牌行业市场数据调查、监测研究报告.docx
- 2025年江苏省建筑施工企业主要负责人安全员A证考核考试题库附答案.docx
- 新编语文课程与教学论讲义.docx VIP
- 苏科版数学八年级下册期中测试试卷-含答案02.pdf VIP
- 03-【传统村落保护规划】宁波韩岭古村总体改造方案-DC国际-366页.pdf VIP
- 汽车调光玻璃行业市场前景及投资研究报告:天幕玻璃,国产厂商突破瓶颈,价格下探.pdf VIP
- 金融大数据与人工智能的融合趋势.docx VIP
- 上肢康复训练系统技术参数.docx VIP
- 五年级下册每日计算.pdf VIP
原创力文档

文档评论(0)