Question

Which of the following would NOT be considered an "event"? Pressing the up arrow key to...

  1. Which of the following would NOT be considered an "event"?

    Pressing the up arrow key to move text on a GUI

    Compiling the code for a GUI

    Dragging the mouse across the GUI

    Clicking a button on a GUI

QUESTION 2

  1. Which which Event class does MouseEvent extend?

    InputEvent

    ActionEvent

    KeyEvent

    WindowEvent

QUESTION 3

  1. There are three parts of an event. Which of the following is NOT part of an event?

    The source - the source is where the event originated from, such as the mouse or keyboard

    The type - the type is the specific type of event that occurred such as mouse pressed, key released, and window closed

    The target - the target is the node on which the event occurred

    The click - the click tells you where the mouse was clicked

QUESTION 4

  1. What is the name of the method that you must override when create an EventHandler?

    handle

    start

    run

    invalidated

  

QUESTION 5

  1. An anonymous class is ____.

    a class that nobody knows about.

    a class that isn't named.

    an abstract class.

    a class that is marked as private.

QUESTION 6

  1. What exactly is EventHandler?

    an object

    a method

    a class

    an interface

QUESTION 7

  1. View the code below and choose the answer that best describes what is going on.

    When anywhere in the window is clicked, the inside of a circle will change to a different color as determined by a random number generator.

    When the mouse is dragged across the screen, the inside of a circle will change to a different color as determined by a random number generator.

    When the circle is clicked by the mouse, the inside of it will change to a different color as determined by a random number generator.

    When a button is pushed, the inside of a circle will change to a different color as determined by a random number generator.

QUESTION 8

  1. Which of the following is NOT a feature of lambda expressions?

    It simplifies code for event handling.

    It cuts down on the number of lines of code needed when creating event handlers.

    It is an anonymous class with concise syntax.

    It puts little lambs in your code. Duh.

QUESTION 9

  1. What line of code must be present in your program in order to use a KeyEvent and where should this line be placed in the code? (Assume that the name of the node we are using the KeyEvent on is called "text.")

    text.focus()

    It should be placed outside of the start method.

    text.keyEventFocus()

    It should be placed before you create the scene.

    text.requestKeyFocus()

    It should be placed in the main method.

    text.requestFocus()

    It should be placed after we show the stage.

QUESTION 10

  1. When viewing Lambda expressions, what is e -> ?

    e is the name of the Exception object being thrown and -> is pointing to the catch code

    e means "lambda expression" and nothing more while the -> is to show where the lambda code goes

    e is the name of the Event object that must be created and -> is the lambda operator

    e is a placeholder for a mouse pressed event and the -> is pointing to the mouse code

Homework Answers

Answer #1

ANSWER 1) Here - Pressing the up arrow key to move text on a GUI, Dragging the mouse across the GUI, Clicking a button on a GUI are physically done by mouse and keyboard but the Compiling the code for a GUI is not physically done. Hence Compiling the code for a GUI is not a event.

ANSWER 2) The MouseEvent class defined in java.awt.event. MouseEvent class extends the InputEvent class -

public class MouseEvent extends InputEvent

The ActionEvent class defined in java.awt.event. ActionEvent class extends the AWTEvent class -

public class ActionEvent extends AWTEvent

The KeyEvent class defined in java.awt.event. KeyEvent class extends the InputEvent class -

public class KeyEvent extends InputEvent

The WindowEvent class defined in java.awt.event. WindowEvent class extends the ComponentEvent class -

public class WindowEvent extends ComponentEvent

ANSWER 3) The click - the click tells you where the mouse was clicked is not the part of event because an event can be pressing a key but in pressing a key there is no click of a button. So it is not the part of an event.

The source, target and type are the part of event.

ANSWER 4) run is the name of the method that you must override when create an EventHandler.

ANSWER 5) An anonymous class is a class that isn't named.

a class that nobody knows about is never defined.

a class which have method but not the implementation of method is an abstract class.

a class that is marked as private is not accessible from anywhere.

ANSWER 6) EventHandler is a class.

ANSWER 7) When the mouse is dragged across the screen, the inside of a circle will change to a different color as determined by a random number generator is best describes what is going on.

ANSWER 8) It puts little lambs in your code. Duh. is not the feature of the lambda expressions.

ANSWER 10) e -> is the name of the Event object that must be created and -> is the lambda operator.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
   import javax.swing.*; import java.awt.*; import java.awt.event.*; //Class that paints according to the user wish. public...
   import javax.swing.*; import java.awt.*; import java.awt.event.*; //Class that paints according to the user wish. public class RapidPrototyping extends JFrame implements MouseListener,ItemListener,ActionListener,MouseMotionListener {       //panel to hold color,shapes and thickness components    JPanel panel;    //shapes combobox    JComboBox shapes;    //color radio buttons    JRadioButton red, green, blue;    //thickness combobox    JComboBox thicknesses;    //clear button.    JButton clear;    JPanel center;       /*values of each selection*/    Color color;    int thickness;    String shape;...
