OOPS UNIT - V Notes
OOPS UNIT - V Notes
If you click on the play button, the source will be the mouse, the target node will be the play button and
the type of the event generated is the mouse click.
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
6 ListView A ListView component presents the user with a scrolling list of text items.
7 TextField A TextField object is a text component that allows for the editing of a single line of text.
K.G.SARAVANAN \ ASST. PROF.\ IT DEPT 4 II IT
CS3391 – OBJECT ORIENTED PROGRAMMING
8 PasswordField A PasswordField object is a text component specialized for password entry.
9 Scrollbar A Scrollbar control represents a scroll bar component in order to enable user to
select from range of values.
10 FileChooser A FileChooser control represents a dialog window from which the user can
select a file.
11 ProgressBar As the task progresses towards completion, the progress bar displays the task's
percentage of completion.
12 Slider A Slider lets the user graphically select a value by sliding a knob within a bounded
interval.
Example
The following program is an example which displays a login page in JavaFX. Here, we are using the controls label,
text field, password field and button. Save this code in a file with the name LoginPage.java.
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Text;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
The following program is an example of a registration form, which demonstrates controls in JavaFX such
as Date Picker, Radio Button, Toggle Button, Check Box, List View, Choice List, etc.
Save this code in a file with the name Registration.java.
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.DatePicker;
import javafx.scene.control.ListView;
import javafx.scene.control.RadioButton;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Text;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
import javafx.scene.control.ToggleButton;
import javafx.stage.Stage;