Deck 12: A First Look at GUI Applications

ملء الشاشة (f)
exit full mode
سؤال
When using the BorderLayout manager, how many components can each region hold?

A) 1
B) 2
C) 5
D) No limit
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The minimize button, maximize button, and close button on a window are sometimes referred to as:

A) operations buttons
B) sizing buttons
C) decorations
D) display buttons
سؤال
This is an action that takes place in an application, such as the clicking of a button.

A) instance
B) effect
C) case
D) event
سؤال
These components have a consistent look and predictable behavior on any operating system.

A) AWT
B) GUI
C) Swing
D) Peer classes
سؤال
If panel references a JPanel object, which of the following statements adds the GridLayout to it?

A) panel.setLayout(new (GridLayout(2,3));
B) panel.addLayout(new (GridLayout(2,3));
C) panel.GridLayout(2,3);
D) panel.attachLayout(GridLayout(2,3));
سؤال
In a Swing application, you create a frame object from the:

A) Jlabel class
B) JFrame class
C) Jpanel class
D) AbstractButton class
سؤال
Which one of the following GUI components is considered to be a container?

A) Frame
B) Label
C) Slider
D) Button
سؤال
________ is a library of classes that do not replace ________, but provide an improved alternative for creating GUI applications.

A) AWT, Swing
B) Swing, AWT
C) JFC, AWT
D) JFC, Swing
سؤال
This is commonly used to hold and organize collections of related components:

A) list
B) panel
C) frame
D) label
سؤال
In Swing, labels are created with this class:

A) JFCLabel
B) AWTLabel
C) JLabel
D) SwingLabel
سؤال
One of the small dots that make up a screen display is known as what?

A) point
B) color
C) pixel
D) texture
سؤال
To use the ActionListener interface, as well as other event listener interfaces, you must have the following import statement in your code:

A) import java.swing;
B) import java.awt;
C) import java.awt.*;
D) import java.awt.event.*;
سؤال
To end an application, pass this as the argument to the JFrame class's setDefaultCloseOperation() method.

A) END_ON_CLOSE
B) JFrame.END_ON_CLOSE
C) JFrame.EXIT_ON_CLOSE
D) JFrame.CLOSE_NOT_HIDE
سؤال
In GUI terminology, a container that can be displayed as a window is known as a:

A) message dialog
B) buffer
C) Swing package
D) frame
سؤال
To use the Color class, which is used to set the foreground and background of various objects, use the following import statement:

A) import java.swing;
B) import java.awt;
C) import java.awt.*;
D) import java.awt.event.*;
سؤال
This layout manager arranges components in regions named North, South, East, West, and Center.

A) GridLayout
B) BorderLayout
C) FlowLayout
D) RegionLayout
سؤال
Because these components rely on the appearance and behavior of the underlying operating system components, there is little that can be done by the programmer to change their properties.

A) Swing
B) AWT
C) Container
D) JFC
سؤال
Programs that operate in a GUI environment must be:

A) event driven
B) in color
C) dialog boxes
D) layout managers
سؤال
When you write an action listener class for a JButton component, it must:

A) have a method named buttonClicked
B) implement the ActionLIstener interface
C) have a method named actionPerformed which must take an argument of the ActionEvent type
D) both B and C
سؤال
This layout manager arranges components in rows.

A) GridLayout
B) BorderLayout
C) FlowLayout
D) RegionLayout
سؤال
JFC stands for:

A) Java Fundamental Classes
B) Java Foundation Classes
C) Java Fundamental Core
D) Java Frame Class
سؤال
When this is the argument passed to the JFrame class's setDefaultCloseOperation() method, the application is hidden, but not closed.

A) HIDE_ON_CLOSE
B) JFrame. HIDE_ON_CLOSE
C) JFrame.EXIT_ON_CLOSE
D) JFrame.HIDE_NOT_CLOSE
سؤال
Which of the following is NOT a rule for the FlowLayout manager?

A) Multiple components can be added to a container that uses a FlowLayout manager.
B) New components will be added in a row from left to right.
C) When there is no more room in a row, additional components are put on the next row.
D) All of these are rules for the FlowLayout manager.
سؤال
AWT components are commonly called ________ components because they are coupled with their underlying peer classes.

A) lightweight
B) featherweight
C) middleweight
D) heavyweight
سؤال
What does the following statement do?
AddButton.addActionListener(new AddButtonListener());

