• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/15

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

15 Cards in this Set

  • Front
  • Back

How do you add an event handler to your source object?

myObject.setOnAction(new myEventHandler());

What method do you override in the event handler?

public void handle(ActionEvent e)

How do you identify the source object of an event?

getSource()

Three types of action events fired

ActionEvent


MouseEvent


KeyEvent

True or false: inner classes are useful for defining event handler classes

true

How do you create an object for the inner class if the inner class is non-static?

OuterClass.InnerClass innerObject = outerObject.new InnerClass();

Can you use public, private, and protected with inner classes?

Yes. They can be subject to the same visibility rules as the outer class

the compiler treats a lambda expression as if it is an....

object created from an anonymous class

Change to lambda expression:


btEnlarge.setOnAction(


new EventHandler<ActionEvent>(){


@Override


public void handle(ActionEvent e){


//code for handling event


}}});

btEnlarge.setOnAction(e -> {


//code for processing actionevent


});




compiler automatically recognizes that the statements are for the handle method


we can omit extra parentheses because there is only one parameter without an explicit data type

How many abstract methods must the interface contain for the compiler to understand the lambda expression?

one method ONLY

Give examples of the type of information that a MouseEvent can collect

number of clicks, which button, x- and y-coord of mouse, whether other keys like alt were pressed when the mouse was pressed, dragged, released, etc.

What type of information is gathered by key events?

character associated with key, key code, whether alt/shift/control/mouse meta were also pressed

What does requestFocus() do and when must it be invoked?

only a focused node can receive KeyEvent


must be invoked after the stage is displayed


If a button is clicked, you must request the focus again

How do you add a listener to process a value changed in an Observable object?

addListener(InvalidationListener listener)




and override




invalidated(Observable o)

Give an example of Observable

every binding property