QUESTION 1 If you want to have a tabular arrangement of comp

QUESTION 1

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.

grid bag layout

grid layout

flow layout

border layout

QUESTION 2

The _______ interface toolkit has a large set of user-interface components.

GUI Builder

graphical user

Swing

JMenu

QUESTION 3

When adding a component to a container with the ____ layout, specify the NORTH, EAST, SOUTH, WEST, or CENTER position.

border

grid

grid bag

flow

QUESTION 4

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

I, II

I, II, III

III, IV and V

IV an V

QUESTION 5

Based on the statement below, which of the following adds a title to the border?


JPanel panel = new JPanel();

panel.setBorder(new TitledBorder());

panel.setBorder(new TitledBorder(new EtchedBorder(), \"Size\"));

panel.setBorder(new TitledBorder(new EtchedBorder()));

panel.setTitle(\"Size\");

QUESTION 6

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

I, II and III

II, IV an V

III, IV and V

I, II, III, IV and V

QUESTION 7

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 e)
{
doSomethingElse();
System.out.println(menuLabel);
}
}
mi.addActionListener(new MyMenuListener());
return mi;
}

1

2

3

4

QUESTION 8

Suppose listener is an instance of a class that implements the MouseListener interface. How many methods does listener have?

0

1

3

at least 5

QUESTION 9

When you use a timer, you need to define a class that implements the ____ interface.

TimerListener

TimerActionListener

ActionListener

StartTimerListener

QUESTION 10

Consider the following code snippet:


class MouseClickedListener implements MouseListener
{
public void mouseClicked(MouseEvent event)
{
int x = event.getX();
int y = event.getY();
component.moveTo(x,y);
}
public void mousePressed(MouseEvent event) {}
public void mouseEntered(MouseEvent event) {}
public void mouseExited(MouseEvent event) {}
}

What is wrong with this code?

The class cannot have empty methods for the mousePressed, mouseEntered, and mouseExited methods.

The class failed to implement the mouseReleased method of the MouseListener interface.

The class has implemented the wrong interface.

The mouseClicked method cannot access the x and y coordinates of the mouse.

  

grid bag layout

grid layout

flow layout

border layout

Solution

QUESTION 1
**********
If you want to have a tabular arrangement of components, in which columns have different sizes or one component spans multiple columns, a grid bag layout would be appropriate.
_______________
QUESTION 2
***********
The GUI Builder interface toolkit has a large set of user-interface components.
_______
QUESTION 3
**********
When adding a component to a container with the border layout, specify the NORTH, EAST, SOUTH, WEST, or CENTER position.
_____________
QUESTION 4
**********
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,II,III
_________
QUESTION 5
**********
Based on the statement below, which of the following adds a title to the border? panel.setBorder(new TitledBorder(new EtchedBorder(), \"Size\"));
__________________________________________________________________
QUESTION 6
**********
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, II, III, IV and V
____________________

QUESTION 7
**********
When method makeMenuItem is called, how many objects are being created? 2
___
QUESTION 8
**********
Suppose listener is an instance of a class that implements the MouseListener interface. How many methods does listener have? atleast 5
_______

QUESTION 9
**********
When you use a timer, you need to define a class that implements the ActionListener interface.
______________

QUESTION 10
***********

Consider the following code snippet:


class MouseClickedListener implements MouseListener
{
public void mouseClicked(MouseEvent event)
{
int x = event.getX();
int y = event.getY();
component.moveTo(x,y);
}
public void mousePressed(MouseEvent event) {}
public void mouseEntered(MouseEvent event) {}
public void mouseExited(MouseEvent event) {}
}

Answer
******
The class failed to implement the mouseReleased method of the MouseListener interface.

QUESTION 1 If you want to have a tabular arrangement of components, in which columns have different sizes or one component spans multiple columns, a ____ would
QUESTION 1 If you want to have a tabular arrangement of components, in which columns have different sizes or one component spans multiple columns, a ____ would
QUESTION 1 If you want to have a tabular arrangement of components, in which columns have different sizes or one component spans multiple columns, a ____ would
QUESTION 1 If you want to have a tabular arrangement of components, in which columns have different sizes or one component spans multiple columns, a ____ would

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site