A) Creates an AddButtonListener object
B) Registers the addButton object as an ActionListener with the AddButtonListener object
C) Creates an AddButtonListener object and registers the AddButtonListener object with the addButton
D) Nothing, the statement is invalid.
سؤال
The GridLayout manager limits each cell to only one component. To put two or more components in a cell, do this:

A) Resize the cells so they can hold more
B) You can nest panels inside the cells, and add other components to the panels
C) The statement is False. The GridLayout manager does not have this restriction
D) Resize the components to fit in the cell
سؤال
Assume that radio references a JRadioButton object. To click the radio button in code, use the following statement:

A) radio.Click();
B) Click(radio);
C) Click(radio, true);
D) radio.doClick();
سؤال
What will be the result of executing the following statement?
Panel.setBorder(BorderFactory.createLineBorder(Color.BLUE, 5));

A) The JPanel referenced by panel will have a blue line border that is 5 millimeters thick.
B) The JPanel referenced by panel will have a blue line border that is 5 pixels thick.
C) The JPanel referenced by panel will have a blue line border that is 5 characters thick.
D) The JPanel referenced by panel will have a blue line border that is 5 inches thick.
سؤال
Which of the following statements is NOT true?

A) Radio buttons are round and check boxes are square.
B) Radio buttons are often grouped together and are mutually exclusive; Check boxes are not.
C) Radio buttons and check boxes both implement the ActionListener interface.
D) They are all true.
سؤال
This layout manager arranges components in five regions.

A) GridLayout
B) BorderLayout
C) FlowLayout
D) RegionLayout
سؤال
This is a basic window that has a border around it, a title bar, and a set of buttons for minimizing, maximizing, and closing the window.

A) Pane
B) Container
C) Frame
D) Dialog box
سؤال
How many radio buttons can be selected at the same time as the result of the following code?
Hours = new JRadioButton("Hours");
Minutes = new JRadioButton("Minutes");
Seconds = new JRadioButton("Seconds");
Days = new JRadioButton("Days");
Months = new JRadioButton("Months");
Years = new JRadioButton("Years");
TimeOfDayButtonGroup = new ButtonGroup();
DateButtonGroup = new ButtonGroup();
TimeOfDayButtonGroup.add(hours);
TimeOfDayButtonGroup.add(minutes);
TimeOfDayButtonGroup.add(seconds);
DateButtonGroup.add(days);
DateButtonGroup.add(months);
DateButtonGroup.add(years);

A) 1
B) 2
C) 3
D) 4
سؤال
The variable panel references a JPanel object. The variable bGroup references a ButtonGroup object, which contains several button components. If you want to add the buttons to the panel:

A) use the statement, panel.add(bGroup);
B) use the statement, bGroup.add(panel);
C) use the statement, Panel panel = new Panel(bGroup);
D) add each button to panel one at a time, e.g. panel.add(button1);
سؤال
Event listeners must:

A) implement an interface
B) be included in private inner classes
C) not receive any arguments
D) exit the application once it has handled the event
سؤال
If button1 is a JButton object, which of the following statements will make its background blue?

A) button1.makeBackground(BLUE);
B) button1.setBackground(Color.BLUE);
C) button1.makeBackground(Color.BLUE);
D) button1.set.Background(BLUE);
سؤال
When a component is added to a region in the BorderLayout manager:

A) the component retains its original size
B) it results in a compile time error, if it is too large
C) the component is stretched so it fills up the entire region
D) the region is resized to fit the component
سؤال
You use the ________ key word in a class header to indicate that it implements an interface.

A) listener
B) interface
C) implements
D) static
سؤال
Which of the following statements creates a class that is extended from the JFrame class?

A) JFrame DerivedClass = new JFrame();
B) class JFrame DerivedClass;
C) JFrame(DerivedClass);
D) public class DerivedClass extends JFrame{}
سؤال
When an application uses many components, rather than deriving just one class from the JFrame class, it is often better to encapsulate smaller groups of related components and their event listeners into their own class. A commonly used technique to do this is:

A) To extend a class from the JAbstractButton class to contain other components and their related code
B) To extend a class from the JComponent class to contain other components and their related code
C) To extend a class from the JPanel class to contain other components and their related code
D) To extend a class from the JFrame class to contain other components and their related code
سؤال
To include Swing and AWT components in your program, use the following import statements:

