Deck 7: A First Look at Gui Applications

ملء الشاشة (f)
exit full mode
سؤال
In a Swing application,you create a frame object from the

A) Jlabel class
B) JFrame class
C) Jpanel class
D) AbstractButton class
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
When using the BorderLayout manager,how many components can each region hold?

A) 1
B) 2
C) 5
D) No limit
سؤال
________ 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
سؤال
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.*;
سؤال
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
سؤال
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();
سؤال
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
سؤال
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;
سؤال
This layout manager arranges components in regions named North,South,East,West,and Center.

A) GridLayout
B) BorderLayout
C) FlowLayout
D) RegionLayout
سؤال
Programs that operate in a GUI environment must be

A) event driven
B) in color
C) dialog boxes
D) layout managers
سؤال
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
سؤال
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
سؤال
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.
سؤال
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));
سؤال
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
سؤال
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
سؤال
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.*;
سؤال
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
سؤال
This layout manager arranges components in rows.

A) GridLayout
B) BorderLayout
C) FlowLayout
D) RegionLayout
سؤال
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
سؤال
This layout manager arranges components in five regions.

A) GridLayout
B) BorderLayout
C) FlowLayout
D) RegionLayout
سؤال
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
سؤال
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
سؤال
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.
سؤال
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{}
سؤال
A GUI program automatically stops executing when the end of the main method is reached.
سؤال
JFC stands for

A) Java Fundamental Classes
B) Java Foundation Classes
C) Java Fundamental Core
D) Java Frame Class
سؤال
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
سؤال
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.
سؤال
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
سؤال
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
سؤال
These types of components are coupled with their underlying peers.

A) Lightweight
B) Featherweight
C) Middleweight
D) Heavyweight
سؤال
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
سؤال
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
سؤال
This is a graphic image that is displayed while an application loads into memory and starts up.

A) The Java 6 trademark screen
B) Memory usage screen
C) Blue screen of death
D) Splash screen
سؤال
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*/}
سؤال
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
سؤال
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
سؤال
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
سؤال
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);
سؤال
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());
سؤال
When a splash screen is displayed,the application does not load and execute until the user clicks the splash screen image with the mouse.
سؤال
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.
سؤال
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.
سؤال
You must use the statement import java.swing.*;in order to use the ItemListener interface.
سؤال
In Java,the ability to display splash screens was introduced in Java 6.
سؤال
The FlowLayout manager does not allow the programmer to align components.
سؤال
Check boxes may be grouped in a ButtonGroup like radio buttons are.
سؤال
The System.exit method will end the application.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/49
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 7: A First Look at Gui Applications
1
In a Swing application,you create a frame object from the

A) Jlabel class
B) JFrame class
C) Jpanel class
D) AbstractButton class
B
2
When using the BorderLayout manager,how many components can each region hold?

A) 1
B) 2
C) 5
D) No limit
A
3
________ 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
B
4
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.*;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
5
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
6
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();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
7
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
8
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;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
9
This layout manager arranges components in regions named North,South,East,West,and Center.

A) GridLayout
B) BorderLayout
C) FlowLayout
D) RegionLayout
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
10
Programs that operate in a GUI environment must be

A) event driven
B) in color
C) dialog boxes
D) layout managers
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
11
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
12
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
13
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
14
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));
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
15
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
16
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
17
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.*;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
18
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
19
This layout manager arranges components in rows.

A) GridLayout
B) BorderLayout
C) FlowLayout
D) RegionLayout
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
20
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
21
This layout manager arranges components in five regions.

A) GridLayout
B) BorderLayout
C) FlowLayout
D) RegionLayout
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
22
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
23
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
24
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
25
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{}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
26
A GUI program automatically stops executing when the end of the main method is reached.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
27
JFC stands for

A) Java Fundamental Classes
B) Java Foundation Classes
C) Java Fundamental Core
D) Java Frame Class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
28
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
29
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
30
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
31
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
32
These types of components are coupled with their underlying peers.

A) Lightweight
B) Featherweight
C) Middleweight
D) Heavyweight
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
33
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
34
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
35
This is a graphic image that is displayed while an application loads into memory and starts up.

A) The Java 6 trademark screen
B) Memory usage screen
C) Blue screen of death
D) Splash screen
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
36
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*/}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
37
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
38
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
39
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
40
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);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
41
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());
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
42
When a splash screen is displayed,the application does not load and execute until the user clicks the splash screen image with the mouse.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
43
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
44
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
45
You must use the statement import java.swing.*;in order to use the ItemListener interface.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
46
In Java,the ability to display splash screens was introduced in Java 6.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
47
The FlowLayout manager does not allow the programmer to align components.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
48
Check boxes may be grouped in a ButtonGroup like radio buttons are.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
49
The System.exit method will end the application.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.