Deck 19: Graphical User Interfaces
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/76
العب
ملء الشاشة (f)
Deck 19: Graphical User Interfaces
1
Which layout manager may change the location and size of existing components when new ones are added?
I FlowLayout
II BorderLayout
III GridLayout
A) I
B) II
C) I and III
D) II and III
I FlowLayout
II BorderLayout
III GridLayout
A) I
B) II
C) I and III
D) II and III
B
2
The JFrame has a content pane with a default BorderLayout manager. Which method allows changing it to a FlowLayout manager?
A) setLayout
B) setFlowLayout
C) assignLayout
D) changeLayout
A) setLayout
B) setFlowLayout
C) assignLayout
D) changeLayout
A
3
What is the default layout manager of the content pane of a JFrame?
A) FlowLayout
B) GridLayout
C) BoxLayout
D) BorderLayout
A) FlowLayout
B) GridLayout
C) BoxLayout
D) BorderLayout
D
4
Which layout manager allows you to add components to it by invoking the container's add method with the component as the only argument to add.
I FlowLayout
II BorderLayout
III GridLayout
A) I
B) II
C) III
D) I and III
I FlowLayout
II BorderLayout
III GridLayout
A) I
B) II
C) III
D) I and III
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
5
Which layout manager places objects left-to-right, row by row into a fixed set of rows and columns?
A) FlowLayout
B) BorderLayout
C) BoxLayout
D) GridLayout
A) FlowLayout
B) BorderLayout
C) BoxLayout
D) GridLayout
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
6
What is the default layout manager of JPanel?
A) FlowLayout
B) GridLayout
C) BoxLayout
D) GridBagLayout
A) FlowLayout
B) GridLayout
C) BoxLayout
D) GridBagLayout
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
7
By default, a JPanel uses a _______ layout.
A) border
B) flow
C) grid
D) grid bag
A) border
B) flow
C) grid
D) grid bag
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
8
Which layout manager uses a grid, but allows selected grid locations to span multiple rows or columns?
I GridBagLayout
II BorderLayout
III GridLayout
A) I
B) II
C) III
D) I and III
I GridBagLayout
II BorderLayout
III GridLayout
A) I
B) II
C) III
D) I and III
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
9
Which layout manger would be best suited to create a simple navigation GUI with directional arrows for left, right, up, down and enter?
A) GridLayout
B) BorderLayout
C) FlowLayout
D) GridBagLayout
A) GridLayout
B) BorderLayout
C) FlowLayout
D) GridBagLayout
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
10
Which class has constants called NORTH and SOUTH?
A) FlowLayout
B) BorderLayout
C) BoxLayout
D) GridLayout
A) FlowLayout
B) BorderLayout
C) BoxLayout
D) GridLayout
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
11
What is the easiest way to create complex-looking GUI layouts?
I use the GridBagLayout manager
II nest panels, each with its own layout manager
III use multiple layout managers in the same container
A) I
B) II
C) III
D) I and III
I use the GridBagLayout manager
II nest panels, each with its own layout manager
III use multiple layout managers in the same container
A) I
B) II
C) III
D) I and III
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
12
Which layout manager uses a grid so that each component will always be placed into an area of the same size?
I GridBagLayout
II BorderLayout
III GridLayout
A) I
B) II
C) III
D) I and III
I GridBagLayout
II BorderLayout
III GridLayout
A) I
B) II
C) III
D) I and III
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
13
If you want to have a tabular arrangement of components, in which columns have different sizes or one component spans multiple columns, a ____ would be appropriate.
A) grid bag layout
B) grid layout
C) flow layout
D) border layout
A) grid bag layout
B) grid layout
C) flow layout
D) border layout
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
14
How do you add two buttons to the south area of a frame using the BorderLayout?
A) Add them to a panel, then add the panel to the SOUTH
B) Add one to the SOUTH, then add the second one to the SOUTH
C) Add one to the SOUTH, then add the second one to the CENTER
D) Add one to the CENTER, then add the second one to the SOUTH
A) Add them to a panel, then add the panel to the SOUTH
B) Add one to the SOUTH, then add the second one to the SOUTH
C) Add one to the SOUTH, then add the second one to the CENTER
D) Add one to the CENTER, then add the second one to the SOUTH
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
15
Which layout manager places objects left-to-right, and creates a new row only if when the current row cannot accommodate another object?
A) FlowLayout
B) BorderLayout
C) BoxLayout
D) GridLayout
A) FlowLayout
B) BorderLayout
C) BoxLayout
D) GridLayout
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
16
To create a _____ layout, you supply the number of rows and columns in the constructor, then add the components, row by row, left to right.
A) border
B) grid
C) grid bag
D) boxed
A) border
B) grid
C) grid bag
D) boxed
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
17
Which layout manager constructor call would be best-suited to create a telephone handset GUI which has three rows of three keys each with labels, 1,2,3,4,5,6,7,8,9, and a fourth row with labels *, 0, and #?
A) new GridLayout(3, 4)
B) new GridLayout(4, 3)
C) new FlowLayout(4, 3)
D) new BorderLayout(3, 4)
A) new GridLayout(3, 4)
B) new GridLayout(4, 3)
C) new FlowLayout(4, 3)
D) new BorderLayout(3, 4)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
18
Which layout manager allows you to add components in different orders, with the result being the same GUI appearance?
I FlowLayout
II BorderLayout
III GridLayout
A) I
B) II
C) I and III
D) II and III
I FlowLayout
II BorderLayout
III GridLayout
A) I
B) II
C) I and III
D) II and III
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
19
In Java, each container has its own ____________________, which determines how the components are laid out.
A) container
B) layout manager
C) Swing component
D) frame manager
A) container
B) layout manager
C) Swing component
D) frame manager
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
20
When adding a component to a container with the ____ layout, specify the NORTH, EAST, SOUTH, WEST, or CENTER position.
A) border
B) grid
C) grid bag
D) flow
A) border
B) grid
C) grid bag
D) flow
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
21
A(n) ____ is used when you have a large set of choices.
A) combo box
B) radio button
C) check box
D) action event
A) combo box
B) radio button
C) check box
D) action event
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
22
What is the container for top-level menu items?
A) menu bar
B) menu item
C) menu GUI
D) top level menus don't use containers
A) menu bar
B) menu item
C) menu GUI
D) top level menus don't use containers
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
23
Which method can a program use to set the selected choice in a JRadioButton?
A) set
B) setChoice
C) setSelectedItem
D) setSelected
A) set
B) setChoice
C) setSelectedItem
D) setSelected
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
24
What type does the method getSelectedItem in the JComboBox class return?
A) Object
B) String
C) JRadioButton
D) JLabel
A) Object
B) String
C) JRadioButton
D) JLabel
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
25
What type of object can be added into a JComboBox by the addItem method?
A) Object
B) String
C) JRadioButton
D) any non-primitive type
A) Object
B) String
C) JRadioButton
D) any non-primitive type
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which GUI element allows text entry from the program user?
A) ButtonGroup
B) JComboBox
C) JSlider
D) JPanel
A) ButtonGroup
B) JComboBox
C) JSlider
D) JPanel
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
27
Which of the following is not a visual component?
A) JRadioButton
B) JButton
C) ButtonGroup
D) JCheckBox
A) JRadioButton
B) JButton
C) ButtonGroup
D) JCheckBox
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
28
Which method can a program use to set the selected choice in a JComboBox?
A) select
B) setChoice
C) setSelectedItem
D) The selection can only be set through the GUI by the user.
A) select
B) setChoice
C) setSelectedItem
D) The selection can only be set through the GUI by the user.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
29
When the user selects a menu item, the menu item sends a(n) ___________________.
A) ActionEvent
B) ChangeEvent
C) ItemEvent
D) MouseEvent
A) ActionEvent
B) ChangeEvent
C) ItemEvent
D) MouseEvent
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
30
____________________ are round and have a black dot when selected.
A) Swing components
B) Selection buttons
C) Radio buttons
D) Check boxes
A) Swing components
B) Selection buttons
C) Radio buttons
D) Check boxes
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following GUI objects generate(s) action events?
I JComboBox
II JRadioButton
III JButton
A) I
B) I and II
C) I and III
D) I, II and III
I JComboBox
II JRadioButton
III JButton
A) I
B) I and II
C) I and III
D) I, II and III
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
32
The statement that would add smallButton to the button group in the following code is _________. JRadioButton smallButton = new JRadioButton("Small");
ButtonGroup group = new ButtonGroup();
A) group.add(new smallButton);
B) group.add(smallButton);
C) smallButton.add();
D) You cannot add smallButton to the button group.
ButtonGroup group = new ButtonGroup();
A) group.add(new smallButton);
B) group.add(smallButton);
C) smallButton.add();
D) You cannot add smallButton to the button group.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
33
When using a combo box, the _______ displays the name of the current selection.
A) text field
B) text area
C) menu item
D) submenu item
A) text field
B) text area
C) menu item
D) submenu item
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
34
Which of the following classes have a user-editable area?
A) JCheckBox
B) JComboBox
C) ButtonGroup
D) JRadioButton
A) JCheckBox
B) JComboBox
C) ButtonGroup
D) JRadioButton
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
35
Which of the following methods returns the object that was selected in the JComboBox?
A) getSelected
B) getItem
C) getChoice
D) getSelectedItem
A) getSelected
B) getItem
C) getChoice
D) getSelectedItem
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
36
A ________ is a user-interface component with two states: checked and unchecked.
A) radio button
B) check box
C) menu item
D) submenu item
A) radio button
B) check box
C) menu item
D) submenu item
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
37
Insert the missing code in the following segment. The code intends to get the newly selected item from the combo box. JComboBox facenameCombo = new JComboBox();
String selectedString = __________________________;
A) (String) facenameCombo.getSelected();
B) (String) facenameCombo.getSelectedItem();
C) (String) selectedString.getSelected();
D) (String) selectedString.getSelectedItem();
String selectedString = __________________________;
A) (String) facenameCombo.getSelected();
B) (String) facenameCombo.getSelectedItem();
C) (String) selectedString.getSelected();
D) (String) selectedString.getSelectedItem();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
38
The event that is generated by a slider when its value changes is of type _____.
A) ActionEvent
B) ChangeEvent
C) ItemEvent
D) MouseEvent
A) ActionEvent
B) ChangeEvent
C) ItemEvent
D) MouseEvent
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
39
A ____ is a combination of a list and a text field.
A) radio button
B) combo box
C) check box
D) scroll bar
A) radio button
B) combo box
C) check box
D) scroll bar
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
40
Which of the following classes has a Boolean state that can be set or unset through the GUI?
A) JCheckBox
B) JButton
C) ButtonGroup
D) JMenuItem
A) JCheckBox
B) JButton
C) ButtonGroup
D) JMenuItem
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
41
The _______ interface toolkit has a large set of user-interface components.
A) GUI Builder
B) graphical user
C) Swing
D) JMenu
A) GUI Builder
B) graphical user
C) Swing
D) JMenu
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
42
The ChangeEvent class defines no methods. What makes it possible to call the getSource method on a ChangeEvent object?
A) The method is inherited from the Object class.
B) You have to code that method yourself.
C) The method is inherited from the EventObject class.
D) ChangeEvent implements the Event interface
A) The method is inherited from the Object class.
B) You have to code that method yourself.
C) The method is inherited from the EventObject class.
D) ChangeEvent implements the Event interface
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
43
What is the best way to start using Swing components?
A) Use a few classes with basic properties and methods, then explore API documentation
B) Learn all the classes in Swing and their inheritance hierarchies
C) Learn all the methods of the JComponent superclass before using any Swing components
D) Use a Swing component only after understanding all of its constructors
A) Use a few classes with basic properties and methods, then explore API documentation
B) Learn all the classes in Swing and their inheritance hierarchies
C) Learn all the methods of the JComponent superclass before using any Swing components
D) Use a Swing component only after understanding all of its constructors
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
44
A complex GUI can be created with a set of nested panels. What should determine the components that go into a single panel?
A) the type of components
B) the size of the components
C) the adjacency of the components
D) the names of the components
A) the type of components
B) the size of the components
C) the adjacency of the components
D) the names of the components
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
45
Examine the code below. What type of class is MyMenuListener? public JMenuItem makeMenuItem(String menuLabel)
{
JMenuItem mini = new JMenuItem(menuLabel);
Class MyMenuListener implements ActionListener
{
Public void actionPerformed(ActionEvent
A) It is an anonymous class
B) It is an inner class
C) It is a JMenuItem subclass
D) It is a JMenu class
E) {
DoSomething();
}
}
Mini.addActionListener(new MyMenuListener());
Return mi;
}
{
JMenuItem mini = new JMenuItem(menuLabel);
Class MyMenuListener implements ActionListener
{
Public void actionPerformed(ActionEvent
A) It is an anonymous class
B) It is an inner class
C) It is a JMenuItem subclass
D) It is a JMenu class
E) {
DoSomething();
}
}
Mini.addActionListener(new MyMenuListener());
Return mi;
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
46
Which component can generate action events?
I JMenuBar
II JMenu
III JMenuItem
A) I
B) II
C) III
D) II and III
I JMenuBar
II JMenu
III JMenuItem
A) I
B) II
C) III
D) II and III
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
47
If one ChangeListener is listening for three different JSlider objects, how can we determine which of the three sliders caused the event when the code enters the stateChanged method?
A) It is not possible.
B) We can compare the sliders using the getSource method.
C) We can call the getValueIsAdjusting method.
D) We can compare the sliders using the getSliderSource method.
A) It is not possible.
B) We can compare the sliders using the getSource method.
C) We can call the getValueIsAdjusting method.
D) We can compare the sliders using the getSliderSource method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
48
What type of event does the JSlider class generate?
A) ChangeEvent
B) ActionEvent
C) ItemEvent
D) SliderEvent
A) ChangeEvent
B) ActionEvent
C) ItemEvent
D) SliderEvent
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
49
Suppose a JPanel with a BorderLayout manager contains two components: component1, which was added to the NORTH, and component2, which was added to the SOUTH. Which parts of the JPanel will appear?
I North
II South
III Center
IV West
V East
A) I, II and III
B) II, IV an V
C) III, IV and V
D) I, II, III, IV an V
I North
II South
III Center
IV West
V East
A) I, II and III
B) II, IV an V
C) III, IV and V
D) I, II, III, IV an V
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
50
What is the best way to discover the set of Swing components?
A) Randomly drag them into a visual appllication with a GUI builder
B) Write code to instantiate each component one at a time
C) Read the documentation for Swing
D) Run the SwingSet demo included in the JDK, Java Development Kit
A) Randomly drag them into a visual appllication with a GUI builder
B) Write code to instantiate each component one at a time
C) Read the documentation for Swing
D) Run the SwingSet demo included in the JDK, Java Development Kit
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
51
If the makeMenuItem method is called four times, at most how many different actions can be performed by these four newly created MenuItem objects when the doSomethingElse method is called? public JMenuItem makeMenuItem(String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel);
Class MyMenuListener implements ActionListener
{
Public void actionPerformed(ActionEvent
A) 1
B) 2
C) 3
D) 4
E) {
DoSomethingElse(e);
}
}
Mi)addActionListener(new MyMenuListener());
Return mi;
}
{
JMenuItem mi = new JMenuItem(menuLabel);
Class MyMenuListener implements ActionListener
{
Public void actionPerformed(ActionEvent
A) 1
B) 2
C) 3
D) 4
E) {
DoSomethingElse(e);
}
}
Mi)addActionListener(new MyMenuListener());
Return mi;
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
52
Suppose a JPanel with a BorderLayout manager contains two components: component1, which was added to the CENTER, and component2, which was added to the SOUTH. Which parts of the JPanel will appear?
I North
II South
III Center
IV West
V East
A) I, II
B) I, II, III
C) III, IV and V
D) II and III
I North
II South
III Center
IV West
V East
A) I, II
B) I, II, III
C) III, IV and V
D) II and III
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
53
If a JPanel with a BorderLayout manager contains a single component that was added to the CENTER, which parts of the JPanel does the component fill?
I North
II South
III Center
IV West
V East
A) I, II and III
B) II, IV an V
C) III, IV and V
D) I, II, III, IV and V
I North
II South
III Center
IV West
V East
A) I, II and III
B) II, IV an V
C) III, IV and V
D) I, II, III, IV and V
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
54
What is the best first step in picking the layout managers for a set of nested panels?
A) use a single panel with a GridBagLayout manager
B) construct a set of JPanel objects
C) make a sketch of the layout
D) use multiple panels with FlowLayout managers
A) use a single panel with a GridBagLayout manager
B) construct a set of JPanel objects
C) make a sketch of the layout
D) use multiple panels with FlowLayout managers
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
55
Which code will create a JSlider with a range from 0 to 100, with an initial value of 50?
I new JSlider()
II new JSlider(0, 100, 50)
III new JSlider(50, 0, 100)
A) I
B) II
C) III
D) I and II
I new JSlider()
II new JSlider(0, 100, 50)
III new JSlider(50, 0, 100)
A) I
B) II
C) III
D) I and II
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
56
For a new programmer using the Swing JSlider component for the first time, which of these is the least important thing to know?
A) a basic way to construct a JSlider
B) what type of events it generates
C) how to write the BoundedRangeModel constructor
D) its value when an event occurs
A) a basic way to construct a JSlider
B) what type of events it generates
C) how to write the BoundedRangeModel constructor
D) its value when an event occurs
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
57
What can be determined about obj from the code below? JMenuItem menuItem = new JMenuItem("Exit");
MenuItem.addActionListener(obj);
A) The class of obj implements ActionListener
B) menuItem implements ActionListener
C) obj is of type MenuListener
D) obj is an object of an inner class
MenuItem.addActionListener(obj);
A) The class of obj implements ActionListener
B) menuItem implements ActionListener
C) obj is of type MenuListener
D) obj is an object of an inner class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
58
If the method makeMenuItem is called four times, how many MyMenuListener objects will be created? public JMenuItem makeMenuItem(String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel);
Class MyMenuListener implements ActionListener
{
Public void actionPerformed(ActionEvent
A) 1
B) 2
C) 3
D) 4
E) {
DoSomething();
}
}
Mi)addActionListener(new MyMenuListener());
Return mi;
}
{
JMenuItem mi = new JMenuItem(menuLabel);
Class MyMenuListener implements ActionListener
{
Public void actionPerformed(ActionEvent
A) 1
B) 2
C) 3
D) 4
E) {
DoSomething();
}
}
Mi)addActionListener(new MyMenuListener());
Return mi;
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
59
Which component can be added to a menu?
I JMenuBar
II JMenu
III JMenuItem
A) I
B) I and II
C) II and III
D) I, II and III
I JMenuBar
II JMenu
III JMenuItem
A) I
B) I and II
C) II and III
D) I, II and III
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
60
What method is required by the ChangeListener interface?
A) changeOccured
B) actionPerformed
C) stateChanged
D) sliderMoved
A) changeOccured
B) actionPerformed
C) stateChanged
D) sliderMoved
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
61
You can add a(n) _________ to a panel to make it visible.
A) component
B) JFrame
C) border
D) another panel
A) component
B) JFrame
C) border
D) another panel
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
62
What is known for certain from this correct code excerpt? ActionListener openListener = new FileOpenListener();
JMenuItem fileOpen = new JMenuItem("Open File");
FileOpen.addActionListener(openListener);
A) fileOpen will open a file dialog when clicked
B) The fileOpen menu item will be visible
C) The FileOpenListener class implements the ActionListener interface
D) The openListener object will only listen to the fileOpen object
JMenuItem fileOpen = new JMenuItem("Open File");
FileOpen.addActionListener(openListener);
A) fileOpen will open a file dialog when clicked
B) The fileOpen menu item will be visible
C) The FileOpenListener class implements the ActionListener interface
D) The openListener object will only listen to the fileOpen object
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
63
Suppose a JPanel with a BorderLayout manager contains two components: component1, which was added to the EAST, and component2, which was added to the WEST. Which parts of the JPanel appear?
I North
II South
III Center
IV West
V East
A) I, II
B) I, II, III
C) III, IV and V
D) IV an V
I North
II South
III Center
IV West
V East
A) I, II
B) I, II, III
C) III, IV and V
D) IV an V
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
64
Given four JRadioButton objects in a ButtonGroup, how many radio buttons can be selected at the same time?
A) 1
B) 2
C) 4
D) 3
A) 1
B) 2
C) 4
D) 3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
65
Which of the following statements is correct?
A) new JSlider() creates a horizontal slider with the range 0 to 200 and an initial value of 100.
B) new JSlider() creates a horizontal slider with the range 0 to 10 and an initial value of 5.
C) new JSlider() creates a horizontal slider with the range 0 to 100 and an initial value of 50.
D) new JSlider() creates a horizontal slider with the range 0 to 150 and an initial value of 100.
A) new JSlider() creates a horizontal slider with the range 0 to 200 and an initial value of 100.
B) new JSlider() creates a horizontal slider with the range 0 to 10 and an initial value of 5.
C) new JSlider() creates a horizontal slider with the range 0 to 100 and an initial value of 50.
D) new JSlider() creates a horizontal slider with the range 0 to 150 and an initial value of 100.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
66
Which elements of creating a graphical user interface are made easier by a GUI builder?
I creating event handlers
II configuring component properties
III adding components
A) II
B) I and II
C) I and III
D) I, II and III
I creating event handlers
II configuring component properties
III adding components
A) II
B) I and II
C) I and III
D) I, II and III
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
67
How do the lifetimes of the three objects menuLabel, mi, and the anonymous object new MyMenuListener()compare? public JMenuItem makeMenuItem(final String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel);
Class MyMenuListener implements ActionListener
{
Public void actionPerformed(ActionEvent
A) all have the same lifetimes
B) menuLabel and new MyMenuListener()are the same and both longer than mi
C) mi and new MyMenuListener()are the same and both longer than menuLabel
D) from shortest to longest: menuLabel, new MyMenuListener(), mi
E) {
DoSomethingElse();
System.out.println(menuLabel);
}
}
Mi)addActionListener(new MyMenuListener());
Return mi;
}
{
JMenuItem mi = new JMenuItem(menuLabel);
Class MyMenuListener implements ActionListener
{
Public void actionPerformed(ActionEvent
A) all have the same lifetimes
B) menuLabel and new MyMenuListener()are the same and both longer than mi
C) mi and new MyMenuListener()are the same and both longer than menuLabel
D) from shortest to longest: menuLabel, new MyMenuListener(), mi
E) {
DoSomethingElse();
System.out.println(menuLabel);
}
}
Mi)addActionListener(new MyMenuListener());
Return mi;
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
68
When method makeMenuItem is called, how many objects are being created? public JMenuItem makeMenuItem(final String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel);
Class MyMenuListener implements ActionListener
{
Public void actionPerformed(ActionEvent
A) 1
B) 2
C) 3
D) 4
E) {
DoSomethingElse();
System.out.println(menuLabel);
}
}
Mi)addActionListener(new MyMenuListener());
Return mi;
}
{
JMenuItem mi = new JMenuItem(menuLabel);
Class MyMenuListener implements ActionListener
{
Public void actionPerformed(ActionEvent
A) 1
B) 2
C) 3
D) 4
E) {
DoSomethingElse();
System.out.println(menuLabel);
}
}
Mi)addActionListener(new MyMenuListener());
Return mi;
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
69
The documentation for the JSlider class lists ____ inherited methods.
A) less than 5
B) about 25
C) about 250
D) over 2500
A) less than 5
B) about 25
C) about 250
D) over 2500
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
70
Which of the following adds a border to the following panel? JPanel panel = new JPanel();
A) panel.addEtchedBorder();
B) panel.addBorder(new EtchedBorder());
C) panel.add(new EtchedBorder());
D) panel.setBorder(new EtchedBorder());
A) panel.addEtchedBorder();
B) panel.addBorder(new EtchedBorder());
C) panel.add(new EtchedBorder());
D) panel.setBorder(new EtchedBorder());
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
71
What features do GUI builders have to speed the development of the graphical user interface of the program?
I setting properties of dialog boxes
II automated event-handling code generation
III drag and drop of visual components
A) I
B) II
C) II and III
D) I, II and III
I setting properties of dialog boxes
II automated event-handling code generation
III drag and drop of visual components
A) I
B) II
C) II and III
D) I, II and III
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
72
Based on the statement below, which of the following adds a title to the border? JPanel panel = new JPanel();
A) panel.setBorder(new TitledBorder());
B) panel.setBorder(new TitledBorder(new EtchedBorder(), "Size"));
C) panel.setBorder(new TitledBorder(new EtchedBorder()));
D) panel.setTitle("Size");
A) panel.setBorder(new TitledBorder());
B) panel.setBorder(new TitledBorder(new EtchedBorder(), "Size"));
C) panel.setBorder(new TitledBorder(new EtchedBorder()));
D) panel.setTitle("Size");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
73
What is wrong with the following code? class ExitListener implements ActionListener
{
Public void actionPerformed(ActionEvent event)
{
System.exit(0);
}
}
ActionListener exitListener = new ExitListener();
JMenu exitMenu = new JMenu("Exit");
ExitMenu.addActionListener(exitListener);
JMenuBar menuBar = new JMenuBar();
MenuBar.add(exitMenu);
A) The ExitListener class is not public
B) You cannot attach a listener to a menu, only to a menu item
C) You cannot add a menu to the menu bar, only a menu item
D) You need to use a menu listener, not an action listener
{
Public void actionPerformed(ActionEvent event)
{
System.exit(0);
}
}
ActionListener exitListener = new ExitListener();
JMenu exitMenu = new JMenu("Exit");
ExitMenu.addActionListener(exitListener);
JMenuBar menuBar = new JMenuBar();
MenuBar.add(exitMenu);
A) The ExitListener class is not public
B) You cannot attach a listener to a menu, only to a menu item
C) You cannot add a menu to the menu bar, only a menu item
D) You need to use a menu listener, not an action listener
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
74
When a menu item is selected, what type of event does it send?
A) ActionEvent
B) ChangeEvent
C) ItemEvent
D) SelectionEvent
A) ActionEvent
B) ChangeEvent
C) ItemEvent
D) SelectionEvent
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
75
What is the most time-effective way to build a GUI quickly and concentrate on coding the logic of the program?
A) use the GridBagLayout manager
B) use a GUI builder, such as NetBeans
C) use nested panels
D) use menus
A) use the GridBagLayout manager
B) use a GUI builder, such as NetBeans
C) use nested panels
D) use menus
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck
76
The code below will not compile successfully unless the argument to the makeMenuItem method is final. Why not? public JMenuItem makeMenuItem(final String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel);
Class MyMenuListener implements ActionListener
{
Public void actionPerformed(ActionEvent
A) JMenuItem labels must be final
B) This prevents the menuLabel argument from being modified
C) Because a local variable is being accessed from an inner classes
D) Because the String class is final
E) {
DoSomethingElse();
System.out.println(menuLabel);
}
}
Mi)addActionListener(new MyMenuListener());
Return mi;
}
{
JMenuItem mi = new JMenuItem(menuLabel);
Class MyMenuListener implements ActionListener
{
Public void actionPerformed(ActionEvent
A) JMenuItem labels must be final
B) This prevents the menuLabel argument from being modified
C) Because a local variable is being accessed from an inner classes
D) Because the String class is final
E) {
DoSomethingElse();
System.out.println(menuLabel);
}
}
Mi)addActionListener(new MyMenuListener());
Return mi;
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 76 في هذه المجموعة.
فتح الحزمة
k this deck