Programming 2 Exam(JavaFX)

¡Supera tus tareas y exámenes ahora con Quizwiz!

ActionEvents, EventHandlers

An application can watch for generated_____________ and then implement______________ to process the ActionEvent.

graphical user interface.

GUI stands for

call the setOnAction() in the Button object.

In order to handle an ActionEvent,

lambda expression

The expression e -> method() is called a

root component

The top-level container is known as the

ActionEvent object is generated.

When a button is clicked the

A Label

is a non-editable text control.

Button Constructors

-Button() creates an empty button. -Button(String text) creates a button with specified text as label. -Button(String text, Node graphic) creates a button with supplied text and graphic for its label.

3 different Label constructors

-Label() creates an empty label. -Label(String text) creates a label with supplied text. -Label(String text, Node graphic) creates a label with supplied text and graphic.

TextField constructors

-TextField() creates an empty TextField -TextField(String text) creates a TextField with initial text.

Methods used to add child nodes to the BorderPane compartments.

-setTop() -setBottom() -setLeft() -setRight() -setCenter()

null

-setTop() -setBottom() -setLeft() -setRight() -setCenter() use these methods with_________ as the argument to remove the child node.

JavaFX runtime does these things in order

1. Constructs an instance of the specified Application class. 2. Calls the init() method 3. Calls the start() method 4. Waits for the application to finish 5. Call the stop() method

container

Any JavaFX components that is a descendant of javafx.scene.Parent is a

event loop

Every GUI program has an_____________________ which watches for the generation of events.

determined

In order to construct a layout, the positions and sizes for each component must be

static method to call BorderPane.setAlignment(child, position);

Nodes can be aligned within BorderPane compartments by using the

other GUI components

Some GUI components are known as containers because they can contain

built-in method or one that you provide.

The method on the right side of the lambda expression can be a

setManaged(false)

The node must call________________ before the resize() method will work

Application class and the start() method

These are abstract and therefore, any child class must provide an implementation of this method.

javafx.application.Application

This is an example of a JavaFX application we have written.

- root.add(child, column, row); - root.add(child, column, row);

Use these to add components to a GridPane.

object is generated by the system

When an event occurs, such as the mouse click or button key press, an

relocate() method

When using a Pane, use the_______________ to set the position of a node by specifying an x and y coordinate.

stage.show() method

actually displays the stage which in turn displays the scene.

TextField object

allows a user to enter a single line of unformatted text.

javafx.scene.layout.Pane and its child classes

are containers that do layouts in JavaFX.

getChilderen().add() or addAll() method

are used to add child nodes to an HBox and VBox.

add nodes to a pane

by calling getChildren().add or addAll(),we can

the position

can be any of the values in the javafx.geometry.Pos class.

Buttons

can be pressed by the user to trigger events in your application.

add() method

can be used to add an element to the end of the List or at a specified position.

addAll() method

can be used to add multiple elements at once. The arguments need to be separated by commas in the method call.

resize() method

can be used to set the width and height of a resizable node.

Buttons

can contain text and images.

nodes

components that can be in a scene are referred to as

Containers will

compute its own preferred size based on the nodes it contains, allowing each child node to have at least its preferred size, and similarly for minimum and maximum sizes.

button.setOnAction(e -> method())

example of handling an action event

List

getChildren() method returns a

Every node

has a minimum width and height, a maximum width and height, and preferred width and height.

Scene Objects

have a container that contains all other components in the Scene.

Different containers

have different ways for laying out their child nodes.

Resizable nodes, such as controls and most containers

have methods for changing preferred, minimum, and maximum sizes.

Scene graph

is a diagram that shows the containment relationships among all components in a scene.

GUI

is a form of user interface that allows users to interact with a device through graphical icons and visual indicators.

Event-driven programming

is a programming paradigm in which the flow of the program is determined by events such as user actions (mouse clicks, key presses), sensor outputs, or messages from other programs/threads.

JavaFX

is a software platform for creating GUI desktop applications and internet applications.

event

is an action or occurrence recognized by a program, often originating from the external environment, such as the user.

Scene object

is filled with GUI components such as buttons, labels, text, fields, etc

JavaFX

is intended to replace the older Java GUI platforms such as AWT and Swing.

Event-driven programming

is the dominant paradigm used in graphical user interfaces and web applications.

A Stage object

is used to display a Scene Object.

setSpacing() method

is used to increase the spacing between nodes.

static method call Application.launch(args)

launches the application and passes any command line arguments to the application.

FlowPane

lays out its children in a grid of tiles. The size of the tiles does not have to be uniform.

TilePane

lays out its children in a grid of uniformly sized tiles.

BorerPane

lays out its children in top, left, right, bottom, and center positions.

HBox

lays out its nodes in a horizontal row.

VBox

lays out nodes in a vertical column.

Nodes that can act as containers

must be child classes of Javafx.scene.Parent which is a child class of node.

A program

must detect the generation of the event and respond to it.

Child classes of javafx.scene.Node

nodes are_______________________.

children of that node

nodes contained in a container are called

Layout

positioning of GUI components in a scene.

Button object

provides a simple button control.

remove() method

removes labels from a container.

Stage object

represents a window on the computer screen.

start() method

requires one stage object as a parameter. The Stage object is automatically supplied by the system and represents the main window of the application.

stage.setScene(scene) method call

tells the stage which scene object to display, but does not actually display the scene.

event handling

the process of responding to an event is called

Use getText() method

to access a Label object's text.

Use setText() method

to change a Label object's text.

Purpose of a Button

to produce an action when it is clicked.

getText() method

used to access a TextField's text.

setText() method

used to change a TextField's text.

start() method

used to set up the application.

GridPane

uses a grid to layout its child nodes in rows and columns.

A container

usually automatically constructs the layout for its child nodes.

Containers

usually consult its child nodes' max, min, and preferred width and height values when laying out its children.

ActionEvent is generated

when a user clicks a Button.


Conjuntos de estudio relacionados

Chapter 5: Sexually Transmitted Infections

View Set

AP Government Test Edmodo Questions

View Set

EDAPT: Homeostasis and Elimination

View Set

Psychology Chapter 9 Lifespan Development

View Set

Automotive Technology Ch.39 & 40

View Set

Anatomy and Physiology Final (First Semester)

View Set

ACCT 210 Exam 3 PRACTICE PROBLEMS

View Set