Found 155 Articles for JavaFX

How to create an alert in JavaFX?

Maruthi Krishna
Updated on 19-May-2020 07:33:33

2K+ Views

An alert is a dialog which shows pre-built dialog types. You can create an alert by instantiating the javafx.scene.control.Alert class. This class is a subclass of the Dialog class. You can create required type of dialog bypassing the respective parameter at the time of instantiation as −Alert alert = new Alert(Alert.AlertType.CONFIRMATION);ExampleThe following Example demonstrates the creation of an Alert.import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; 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 AlertExample extends Application {    public void ... Read More

What is CheckBoxTreeItem in JavaFX explain with an example?

Maruthi Krishna
Updated on 19-May-2020 07:30:20

571 Views

Check boxA checkbox is a type of selection control, which is square in shape with a tick mark int it, It has three states checked or, unchecked and, tristate/indeterminate (optional). Unlike radio buttons, you cannot combine checkboxes using Toggle Button.Tree viewA 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.A CheckBoxTreeItem is a tree view formed with checkboxes. You can create a checkbox tree item by instantiating the javafx.scene.control.CheckBoxTreeItem class.ExampleThe following Example demonstrates the creation of a CheckBoxTreeItem.import javafx.application.Application; import ... Read More

How to create a ToolBar in JavaFX?

Maruthi Krishna
Updated on 19-May-2020 07:28:20

702 Views

A toolbar is used to display UI elements such as buttons, toggle buttons, and separators, etc.. You cannot add any other nodes to a toolbar. The contents of a toolbar can be arranged either horizontally or vertically. You can create a toolbar by instantiating the javafx.scene.control.ToolBar class.ExampleThe following Example demonstrates the creation of a ToolBar.import javafx.application.Application; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Separator; import javafx.scene.control.ToolBar; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Stage; public class ToolBarExample extends Application {    public void start(Stage stage) {       Button bt1 = new Button("Java");       Button ... Read More

How to create a text area in JavaFX?

Maruthi Krishna
Updated on 19-May-2020 07:25:59

3K+ Views

A text area is a multi-line editor where you can enter text. Unlike previous versions, in the latest versions of JavaFX, a TextArea does not allow single lines in it. You can create a text area by instantiating the javafx.scene.control.TextArea class.ExampleThe following Example demonstrates the creation of a TextArea.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.TextArea; 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 TextAreaExample extends Application {    public void start(Stage stage) {       //Setting the label       Label label = new Label("Address");     ... Read More

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

7K+ 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

428 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

306 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

257 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

926 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

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