Found 9290 Articles for Object Oriented Programming

How to Create a Spinner in JavaFX?

Maruthi Krishna
Updated on 19-May-2020 07:22:57

2K+ Views

A spinner is a UI element that displays a number with an up and down arrow with it. You can increase or, decrease the value of the spinner using those arrows. You can create a spinner by instantiating the javafx.scene.control.Spinner class.ExampleThe following Example demonstrates the creation of a Spinner.import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.Spinner; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; import javafx.scene.text.FontWeight; import javafx.stage.Stage; public class SpinnerExample extends Application {    public void start(Stage stage) {       //Setting the label       Label label = new Label("Select ... Read More

How to create a Dialog in JavaFX?

Maruthi Krishna
Updated on 04-Jun-2021 06:10:21

8K+ Views

A Dialog is a graphical element, a window that shows information to the window and receives a response. You can create a dialog by instantiating the javafx.scene.control.Dialog class.ExampleThe following Example demonstrates the creation of a Dialog.import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ButtonBar.ButtonData; import javafx.scene.control.ButtonType; import javafx.scene.control.Dialog; import javafx.scene.layout.HBox; import javafx.stage.Stage; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; public class DialogExample extends Application {    @Override    public void start(Stage stage) {       //Creating a dialog       Dialog dialog = new Dialog();       //Setting the title   ... Read More

How to set image as hyperlink in JavaFX?

Maruthi Krishna
Updated on 19-May-2020 07:18:42

480 Views

An Hyperlink is a UI component that responds to clicks and roll overs. You can create a hiperlink by instantiating the javafx.scene.control.Hiperlink class. You can set an image as a hiperlink using the setGraphic() method.Exampleimport java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Hyperlink; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Stage; public class HyperLinkSettingGraphic extends Application {    public void start(Stage stage) throws FileNotFoundException {       //Creating a hyper link       Hyperlink link = new Hyperlink();       //Creating a graphic       ImageView view ... Read More

How to create a Hyperlink using JavaFX?

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

323 Views

A Hyperlink is a UI component that responds to clicks and rollovers. You can create a hyperlink by instantiating the javafx.scene.control.Hiperlink class.ExampleThe following Example demonstrates the creation of a Hyperlink.import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Hyperlink; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Stage; public class HiperlinkExample extends Application {    public void start(Stage stage) {       //Creating a hyper link       Hyperlink link = new Hyperlink("https://www.tutorialspoint.com");       //Creating a vbox to hold the pagination       VBox vbox = new VBox();       vbox.setSpacing(5);       vbox.setPadding(new Insets(50, 50, ... Read More

How to create a ColorPicker using JavaFX?

Maruthi Krishna
Updated on 18-May-2020 08:19:36

300 Views

A color picker gives you a standard color palette fro which you can select a required color. You can create a color picker by instantiating the javafx.scene.control.ColorPicker class.ExampleThe following Example demonstrates the creation of a ColorPicker.import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.ColorPicker; import javafx.scene.control.Label; 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; import javafx.stage.Stage; public class ColorPickerExample extends Application {    public void start(Stage stage) {       //Setting the label       Label label = new Label("Select Desired Color:");       Font font = Font.font("verdana", FontWeight.BOLD, FontPosture.REGULAR, 12);       ... Read More

How to edit a comboBox in JavaFX?

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

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.The ComboBox class has a method known as editable (boolean), which specifies whether the current Combobox allows user input. You can set the value to this property using the setEditable() method.Therefore, to edit a JavaFX ComboBox invoke the setEditable() method on it by passing the boolean value true as a parameter.Exampleimport javafx.application.Application; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.scene.Group; ... Read More

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

308 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

797 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

241 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

Advertisements