JHTP自测题_第十二章_GUI组件(上篇)
来源:互联网 发布:java 开源项目源码 编辑:程序博客网 时间:2024/06/09 21:03
12.1Fill in the blanks in each of the following statements:
a) MethodMouseMoved is called when the mouse is moved with no buttons pressed and an event listener is registered to handle the event.
b) Text that cannot be modified by the user is calleduneditable (read-only) text.
c) A(n)layout manager arranges GUI components in aContainer.
d) Theaddmethod for attaching GUI components is a method of classContainer.
e) GUI is an acronym forGraphical User Interface.
f) MethodsetLayoutis used to specify the layout manager for a container.
g) AmouseDraggedmethod call is preceded by a(n)mousePressed method call and followed by a(n)mouseReleased method call.
h) ClassJOptionPane contains methods that display message dialogs and input dialogs.
i) An input dialog capable of receiving input from the user is displayed with methodshowInputDialog of classJOptionPane.
j) A dialog capable of displaying a message to the user is displayed with method showMessageDialog of classJOptionPane .
k) BothJTextFields andJTextAreas directly extend class JTextComponent.
12.2Determine whether each statement istrueorfalse. If false, explain why.
a)BorderLayoutis the default layout manager for aJFrame’s content pane. (True)
b) When the mouse cursor is moved into the bounds of a GUI component, methodmouseOveris called. (False, mouseEntered)
c) AJPanelcannot be added to anotherJPanel (False).
d) In aBorderLayout, two buttons added to the NORTHregion will be placed side by side. (False)
e) A maximum of five components can be added to aBorderLayout. (True)
f) Inner classes are not allowed to access the members of the enclosing class. (False)
g) AJTextArea’s text is always read-only (False).
h) ClassJTextAreais a direct subclass of classComponent (False).
12.3Find the error(s) in each of the following statements, and explain how to correct it (them):
a)buttonName = JButton("Caption"); ->new
b)JLabel aLabel, JLabel; (JLabel is a class name and cannot be used as a variable name)
c)txtField =newJTextField(50,"DefaultText"); (The arguments passed to the constructor are reversed. The String must be passed first.)
d)setLayout(newBorderLayout());
button1 =newJButton("North Star");
button2 =newJButton("South Pole");
add(button1);
add(button2);
- JHTP自测题_第十二章_GUI组件(上篇)
- JHTP小结_第十二章_GUI组件(上篇)-Part 1
- JHTP小结_第十二章_GUI组件(上篇)-Part 2
- JHTP自测题_第六章_深入理解方法
- JHTP自测题_第十三章_图形及Java2D
- JHTP自测题_第七章_数组及动态数组(Array and ArrayList)
- JHTP自测题_第九章_面向对象编程-继承(Inheritance)
- JHTP自测题_第十章_面向对象编程-多态(Polymorphism)
- JHTP自测题_第十一章_深入理解异常(Exception Handling)
- JHTP自测题_第十四章_字符串、字符及正则表达式(Strings, Characters and Regular Expressions)
- JHTP自测题_第十五章_文件、流和对象序列化(Files, Streams, and Object Serialization)
- JHTP自测题_第三章_类、对象、方法及字符串简介
- JHTP自测题_第四章_控制语句Part 1-赋值、++、--运算符
- JHTP自测题_第五章_控制语句Part 2-逻辑运算符
- JHTP自测题_第八章_深入理解类和对象
- JHTP自测题_第二章_Java应用、输入、输出及运算符简介
- JHTP自测题_第一章_计算机、互联网及Java简介
- JHTP小结_第六章_深入理解Methods(方法)
- Android 一些异常
- 转:Bootstrap的常用类(CSS和布局组件)的总结
- POJ 2739 Sum of Consecutive Prime Numbers
- Leetcode 162. Find Peak Element (Medium) (cpp)
- 分析优酷/土豆/pptv/乐视 HTML5、m3u8地址
- JHTP自测题_第十二章_GUI组件(上篇)
- python资料
- C++语法 : 内存池技术的原理与实现
- nodejs--http
- FILL bfs
- Java垃圾回收(一)对象存活状态判断---深入理解Java虚拟机
- Codeforces Round #209 (Div. 2) D - Pair of Numbers
- Swift闭包循环引用
- ORACLE数据库---"ORA-00942: 表或视图不存在 "的原因和解决方法