Object Oriented Programming: Unit V: JAVAFX Event Handling, Controls and Components

Two marks Questions with Answers

JAVAFX Event Handling, Controls and Components | Object Oriented Programming

JavaFX is a set of graphics and media packages that enables developers to design, create, test, debug and deploy rich client applications that operate consistently across different platforms.

Two Marks Questions with Answers

Q.1 What is JavaFX ?

Ans. :

• JavaFX is a set of graphics and media packages that enables developers to design, create, test, debug and deploy rich client applications that operate consistently across different platforms.

JavaFX makes it easier to create desktop applications and games in Java.

Q.2 What are various features of JavaFX ?

Ans. :

1) JavaFX library is written in java. Hence developer find it easy to learn and write the applications in JAVAFX.

2) JAVAFX library creates UI controls using which any GUI based application can be developed.

3) It provides the classes for 2D and 3D graphics.

4) JavaFX contains a set of ready-to-use chart components, so you don't have to code that from scratch every time you need a basic chart.

Q.3 Is Javafx Open Source ?

Ans. Yes.

Q.4 What are the main components of JavaFX application?

Ans.

Every JAVAFX program is divided into three main components - Stage, Scene and Node and Scene graph. 

Q.5 Which method is used to launch JavaFX application?

Ans. The launch() method is used to launch JavaFX application.

Q.6 Which method is used in which we write the code for JavaFX application?

Ans. The start() method is used in which we write the code for JavaFX application.

Q.7 Explain the terms - Stage and scene used in JavaFX application.

Ans. :

1) Stage: Stage is like main frame of the program. It acts as a container for all the objects of JavaFX application. The most commonly used stage is a PrimaryStage.

2) Scene: The Javafx.scene.Scene class provides the methods to deal with the scene object. It contains the nodes or all the contents of Scene graph.

Q.8 Explain the terms - Scene graph and node used in JavaFX.

Ans. :

1) The scene graph is a collection of various nodes.

2) The node is an element that can be visualized on the screen. The node can be button, textbox, radio button and so on.

Q.9 What is the use of pane in JavaFX application?

Ans. :

Pane is a container class using which the UI components can be placed at any desired location with any desired size.

Generally you place a node inside a pane and then place pane into a scene. Actually node is any visual component such as UI controls, shapes, or a image view.

Q.10 What is property binding in JavaFX ?

Ans.

Property binding is a technique that enables target object to bind with the source object. Due to this mechanism, when the value in source object changes then the target property also changes automatically.

Q.11 What is Event?

Ans. Event means any activity that interrupts the current ongoing activity.

For example: When user clicks button then it generates an event. To respond to button click we need to write the code to process the button clicking action.

Q.12 What is event source object?

Ans. The object that generates the event is called event source object. For example - If the event gets generated on clicking the button, then button is the event source object.

Q.13 Explain the terms - event handler and event listener.

Ans. Event Handler: The event handling code written to process the generated event is called event handler.

Event Listener: The task of handling an event is carried out by event listener. When an event occurs, first of all an event object of the appropriate type is created. This object is then passed to a Listener.

Q.14 Explain the event methods in JavaFX that are associated with keyboard.

Ans. 


Q.15 Explain any two UI controls used in JavaFX application.

Ans :

Q.16 What is layoutpane?

Ans. :

• The arrangement of various components(nodes) in a scene within the container is called layout of the container.

• For using the layout we must import the package javafx.scene.layout. The class named Pane is the base class for all the layouts in JavaFX.

Q.17 Enlist various layout panes used in any JavaFX application?

Ans. 


Q.18 Explain the terms - Menubar and Menu item.

Ans. :

• MenuBar is just like a navigation bar with menus on it. The menubar is located at the top of the screen.

• A MenuItem is a basic item that goes on a menu.

Object Oriented Programming: Unit V: JAVAFX Event Handling, Controls and Components : Tag: : JAVAFX Event Handling, Controls and Components | Object Oriented Programming - Two marks Questions with Answers