Short Q2 Flashcards

1
Q

Differentiate clearly between the mouseMotionListener and MouseListener

A

MouseListener is used when the mouse is stable while handling a event. MouseMotionListener is when the mouse is in motion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain the role of each of the following:
ActionListener
ItemListener

A

ActionListener - User clicks a button, presses return while typing in a text field, or chooses a menu item.
ItemListener = ItemListener is an interface that listens for the item event, basically it refers to the item selection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Outline the function of each of the following:
setVisible
getContentPane-

A

setVisible- we must use this method to make it appear on the screen as frames are invisible by default.
getContentPane- The getContentPane() method retrieves the content pane layer so that you can add an object to it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe the function of the following:
JTextArea
JTextField

A

JTextArea - Allows uses to enter multiple lines of Text

JTextField - A text field is an area a user can type in characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe the function of the following:
JOptionPane
JScrollPane

A

JOptionPane - Create and customize several different kinds of dialog
JScrollPane - .If you want your users to be able to see content that exceeds the screen display area, you must place the component inside of a JScrollPane to support scrolling to the extra content

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe the role of each
SetJMenuBar
setLookAndFeel

A

SetJMenuBar - Is used to add a menu bar to a top-level contrainer such as a JFrame

SetLookAndFeel- Look” refers to the appearance of GUI widgets (more formally, JComponents ) and “feel” refers to the way the widgets behave

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Compare and contrast the following layout managers in gui:
BoxLayout
BorderLayout
GridLayout

A

Box Layout - It is the default layout in JFrame. It can position components in five different regions like top, bottom, left, right and center.

Border Layout - puts components in a square at one of the positions of North, South, East, West and center

Grid Layout - puts components in a rectangular grid

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Using java code statements declare a JComboBox called carMakeList containing Fiat,Volskwagon and Mercedes

A
string[]carMakeList = new String{"Fiat","volkswagon","Mercedes"}.
JComboBoxcarMakeList = new JComboBox <>(carMakeList);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to retrieve the input text entered by user in a JPasswordField components

A
passwordField = new JPasswordField(10);
passwordField.setActionCommand(OK);
passwordField.addActionListener(this);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly