Absolute Java: Swing I / The Art and Science of Java: Event-driven Programs

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

jframe, setsize

A ____ object is a basic window that includes a border and the usual three buttons for minimizing the window down to an icon, changing the size of the window, and closing the window. The initial size of the JFrame window is set using the JFrame method _____, as follows: firstWindow.setSize(WIDTH, HEIGHT);

action events, action listeners

A button fires events known as ____, which are handled by listeners known as ____.

abstract window toolkit

AWT stands for ____.

events

Actions that occur asynchronously with respect to the program operation, such as clicking the mouse or typing on the keyboard are generically referred to as ____.

window, buttons

An object of the class JFrame is what you think of as a ____. It automatically has a border and some basic buttons for minimizing the window and similar actions. As you will see, a JFrame object can have ____ and many other components added to the window and programmed for action.

JButton endButton = new JButton("hello");

Create a JButton object called endButton which says "hello" on it.

EndingListener buttonEar = new EndingListener( ); , endButton.addActionListener(buttonEar);

Create an EndingListener object named buttonEar and register buttonEar as a listener to receive events from the button named endButton.

java.util, mouseevent, keyevent, actionevent

In Java, every event is represented by an object that is a subclass of the EventObject class in the ____ package. There are three event classes called ____.

fire, react, program

In event-driven programming, you create objects that can ____ events, and you create listener objects to ____ to the events. For the most part, your ____ does not determine the order in which things happen. The events determine that order.

perform, responding, listening

In the Java event model, event objects do not themselves ____ any actions. What happens instead is that events are delivered to some other object that is charged with ____ to that particular type of event. Such an object is called a ____.

swing, awt

Some AWT classes are replaced by Swing classes, but other AWT classes are needed when using Swing. We will use classes from both _____ and the _____.

events, event handlers, listener, firing the event, button, clicked, listener

Swing programs use ____ and ____. An event is an object that acts as a signal to another object known as a ____. The sending of the event is called _____. The object that fires the event is often a GUI component, such as a button. The ____ fires the event in response to being clicked. The listener object performs some action in response to the event. For example, the listener might place a message on the screen in response to a particular button being ____. A given component may have any number of listeners, from zero to several listeners. Each _____ might respond to a different kind of event, or multiple listeners might respond to the same events.

awt

The ____ package is an older package designed for doing windowing interfaces. Swing can be viewed as an improved version

setdefaultcloseoperation, nothing

The behavior of the close-window button is set with the JFrame method ____. In this case, the argument JFrame.DO_NOTHING_ON_CLOSE is a defined constant named DO_NOTHING_ON_CLOSE, which is defined in the JFrame class. This sets the close-window button so that when it is clicked, ____ happens.

javax.swing, java.awt

What we and others call the Swing library is the package named ____. The AWT library is the package ____.

actionperformed, actionperformed

When an action listener receives an action event, the event is automatically passed as an argument to the method ____ and the method ____ is invoked.

guis

Windowing systems that interact with the user are often called ____.

firstWindow.add(endButton);

With a JFrame called firstWindow, what would you write to add a button called "endButton".

actionevent

____, which is used to represent a user-interface action taken by the user, such as clicking a button on the screen

mouseevent

____, which is used to represent an action taken with the mouse such as moving or dragging it from one position to another or clicking the mouse button.

keyevent

____, which is used to represent pressing a key on the keyboard.

event driven programming, events

_____ is a programming style that uses a signal-and-response approach to programming. Signals to objects are things called _____.

buttonear, endbutton, endbutton

endButton.addActionListener(buttonEar); The line says that ____ is registered as a listener to _____, which means buttonEar will receive all events fired by _____.

visible

firstWindow.setVisible(true); This makes the JFrame window ____ on the screen.


Set pelajaran terkait

pedi fall 18 final exam McKinney

View Set

Pharmacological and Parenteral Therapies Type: Client Needs Category: Pharmacological and Parenteral Therapies

View Set

How Things Work 10.1 Static Electricity

View Set

Chapter 8. Master Budgeting Learn Smart

View Set

Ch.5 Ethical Applications of Informatics

View Set

Ciencias Naturales - Tema 5.3.- Las reacciones químicas

View Set

MedSurg Exam 2 Practice Questions

View Set

Chapter 8, Week 8 APT Ch.8,9 TED ch.10,11, Practice quiz 3 questions: POLSC 115, PLS 105 EXAM 3 CHAPTERS 8,9,10

View Set