SIMPLE PAINTING GUI APP in Java Your mission in this exercise is to implement a very...
SIMPLE PAINTING GUI APP in Java Your mission in this exercise is to implement a very simple Java painting application. Rapid Protyping The JFrame app must support the following functions: (you can use any other programming languages that you are comfortable)  Draw curves, specified by a mouse drag.  Draw filled rectangles or ovals, specified by a mouse drag (don't worry about dynamically drawing the shape during the drag - just draw the final shape indicated).  Shape selection...
Assignment Statement Use the skeleton file starter code (below) to create the following classes using inheritance:...
Assignment Statement Use the skeleton file starter code (below) to create the following classes using inheritance: ⦁   A base class called Pet ⦁   A mix-in class called Jumper ⦁   A Dog class and a Cat class that each inherit from Pet and jumper ⦁   Two classes that inherit from Dog: BigDog and SmallDog ⦁   One classes that inherit from Cat: HouseCat The general skeleton of the Pet, Dog, and BigDog classes will be given to you (see below, "Skeleton", but...
IN JAVA Speed Control Problem: The files SpeedControl.java and SpeedControlPanel.java contain a program (and its associated...
IN JAVA Speed Control Problem: The files SpeedControl.java and SpeedControlPanel.java contain a program (and its associated panel) with a circle that moves on the panel and rebounds from the edges. (NOTE: the program is derived from Listing 8.15 and 8.16 in the text. That program uses an image rather than a circle. You may have used it in an earlier lab on animation.) The Circle class is in the file Circle.java. Save the program to your directory and run it...
The following is for a Java Program Create UML Class Diagram for these 4 java classes....
The following is for a Java Program Create UML Class Diagram for these 4 java classes. The diagram should include: 1) All instance variables, including type and access specifier (+, -); 2) All methods, including parameter list, return type and access specifier (+, -); 3) Include Generalization and Aggregation where appropriate. Java Classes description: 1. User Class 1.1 Subclass of Account class. 1.2 Instance variables __ 1.2.1 username – String __ 1.2.2 fullName – String __ 1.2.3 deptCode – int...
1) Consider the following Java program, which one of the following best describes "setFlavor"? public class...
1) Consider the following Java program, which one of the following best describes "setFlavor"? public class Food {     static int count;     private String flavor = "sweet";     Food() { count++; }     void setFlavor(String s) { flavor = s; }     String getFlavor() { return flavor; }     static public void main(String[] args) {         Food pepper = new Food();         System.out.println(pepper.getFlavor());     } } a. a class variable b. a constructor c. a local object variable d....
I've posted this question like 3 times now and I can't seem to find someone that...
I've posted this question like 3 times now and I can't seem to find someone that is able to answer it. Please can someone help me code this? Thank you!! Programming Project #4 – Programmer Jones and the Temple of Gloom Part 1 The stack data structure plays a pivotal role in the design of computer games. Any algorithm that requires the user to retrace their steps is a perfect candidate for using a stack. In this simple game you...
The premise of this project is to make a basic GUI and code for the game...
The premise of this project is to make a basic GUI and code for the game Keno. The specifics of the gui and game are below. Description: In this project you will implement the popular casino and state lottery game, Keno. This is a somewhat simple game to understand and play which should allow you to focus on learning GUI development in JavaFX and trying your hand at event driven programing. Implementation Details: You may add as many classes, data...
Answer all the following multiple choices with the right answer. Question 1 Which object(s) would you...
Answer all the following multiple choices with the right answer. Question 1 Which object(s) would you use to describe the shape of the 2p orbital? Question 1 options: a) a circle b) a sphere c) a dumb-bell d) two perpendicular dumb-bells e) a doughnut Question 2 Which situation must be true for two electrons to occupy the same orbital? Question 2 options: a) The electrons must have low energy. b) The electrons must have identical sets of quantum numbers. c)...
1) Consider the following Java program. Which statement updates the appearance of a button? import java.awt.event.*;...
1) Consider the following Java program. Which statement updates the appearance of a button? import java.awt.event.*; import javax.swing.*; public class Clicker extends JFrame implements ActionListener {     int count;     JButton button;     Clicker() {         super("Click Me");         button = new JButton(String.valueOf(count));         add(button);         button.addActionListener(this);         setSize(200,100);         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);         setVisible(true);     }     public void actionPerformed(ActionEvent e) {         count++;         button.setText(String.valueOf(count));     }     public static void main(String[] args) { new Clicker(); } } a. add(button);...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • After reading Module 5 PowerPoint 1 - The Philosophy of Human Existance and Health Care Policy,...
    asked 1 minute ago
  • 1. Do you feel play has a place in supporting literacy development in early childhood? Explain...
    asked 4 minutes ago
  • How should roles be selected for the Emergency Operations Center (EOC)?  Is seniority less important than experience?...
    asked 17 minutes ago
  • Discuss routing issues and solutions namely, count-to-infinity, split horizon, split horizon with poison reverse, and hold-down...
    asked 17 minutes ago
  • Find an optimal parenthesization of a matrix-chain product whose sequence of dimensions is〈5,10,3,12,5,50,6〉.
    asked 46 minutes ago
  • Water at 60 F (density=62.4lbm/ft^3 and dynamic viscosity = 7.5x10^-4 lbm/ft-s) is to be pumped through...
    asked 47 minutes ago
  • ibuprofen an aspirin substitute has the following percent composition C, 75.69%; H,8.80%; O,15.51%. determine the empirical...
    asked 47 minutes ago
  • Describe in brief some of the aspects of understanding words in the study of language
    asked 55 minutes ago
  • Anticipated sales for Safety Grip Company were 75,000 passenger car tires and 23,000 truck tires. Rubber...
    asked 1 hour ago
  • QUESTION ONE a) Differentiate between traceable and common costs b) Assume that you are living in...
    asked 1 hour ago
  • How do do you think that online course is different than the regular classroom setting experience
    asked 1 hour ago
  • MATLAB QUESTION: This must be completed using geometricrv. Please do not copy and paste the answer...
    asked 1 hour ago