Filters
Question type

Study Flashcards

A(n) ____________________ consists of a label positioned beside a square; you can click the square to display or remove a check mark.

Correct Answer

verifed

verified

The ____ method of JComboBox returns the maximum number of items the combo box can display without a scroll bar.


A) getSelectedItem()
B) getItemCount()
C) getMaximumRowCount()
D) getSelectedIndex()

E) None of the above
F) B) and C)

Correct Answer

verifed

verified

When setting a JFrame 's size, part of the area is unusable because it is consumed by the JFrame 's title bar and borders.

A) True
B) False

Correct Answer

verifed

verified

import javax.swing.*; public class JFrameLabel {     public static void main(String[] args)     {        final int FRAME_WIDTH = 300;        final int FRAME_HEIGHT = 120;        JFrame myFrame = new JFrame("Frame with label");        myFrame.setSize(FRAME_WIDTH, FRAME_HEIGHT);        myFrame.setVisible(true);        myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        -----Code here-----        -----Code here-----      } } The above code shows an application in which a JFrame is created and its size, visibility, and close operation are set. In the indicated lines provided, write the code to create a JLabel named thanks that holds the words "Thank you for your business". Then, write the statement to add the JLabel to the JFrame .

Correct Answer

verifed

verified

JLabel thanks = new ...

View Answer

Look and feel comprises the elements of design, style, and ________________ in any user interface.

Correct Answer

verifed

verified

functionality

Within an implementation of the itemStateChanged() method, you can use the ____ method to determine which object generated the event, and the getStateChange() method to determine whether the event was a selection or a deselection.


A) getSource()
B) getEvent()
C) getItem()
D) getState()

E) B) and C)
F) A) and B)

Correct Answer

verifed

verified

What is the default layout manager for JFrame ?


A) GridLayout
B) FlowLayout
C) FrameLayout
D) BorderLayout

E) B) and D)
F) A) and B)

Correct Answer

verifed

verified

A method that executes because it is called automatically when an appropriate event occurs is an event ____.


A) responder
B) listener
C) handler
D) source

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

The ____ responds to keyboard focus events.


A) KeyListener
B) ActionListener
C) ChangeListener
D) FocusListener

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

D

When a user closes a JFrame by clicking the Close button in the upper-right corner, the default behavior is for the JFrame to close and the application to terminate.

A) True
B) False

Correct Answer

verifed

verified

import javax.swing.*; public class JFrame1 {      public static void main(String[] args)      {          JFrame aFrame = new JFrame("First frame");          aFrame.setSize(300, 125);          aFrame.setVisible(true);      } } Explain the purpose of each statement in the main() method above and why they are necessary for creating a JFrame .

Correct Answer

verifed

verified

The first statement declares a JFrame na...

View Answer

You define the text to be displayed in a tool tip by using the setToolTipText() method and passing an appropriate ____ to it.


A) Integer
B) Date
C) String
D) Boolean

E) A) and B)
F) C) and D)

Correct Answer

verifed

verified

C

The Swing classes are part of a more general set of UI programming capabilities that are collectively called the ____.


A) JavaX Classes
B) Java Foundation Classes
C) UI packages
D) Java Extension Libraries

E) B) and C)
F) B) and D)

Correct Answer

verifed

verified

The default behavior of a JFrame is to use the border layout format, which divides a container into regions.

A) True
B) False

Correct Answer

verifed

verified

Within an event-driven program, a component on which an event is generated is the ____ of the event.


A) handler
B) driver
C) listener
D) source

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

Write the code to build a JComboBox named sideDish with no arguments. Then, create the addItem() methods to provide options for "Fries", "Salad", and "Fruit".

Correct Answer

verifed

verified

JComboBox sideDish = new JComb...

View Answer

How are computer programs more user friendly when they contain GUI components? How does Java address GUI components?

Correct Answer

verifed

verified

Computer programs usually are more user ...

View Answer

Which of the following statements will correctly set a JFrame named myFrame to be visible?


A) myFrame.Visible = True
B) myFrame.setVisible(true)
C) myFrame.Visibility.True
D) myFrame.true = Visible

E) B) and D)
F) B) and C)

Correct Answer

verifed

verified

When constructing a Font object, which of the following arguments is NOT required?


A) typeface
B) style
C) weight
D) point size

E) None of the above
F) A) and B)

Correct Answer

verifed

verified

Write the statement to provide a JTextField object named myInfo that allows enough room for a user to enter 15 characters.

Correct Answer

verifed

verified

JTextField...

View Answer

Showing 1 - 20 of 66

Related Exams

Show Answer