Found 155 Articles for JavaFX

How to create a ComboBox using JavaFX?

Maruthi Krishna
Updated on 18-May-2020 08:14:25

1K+ Views

A combo box is similar to a choice box it holds multiple items and, allows you to select one of them. It can be formed by adding scrolling to a drop-down list. You can create a combo box by instantiating the javafx.scene.control.ComboBox class.ExampleThe following Example demonstrates the creation of a ComboBox.import javafx.application.Application; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.stage.Stage; import javafx.scene.layout.HBox; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; import javafx.scene.text.FontWeight; public class ComboBoxExample extends Application {    public void start(Stage stage) {       //Setting the label       Label label = new ... Read More

JavaFX example to set slider to the progress bar

Maruthi Krishna
Updated on 18-May-2020 08:12:42

274 Views

ProgressBar − A progress bar is an indicator of the advancement of an event (a series of steps). You can create a progress bar by instantiating the javafx.scene.control.ProgressBar class.Slider − JavaFX provides a class known as Slider, this represents a slider component that displays a continuous range of values. This contains a track on which the numerical values are displayed. Along the track, there is a thumb pointing to the numbers. You can provide the maximum, minimum, and initial values of the slider.ExampleIn the following example, we are setting the slider to the ProgressBar.import javafx.application.Application; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import ... Read More

How to create a progress bar using JavaFX?

Maruthi Krishna
Updated on 18-May-2020 08:10:11

716 Views

A progress bar is an indicator of the advancement of an event (a series of steps). You can create a progress bar by instantiating the javafx.scene.control.ProgressBar class.ExampleThe following Example demonstrates the creation of a ProgressBar.import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.ProgressBar; import javafx.scene.control.ProgressIndicator; import javafx.scene.layout.HBox; import javafx.scene.paint.Color; import javafx.stage.Stage; public class ProgressBarExample extends Application {    public void start(Stage stage) {       //Creating a progress bar       ProgressBar progress = new ProgressBar();       //Setting value to the progress bar       progress.setProgress(0.5);       //Creating a progress indicator   ... Read More

Implementing the page factory in pagination

Maruthi Krishna
Updated on 18-May-2020 08:08:20

222 Views

Pagination divides content up between pages and allows users to skip between pages or go in order through the content. You can create pagination by instantiating the javafx.scene.control.Pagination class.ExampleThe following Example demonstrates hoe to create pagination and add data to it.import java.io.FileInputStream; import java.io.InputStream; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Pagination; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javafx.scene.paint.Color; import javafx.stage.Stage; public class PaginationAction extends Application {    public ImageView pageContent(int pageIndex){       try{          //Creating the image view          ImageView imageView = new ImageView();          //Setting the image view ... Read More

How to create a pagination using JavaFX?

Maruthi Krishna
Updated on 18-May-2020 08:05:47

313 Views

Pagination divides content up between pages and allows users to skip between pages or go in order through the content. You can create pagination by instantiating the javafx.scene.control.Pagination class.ExampleThe following Example demonstrates the creation of a Pagination.import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Pagination; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Stage; public class PaginationExample extends Application {    public void start(Stage stage) {       //Creating a pagination       Pagination pagination = new Pagination();       //Setting number of pages       pagination.setPageCount(10);       //Creating a vbox to hold the pagination   ... Read More

How to create a TreeView using JavaFX?

Maruthi Krishna
Updated on 18-May-2020 08:00:25

1K+ Views

A tree provides a view of hierarchical structures, each tree contains a root (highest object) and it contains children. You can create a tree view by instantiating the javafx.scene.control.TreeView class.ExampleThe following Example demonstrates the creation of a TreeView.import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.TreeItem; import javafx.scene.control.TreeView; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Stage; public class TreeViewExample extends Application {    public void start(Stage stage) {       //Creating tree items       TreeItem root1 = new TreeItem("Programming Languages");       TreeItem item1 = new TreeItem("Java");       TreeItem item2 = new TreeItem("Python");       ... Read More

How to add data to a TableView in JavaFX?

Maruthi Krishna
Updated on 18-May-2020 07:58:15

6K+ Views

TableView is a component that is used to create a table populate it, and remove items from it. You can create a table view by instantiating thejavafx.scene.control.TableView class.ExampleThe following Example demonstrates how to create a TableView and add data to it.import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; import javafx.scene.text.FontWeight; import javafx.stage.Stage; public class SettingData extends Application {    public void start(Stage stage) {       //Label for education       Label label = new Label("File Data:");       Font font ... Read More

How to create a TableView in JavaFX?

Maruthi Krishna
Updated on 18-May-2020 07:55:43

2K+ Views

TableView is a component that is used to create a table populate it, and remove items from it. You can create a table view by instantiating the javafx.scene.control.TableView class.ExampleThe following Example demonstrates the creation of a TableView.import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; import javafx.scene.text.FontWeight; import javafx.stage.Stage; public class TableViewExample extends Application {    public void start(Stage stage) {       //Label for education       Label label = new Label("File data:");       Font font = Font.font("verdana", FontWeight.BOLD, FontPosture.REGULAR, 12);     ... Read More

How to create a ListView using JavaFX?

Maruthi Krishna
Updated on 18-May-2020 07:53:55

3K+ Views

A list view is a scrollable list of items from which you can select desired items. You can create a list view component by instantiating the javafx.scene.control.ListView class. You can create either a vertical or a horizontal ListView.ExampleFollowing the JavaFX program demonstrates the creation of a ListView.import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; import javafx.scene.text.FontWeight; import javafx.stage.Stage; public class ListViewExample extends Application {    public void start(Stage stage) {       //Label for education          Label label = new Label("Educational qualification:");     ... Read More

How to add scroll bar to an image in JavaFX?

Maruthi Krishna
Updated on 18-May-2020 07:49:57

494 Views

A scroll bar contains a thumb, right and left buttons attached to a scrollable pane. Using this you can scroll the pane (attached to it) up and down.In JavaFX the javafx.scene.control.ScrollBar represents a scrollbar. You can create a scroll bar instantiating this class. Usually, a scroll bar is associated with other controls such as ScrollPane, ListView, etc.Setting ScrollBar to an imageThe property named value specifies the current value represented by the scroll bar you can add a listener to this property using the addListener() method.To attach a scroll bar to an image −Create an ImageView object representing the required image.Create ... Read More

Previous 1 ... 7 8 9 10 11 ... 16 Next
Advertisements