Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

//1 Method _____ can be used to set the layout manager of a container. Select on

ID: 3829539 • Letter: #

Question

//1

Method _____ can be used to set the layout manager of a container.

Select one:

setGUILayout

setLayout

setLayoutManager

setManager

//2

The BorderLayout layout manager:

Select one:

divides an area into five regions: NORTH, SOUTH, EAST, WEST and CENTER.

order components horizontally.

orders components vertically.

divides an area into five regions: UP, DOWN, LEFT, RIGHT and MIDDLE.

//3

Which layout manager is the default for JFrame?

Select one:

FlowLayout

BorderLayout

GridLayout

None of the above

//4

Each container can have ________.

Select one:

zero or more layout managers

only one layout manager

one or more layout managers

only one or two layout managers

//5

Which region is used by default when a Component is added to a BorderLayout?

Select one:

WEST

NORTH

LEFT

CENTER

//6

Which of the following is a MouseMotionListener method?

Question1

Select one:

mouseExited.

mouseClicked.

mousePressed.

mouseDragged.

//7

Class Point represents ________.

Select one:

a filled oval

an object used to draw

an x-y coordinate pair

a period in a sentence

//8

Which of the following is the method used to display a dialog box to gather input?

Select one:

inputDialog.

showMessageDialog.

showInputDialog.

getInput.

Explanation / Answer

//1

setLayout

A layout manager is an object that implements the LayoutManager interface and determines the size and position of the components within a JFrame. This is done using the setLayout() method in java swing GUI applications.

//2

The BorderLayout layout manager divides an area into five regions: NORTH, SOUTH, EAST, WEST and CENTER. Each region is can contain only one component and each component in each region is identified by the corresponding constant NORTH, SOUTH, EAST, WEST, and CENTER.

//3

By default JFrame will have a BorderLayout manager set on it.

//4

Each container can have only one layout manager.

//5

By default when a Component is added to a BorderLayout is uses CENTER region.

//6

mouseDragged.

MouseMotionListener has only two methods:

mouseDragged(MouseEvent e): Invoked when a mouse button is pressed on a component and then dragged.

mouseMoved(MouseEvent e): Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.

//7

Class Point represents an x-y coordinate pair. This is used to constructs and initializes a point at the origin (0, 0) of the coordinate space in the JFrame.

//8

showInputDialog method is used to display a dialog box to gather input.

Java code example:

JOptionPane.showInputDialog(frame, "Enter your name ?");