A) import java.swing; import java.awt;
B) import java.swing; import javax.awt;
C) import javax.swing; import java.awt;
D) import javax.swing; import javax.awt;
سؤال
The System.exit method will end the application.
سؤال
Some of the common GUI components are buttons, labels, text fields, check boxes, and radio buttons.
سؤال
The following statement adds the FlowLayout manager to the container, centers the components, and separates the components with a gap of 10 pixels.
setLayout(new FlowLayout());
سؤال
You would use this command at the operating system command line to execute the code in the MyApplication class and display the graphic image Logo·jpg as a splash screen.

A) java MyApplication Logo·jpg
B) java -splash:Logo·jpg MyApplication
C) java MyApplication -splash
D) java Logo·jpg -splash:MyApplication
سؤال
The FlowLayout manager does not allow the programmer to align components.
سؤال
The ability to display splash screens was introduced in Java 6.
سؤال
All operating systems offer the same set of GUI components.
سؤال
You must use the statement import java.swing.*; in order to use the ItemListener interface.
سؤال
When an application uses many components, instead of extending just one class from the JFrame class, a better approach is to:

A) break the application into several smaller applications
B) reconsider the design of the application
C) encapsulate smaller groups of related components and their event listeners into their own classes
D) just go ahead and do it in one large class
سؤال
When adding components to a container that is governed by the GridLayout manager:

A) you cannot specify a cell
B) you specify the cell with the row and column numbers in the add statement
C) you must add them starting with the lower, right cell
D) the components are added automatically by filling up the first column, then the second, etc.
سؤال
Check boxes may be grouped in a ButtonGroup, like radio buttons are.
سؤال
When a splash screen is displayed, the application does not load and execute until the user clicks the splash screen image with the mouse.
سؤال
The ActionEvent argument that is passed to an action listener's actionPerformed method is the event object that was generated in response to an event.
سؤال
Which of the following statements is NOT true?

A) Radio buttons are round and check boxes are square.
B) Radio buttons are often grouped together and are mutually exclusive; Check boxes are not.
C) Radio buttons implement ActionListener; Check boxes implement ItemListener.
D) All of these are true.
سؤال
This is a graphic image that is displayed while an application loads into memory and starts up.

A) The Java 8 trademark screen
B) Memory usage screen
C) Blue screen of death
D) Splash screen
سؤال
A common technique for writing an event listener class is to write it as a private inner class inside the class that creates the GUI.
سؤال
A GUI program automatically stops executing when the end of the main method is reached.
سؤال
What will be the result of executing the following statement?
Panel.setBorder(BorderFactory.createTitleBorder("Title"));

A) The JPanel referenced by panel will have an etched border with the title "Title" displayed on it.
B) The JPanel referenced by panel will have an empty border with the title "Title" displayed on it.
C) The JPanel referenced by panel will have a line border with the title "Title" displayed on it.
D) The JPanel referenced by panel will have a compound border with the title "Title" displayed on it.
سؤال
Why doesn't the following code compile correctly?
Import java.awt.*;
Import java.awt.event.*;
Import javax.swing.*;
Public class ColorCheckBoxWindow extends JFrame
{
Private JCheckBox greenCheckBox;
Private final int WINDOW_WIDTH = 300, WINDOW_HEIGHT = 100;
Public ColorCheckBoxWindow()
{
SetTitle("Green Check Box");
SetSize(WINDOW_WIDTH, WINDOW_HEIGHT);
SetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GreenCheckBox = new JCheckBox("Green");
GreenCheckBox.addItemListener(new CheckBoxListener());
SetLayout(new FlowLayout());
Add(greenCheckBox);
SetVisible(true);
}
Public void itemStateChanged(ItemEvent e)
{
If (e.getSource() == greenCheckBox)
{
System.exit(0);
}
}
}

A) ColorCheckBoxWindow is not implementing the correct listener.
B) The button cannot be added to the content pane.
C) The itemStateChanged method cannot be coded here.
D) greenCheckBox should not be a private member.
سؤال
Assume that the variable checkbox references a JCheckBox object. To determine whether the check box has been selected, use the following code:

