Week 9

studied byStudied by 0 people
0.0(0)
Get a hint
Hint

MouseEvent Class

1 / 54

flashcard set

Earn XP

Description and Tags

55 Terms

1

MouseEvent Class

An event that indicates that a mouse action occurred in a component such as pressing a mouse button.

New cards
2

MouseEvent

When the user presses one of the buttons on a mouse, an object that belongs to a ____________ class is constructed

New cards
3

Event Source

component to which the user clicked

New cards
4

x and y coordinates

the point in the component where the click occurred

New cards
5

mouse-based

To work, the mouse event type should be registered by adding the appropriate __________ Event Listener to the component.

New cards
6

MouseListener

used for basic mouse-oriented events

New cards
7

MouseListener

happens when the mouse is clicked or released

New cards
8

MouseMotionListener

used for the motion-oriented events

New cards
9

MouseMotionListener

happens whenever the mouse is moved; frequent

New cards
10

public void mousePressed(MouseEvent evt)

method called when the user presses down a mouse button

New cards
11

public void mouseReleased(MouseEvent evt)

method called when the user releases a button

New cards
12

public void mouseClicked(MouseEvent evt)

method called if the user presses a mouse button and then releases it, without moving the mouse.

New cards
13

public void mouseClicked(MouseEvent evt)

The mousePressed, mouseReleased, and mouseClicked routines are all called in that order.

New cards
14

mousePressed

In most cases, you should define _______ instead of mouseClicked

New cards
15

public void mouseEntered(MouseEvent evt)

method called when the mouse cursor enters the component.

New cards
16

public void mouseExited(MouseEvent evt)

method called when the mouse cursor leaves the component.

New cards
17

object

Registering Mouse Events: create an ______ that implements the MouseListener interface

New cards
18

addMouseListener()

Registering Mouse Events: register the object to listen for events by calling a component's ____________ method.

New cards
19

public void mouseDragged(MouseEvent evt)

method called when the user moves the mouse while holding down a mouse button until the button is released

New cards
20

F

public void mouseDragged(MouseEvent evt) only works if the mouse position is within the bounds of the component

T or F

New cards
21

public void mouseMoved(MouseEvent evt)

method called when the user moves the mouse while no mouse button is down

New cards
22

MouseEvent

The _______ object in the parameter contains the x and y coordinates of the mouse's location

New cards
23

MouseMotionListener

Registering MouseMotion Events: create an object that implements the _____________ interface

New cards
24

addMouseMotionListener()

register the object to listen for events by calling a component's _____________________ method

New cards
25

MouseListener

In most cases, the listener object will also implement the ___________ interface so that it can respond to the other mouse events as well

New cards
26

Menu

is a list of buttons each of which have their own corresponding action when selected

New cards
27

Drop-Down

Types of Menu: usually associated with an application's menubar

New cards
28

Pop-Up

Types of Menu: associated with any container component (i.e., often accessed via right button click)

New cards
29

Cascaded

Types of Menu: pops up when another menu item is selected (i.e. a sub menu)

New cards
30

pull-down

Types of Menu: other term for drop-down menu

New cards
31

JMenuBar

An object at the top of the frame that contains "pull down" menus. There can be only one per frame.

New cards
32

names

Only the _____ of the pull down menus are displayed on the menubar.

New cards
33

JMenu

A menu that may contain menu items, separator lines, and other menus.

New cards
34

JMenuItems

menu items which the user can select from (like buttons)

New cards
35

JSeparators

separator lines to divide up the items into logical groupings

New cards
36

action

The user selects an option and an _____ is performed

New cards
37

JMenu

It is added to a JMenuBar object by specifying its name (or label) which will appear on the menubar

New cards
38

JMenuItem

A button on a menu. When the user selects the "button", the action associated with the menu item is performed

New cards
39

ImageIcons

__________ can be used on menus as well by assigning an icon to a menultem (just like JButtons)

New cards
40

JRadioButtonMenuItem

A menu item that is part of a group of menu items in which only one item in the group can be selected

New cards
41

JPopupMenu

A small window which pops up and displays a menu of choices

New cards
42

JPopupMenu

Used for the menu that appears when the user selects an item on the menu bar (similar to cascaded menu)

New cards
43

JPopupMenu

Also used for "pull-right" menus that appear when the user selects a menu item that activates it

New cards
44

JPopupMenu

can also be used anywhere else you want a menu to appear (e.g., when the user right-clicks in a specified area)

New cards
45

JFrame

A single JMenuBar is added to a __________

New cards
46

JMenus

Multiple ______ are added to the JMenuBar

New cards
47

JFrame

JPopupMenus are added to _______

New cards
48

setJMenuBar()

method used to set the JFrame's menubar to the instance of JMenuBar

New cards
49

.setMnemonic();

method used to set the keyboard accelerators (i.e., quick keys)

New cards
50

dialog box

a separate window that pops up in response to an event occurring in a window

New cards
51

dialog box

often used to obtain information from the user

New cards
52

Message Dialog

displays a message indicating information, errors, warnings etc

New cards
53

Confirmation Dialog

asks a question such as yes/no

New cards
54

Input Dialog

asks for some kind of input

New cards
55

Option Dialog

asks the user to select some option

New cards

Explore top notes

note Note
studied byStudied by 6 people
... ago
5.0(1)
note Note
studied byStudied by 214 people
... ago
5.0(1)
note Note
studied byStudied by 70 people
... ago
5.0(1)
note Note
studied byStudied by 13 people
... ago
5.0(2)
note Note
studied byStudied by 19 people
... ago
5.0(1)
note Note
studied byStudied by 16 people
... ago
4.5(2)
note Note
studied byStudied by 1536 people
... ago
5.0(6)
note Note
studied byStudied by 8794 people
... ago
4.7(46)

Explore top flashcards

flashcards Flashcard (175)
studied byStudied by 9 people
... ago
5.0(1)
flashcards Flashcard (59)
studied byStudied by 7 people
... ago
5.0(1)
flashcards Flashcard (46)
studied byStudied by 34 people
... ago
5.0(1)
flashcards Flashcard (72)
studied byStudied by 34 people
... ago
5.0(1)
flashcards Flashcard (39)
studied byStudied by 3 people
... ago
5.0(1)
flashcards Flashcard (31)
studied byStudied by 4 people
... ago
5.0(1)
flashcards Flashcard (44)
studied byStudied by 22 people
... ago
5.0(1)
flashcards Flashcard (47)
studied byStudied by 4 people
... ago
5.0(1)
robot