- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Introduction to Java Programming Chapter 12 Introduction to Java Progrmming Chapter 12 GUI Basics Chapter 12 In this chapter, you will learn the following concepts: simple GUI components role of layout managers FlowLayout, GridLayout, and BorderLayout managers Color and Font JPanel 12.1 Introduction This chapter introduces GUI components and their relationships, containers and layout managers, colors, fonts, borders, and tool tips. 12.2 GUI Components 12.2 GUI Components // Create a button with text OK JButton jbtOK = new JButton(OK); ? // Create a label with text Enter your name: JLabel jlblName = new JLabel(Enter your name: ); ? // Create a text field with text Type Name Here JTextField jtfName = new JTextField(Type Name Here); ? // Create a check box with text bold JCheckBox jchkBold = new JCheckBox(Bold); ? // Create a radio button with text red JRadioButton jrbRed = new JRadioButton(Red); ? // Create a combo box with choices red, green, and blue JComboBox jcboColor = new JComboBox(new String[]{Red, Green, Blue}); 12.2.1 Swing vs. AWT So why do the GUI component classes have a prefix J? Instead of JButton, why not name it simply Button? In fact, there is a class already named Button in the java.awt package. Swing vs. AWT When Java was introduced, the GUI classes were bundled in a library known as the Abstract Windows Toolkit (AWT). For every platform on which Java runs, the AWT components are automatically mapped to the platform-specific components through their respective agents, known as peers. AWT is fine for developing simple graphical user interfaces, but not for developing comprehensive GUI projects. Besides, AWT is prone to platform-specific bugs because its peer-based approach relies heavily on the underlying platform. With the release of Java 2, the AWT user-interface components were replaced by a more robust, versatile, and flexible library known as Swing components. Swing components are painted directly on canvases usin
您可能关注的文档
- 东华大学计算机科学与技术学院计算机系统与网络技术课件 第二十九讲.ppt
- 东华大学计算机科学与技术学院计算机系统与网络技术课件 第二十六讲.ppt
- 东华大学计算机科学与技术学院计算机系统与网络技术课件 第二十七讲.ppt
- 东华大学计算机科学与技术学院计算机系统与网络技术课件 第二十四讲.ppt
- 东华大学计算机科学与技术学院计算机系统与网络技术课件 第二十五讲.ppt
- 东华大学计算机科学与技术学院计算机系统与网络技术课件 第九讲.ppt
- 东华大学计算机科学与技术学院计算机系统与网络技术课件 第六讲.ppt
- 东华大学计算机科学与技术学院计算机系统与网络技术课件 第七讲.ppt
- 东华大学计算机科学与技术学院计算机系统与网络技术课件 第三讲.ppt
- 东华大学计算机科学与技术学院计算机系统与网络技术课件 第三十二讲.ppt
- 辽宁省部分学校2025-2026学年高三9月开学联考地理试题.docx
- 江苏省徐州市鼓楼区徐州市第三中学2025-2026学年高三上学期8月月考生物试题.docx
- 辽宁大连瓦房店市2024-2025学年八年级上学年10月份数学练习试卷.docx
- 辽宁省鞍山市华育高新区学校 2024-2025学年九年级上学期10月月考道德与法治试题(pdf版,含答案).docx
- 辽宁鞍山市第二中学2025—2026学年九年级上学期开学考试英语试题.docx
- 辽宁省鞍山市华育高新区学校2024-2025学年九年级上学期10月月考英语试题.docx
- 辽宁省鞍山市华育高新区学校2024-2025学年九年级上学期10月月考语文试题.docx
- 坚持以基层党建和业务经营深度融合,推动国有企业高质量发展.pptx
- 企业安全生产培训—践行绿色发展,筑牢安全防线.pptx
- 中诚信国际-一揽子化债以来,城投公司并购上市公司事件特征观察.pdf
文档评论(0)