A) if (isSelected(checkBox)) {/*code to execute, if selected*/}
B) if (checkBox.isSelected()) {/*code to execute, if selected*/}
C) if (checkBox) {/*code to execute, if selected*/}
D) if (checkBox.doClick()) {/*code to execute, if selected*/}
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/60
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 12: A First Look at GUI Applications
1
When using the BorderLayout manager, how many components can each region hold?

A) 1
B) 2
C) 5
D) No limit
A
2
The minimize button, maximize button, and close button on a window are sometimes referred to as:

A) operations buttons
B) sizing buttons
C) decorations
D) display buttons
C
3
This is an action that takes place in an application, such as the clicking of a button.

A) instance
B) effect
C) case
D) event
D
4
These components have a consistent look and predictable behavior on any operating system.

A) AWT
B) GUI
C) Swing
D) Peer classes
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
5
If panel references a JPanel object, which of the following statements adds the GridLayout to it?

A) panel.setLayout(new (GridLayout(2,3));
B) panel.addLayout(new (GridLayout(2,3));
C) panel.GridLayout(2,3);
D) panel.attachLayout(GridLayout(2,3));
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
6
In a Swing application, you create a frame object from the:

A) Jlabel class
B) JFrame class
C) Jpanel class
D) AbstractButton class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
7
Which one of the following GUI components is considered to be a container?

A) Frame
B) Label
C) Slider
D) Button
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
8
________ is a library of classes that do not replace ________, but provide an improved alternative for creating GUI applications.

A) AWT, Swing
B) Swing, AWT
C) JFC, AWT
D) JFC, Swing
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
9
This is commonly used to hold and organize collections of related components:

A) list
B) panel
C) frame
D) label
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
10
In Swing, labels are created with this class:

A) JFCLabel
B) AWTLabel
C) JLabel
D) SwingLabel
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
11
One of the small dots that make up a screen display is known as what?

A) point
B) color
C) pixel
D) texture
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
12
To use the ActionListener interface, as well as other event listener interfaces, you must have the following import statement in your code:

A) import java.swing;
B) import java.awt;
C) import java.awt.*;
D) import java.awt.event.*;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
13
To end an application, pass this as the argument to the JFrame class's setDefaultCloseOperation() method.

A) END_ON_CLOSE
B) JFrame.END_ON_CLOSE
C) JFrame.EXIT_ON_CLOSE
D) JFrame.CLOSE_NOT_HIDE
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
14
In GUI terminology, a container that can be displayed as a window is known as a:

A) message dialog
B) buffer
C) Swing package
D) frame
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
15
To use the Color class, which is used to set the foreground and background of various objects, use the following import statement:

A) import java.swing;
B) import java.awt;
C) import java.awt.*;
D) import java.awt.event.*;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
16
This layout manager arranges components in regions named North, South, East, West, and Center.

A) GridLayout
B) BorderLayout
C) FlowLayout
D) RegionLayout
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
17
Because these components rely on the appearance and behavior of the underlying operating system components, there is little that can be done by the programmer to change their properties.

A) Swing
B) AWT
C) Container
D) JFC
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
18
Programs that operate in a GUI environment must be:

A) event driven
B) in color
C) dialog boxes
D) layout managers
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
19
When you write an action listener class for a JButton component, it must:

A) have a method named buttonClicked
B) implement the ActionLIstener interface
C) have a method named actionPerformed which must take an argument of the ActionEvent type
D) both B and C
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
20
This layout manager arranges components in rows.

A) GridLayout
B) BorderLayout
C) FlowLayout
D) RegionLayout
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
21
JFC stands for:

A) Java Fundamental Classes
B) Java Foundation Classes
C) Java Fundamental Core
D) Java Frame Class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
22
When this is the argument passed to the JFrame class's setDefaultCloseOperation() method, the application is hidden, but not closed.

A) HIDE_ON_CLOSE
B) JFrame. HIDE_ON_CLOSE
C) JFrame.EXIT_ON_CLOSE
D) JFrame.HIDE_NOT_CLOSE
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
23
Which of the following is NOT a rule for the FlowLayout manager?

A) Multiple components can be added to a container that uses a FlowLayout manager.
B) New components will be added in a row from left to right.
C) When there is no more room in a row, additional components are put on the next row.
D) All of these are rules for the FlowLayout manager.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
24
AWT components are commonly called ________ components because they are coupled with their underlying peer classes.

A) lightweight
B) featherweight
C) middleweight
D) heavyweight
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
25
What does the following statement do?
AddButton.addActionListener(new AddButtonListener());

A) Creates an AddButtonListener object
B) Registers the addButton object as an ActionListener with the AddButtonListener object
C) Creates an AddButtonListener object and registers the AddButtonListener object with the addButton
D) Nothing, the statement is invalid.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
26
The GridLayout manager limits each cell to only one component. To put two or more components in a cell, do this:

A) Resize the cells so they can hold more
B) You can nest panels inside the cells, and add other components to the panels
C) The statement is False. The GridLayout manager does not have this restriction
D) Resize the components to fit in the cell
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
27
Assume that radio references a JRadioButton object. To click the radio button in code, use the following statement:

A) radio.Click();
B) Click(radio);
C) Click(radio, true);
D) radio.doClick();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
28
What will be the result of executing the following statement?
Panel.setBorder(BorderFactory.createLineBorder(Color.BLUE, 5));

A) The JPanel referenced by panel will have a blue line border that is 5 millimeters thick.
B) The JPanel referenced by panel will have a blue line border that is 5 pixels thick.
C) The JPanel referenced by panel will have a blue line border that is 5 characters thick.
D) The JPanel referenced by panel will have a blue line border that is 5 inches thick.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
29
Which of the following statements is NOT true?

A) Radio buttons are round and check boxes are square.
B) Radio buttons are often grouped together and are mutually exclusive; Check boxes are not.
C) Radio buttons and check boxes both implement the ActionListener interface.
D) They are all true.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
30
This layout manager arranges components in five regions.

A) GridLayout
B) BorderLayout
C) FlowLayout
D) RegionLayout
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
31
This is a basic window that has a border around it, a title bar, and a set of buttons for minimizing, maximizing, and closing the window.

A) Pane
B) Container
C) Frame
D) Dialog box
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
32
How many radio buttons can be selected at the same time as the result of the following code?
Hours = new JRadioButton("Hours");
Minutes = new JRadioButton("Minutes");
Seconds = new JRadioButton("Seconds");
Days = new JRadioButton("Days");
Months = new JRadioButton("Months");
Years = new JRadioButton("Years");
TimeOfDayButtonGroup = new ButtonGroup();
DateButtonGroup = new ButtonGroup();
TimeOfDayButtonGroup.add(hours);
TimeOfDayButtonGroup.add(minutes);
TimeOfDayButtonGroup.add(seconds);
DateButtonGroup.add(days);
DateButtonGroup.add(months);
DateButtonGroup.add(years);

A) 1
B) 2
C) 3
D) 4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
33
The variable panel references a JPanel object. The variable bGroup references a ButtonGroup object, which contains several button components. If you want to add the buttons to the panel:

A) use the statement, panel.add(bGroup);
B) use the statement, bGroup.add(panel);
C) use the statement, Panel panel = new Panel(bGroup);
D) add each button to panel one at a time, e.g. panel.add(button1);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
34
Event listeners must:

A) implement an interface
B) be included in private inner classes
C) not receive any arguments
D) exit the application once it has handled the event
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
35
If button1 is a JButton object, which of the following statements will make its background blue?

A) button1.makeBackground(BLUE);
B) button1.setBackground(Color.BLUE);
C) button1.makeBackground(Color.BLUE);
D) button1.set.Background(BLUE);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
36
When a component is added to a region in the BorderLayout manager:

A) the component retains its original size
B) it results in a compile time error, if it is too large
C) the component is stretched so it fills up the entire region
D) the region is resized to fit the component
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
37
You use the ________ key word in a class header to indicate that it implements an interface.

A) listener
B) interface
C) implements
D) static
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
38
Which of the following statements creates a class that is extended from the JFrame class?

A) JFrame DerivedClass = new JFrame();
B) class JFrame DerivedClass;
C) JFrame(DerivedClass);
D) public class DerivedClass extends JFrame{}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
39
When an application uses many components, rather than deriving just one class from the JFrame class, it is often better to encapsulate smaller groups of related components and their event listeners into their own class. A commonly used technique to do this is:

A) To extend a class from the JAbstractButton class to contain other components and their related code
B) To extend a class from the JComponent class to contain other components and their related code
C) To extend a class from the JPanel class to contain other components and their related code
D) To extend a class from the JFrame class to contain other components and their related code
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
40
To include Swing and AWT components in your program, use the following import statements:

A) import java.swing; import java.awt;
B) import java.swing; import javax.awt;
C) import javax.swing; import java.awt;
D) import javax.swing; import javax.awt;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
41
The System.exit method will end the application.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
42
Some of the common GUI components are buttons, labels, text fields, check boxes, and radio buttons.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
43
The following statement adds the FlowLayout manager to the container, centers the components, and separates the components with a gap of 10 pixels.
setLayout(new FlowLayout());
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
44
You would use this command at the operating system command line to execute the code in the MyApplication class and display the graphic image Logo·jpg as a splash screen.

A) java MyApplication Logo·jpg
B) java -splash:Logo·jpg MyApplication
C) java MyApplication -splash
D) java Logo·jpg -splash:MyApplication
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
45
The FlowLayout manager does not allow the programmer to align components.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
46
The ability to display splash screens was introduced in Java 6.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
47
All operating systems offer the same set of GUI components.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
48
You must use the statement import java.swing.*; in order to use the ItemListener interface.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
49
When an application uses many components, instead of extending just one class from the JFrame class, a better approach is to:

A) break the application into several smaller applications
B) reconsider the design of the application
C) encapsulate smaller groups of related components and their event listeners into their own classes
D) just go ahead and do it in one large class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
50
When adding components to a container that is governed by the GridLayout manager:

A) you cannot specify a cell
B) you specify the cell with the row and column numbers in the add statement
C) you must add them starting with the lower, right cell
D) the components are added automatically by filling up the first column, then the second, etc.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
51
Check boxes may be grouped in a ButtonGroup, like radio buttons are.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
52
When a splash screen is displayed, the application does not load and execute until the user clicks the splash screen image with the mouse.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
53
The ActionEvent argument that is passed to an action listener's actionPerformed method is the event object that was generated in response to an event.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
54
Which of the following statements is NOT true?

A) Radio buttons are round and check boxes are square.
B) Radio buttons are often grouped together and are mutually exclusive; Check boxes are not.
C) Radio buttons implement ActionListener; Check boxes implement ItemListener.
D) All of these are true.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
55
This is a graphic image that is displayed while an application loads into memory and starts up.

A) The Java 8 trademark screen
B) Memory usage screen
C) Blue screen of death
D) Splash screen
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
56
A common technique for writing an event listener class is to write it as a private inner class inside the class that creates the GUI.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
57
A GUI program automatically stops executing when the end of the main method is reached.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
58
What will be the result of executing the following statement?
Panel.setBorder(BorderFactory.createTitleBorder("Title"));

A) The JPanel referenced by panel will have an etched border with the title "Title" displayed on it.
B) The JPanel referenced by panel will have an empty border with the title "Title" displayed on it.
C) The JPanel referenced by panel will have a line border with the title "Title" displayed on it.
D) The JPanel referenced by panel will have a compound border with the title "Title" displayed on it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
59
Why doesn't the following code compile correctly?
Import java.awt.*;
Import java.awt.event.*;
Import javax.swing.*;
Public class ColorCheckBoxWindow extends JFrame
{
Private JCheckBox greenCheckBox;
Private final int WINDOW_WIDTH = 300, WINDOW_HEIGHT = 100;
Public ColorCheckBoxWindow()
{
SetTitle("Green Check Box");
SetSize(WINDOW_WIDTH, WINDOW_HEIGHT);
SetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GreenCheckBox = new JCheckBox("Green");
GreenCheckBox.addItemListener(new CheckBoxListener());
SetLayout(new FlowLayout());
Add(greenCheckBox);
SetVisible(true);
}
Public void itemStateChanged(ItemEvent e)
{
If (e.getSource() == greenCheckBox)
{
System.exit(0);
}
}
}

A) ColorCheckBoxWindow is not implementing the correct listener.
B) The button cannot be added to the content pane.
C) The itemStateChanged method cannot be coded here.
D) greenCheckBox should not be a private member.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
60
Assume that the variable checkbox references a JCheckBox object. To determine whether the check box has been selected, use the following code:

A) if (isSelected(checkBox)) {/*code to execute, if selected*/}
B) if (checkBox.isSelected()) {/*code to execute, if selected*/}
C) if (checkBox) {/*code to execute, if selected*/}
D) if (checkBox.doClick()) {/*code to execute, if selected*/}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.