
Quick Contact
Java Tutorial
- What is Java?
- History of Java
- Hello Java Program
- Features of Java
- Basic Syntax
- Java Setup
- Data Types in Java
- Java Variables
- Operators in Java
- JVM
- Java If-else Statement
- Switch Case Statement
- Java Loops
- Do-While Loop
- Java While Loop
- Continue Statement
- Break Statement in Java
- Constructors in Java
- Oops Concept in Java
- Features of OOPs
- Inheritance
- Exeception handeling
- Aggregation (HAS-A relationship) in Java
- Method Overriding in Java
- Method Overloading
- Java Static Keyword
- Java This Keyword
- Java Final Keyword
- Polymorphism
- Static Binding and Dynamic Binding
- Abstract class in Java
- Access Modifiers in Java
- Difference between abstract class and interface
- Interface in Java
- Garbage Collection in Java
- Java Package
- Encapsulation
- Serialization and Deserialization in Java
- Java Inner Classes
- Java Applets
- Multithreading in Java
- Thread Priorities in Java
- Thread Creation
- Inter Thread Communication
- Wrapper Classes in Java
- Java Input Output
- Java AWT Introduction
- Java Layout Manager
- Java Layout Policy
- Java AWT Events
- Collection Framework
- Collection Framework List Interface
- Swing in Java
- Swing Utility Classes
- Swing Layout Managers
- Java JDBC
- Hibernate Framework Overview – Architecture and Basics
Springboot
- Spring Environment Setup
- Spring Boot CRUD REST API Project using IntelliJ IDEA | Postman | MySQL
- Dockerizing Spring Boot Application | Spring Boot Docker Tutorial
- spring-boot-restapidocumentation with swagger
- Spring Boot HttpClient Overview
- Apache HttpClient POST HTTP Request Example
- Apache HttpClient PUT HTTP Request Example
- Apache HttpClient DELETE HTTP Request Example
- Apache HttpClient HTML Form POST Request Example
- Spring Boot JSP Exampl
- Deploying Spring Boot WAR file with JSP to Tomcat
- Spring Boot Annotations
- Spring Core Annotations
- Spring MVC Annotations with Examples
- Spring Scheduling Annotations
- Spring - Java-based Container Configuration
- Spring Java Based Configuration Example
Hibernate
- Hibernate 5 hello world
- Hibernate- One to One Unidirectional Mapping Annotation Example
- Hibernate - Batch Processing
- Hibernate - Interceptors
- Hibernate 5 - Create, Read, Update and Delete (CRUD) Operations Example
- Hibernate Transaction Management
- Hibernate One to Many Unidirectional Mapping Example
- Hibernate One to Many Bidirectional Mapping Example
- Hibernate Many to Many Annotation Mapping Example
- Hibernate Primary KeyJoin Column
- Hibernate First Level Cache with Example
- Hibernate XML Configuration Example with Maven + Eclipse + MySQL Database
- Hibernate Java Configuration Example
- JPA 2 with Hibernate 5 Bootstrapping Example
- JPA and Hibernate Cascade Types
- Hibernate/JPA - Primary Key Generation
- Hibernate 5 - Enum Type Mapping Example
- Hibernate Component Mapping
- Hibernate Object States – Transient,Persistent and Detached
- Hibernate 5 - Save an Entity Example
- Hibernate 5 - Persist an Entity Example
- Hibernate 5 - saveOrUpdate() Method Example
- Hibernate 5 - get(), load() and byId() Method Examples
- Hibernate 5 - merge() Example
- Hibernate 5 - Delete or Remove an Entity Example
- Hibernate 5 - load() Method Example
- Hibernate Session Interface Methods
- Hibernate Session.clear() Method Example
- Introduction Of Java strutes to Architecture
- Struts 2 - Architecture
- Struts 2 - Configuration Files
- Struts 2 - Actions
- Struts 2 - Interceptors
- Struts 2 - Results & Result Types
- Struts 2 - Value Stack/OGNL
- Struts 2 - File Uploading
- Struts 2 - Database Access
- Struts 2 - Validations Framework
JAVA FX
- JavaFX Tutorial
- Introduction to JavaFX Pane
- JavaFX Popup
- JavaFX group
- JavaFX Controller
- JavaFX Gradient Color
- JavaFXAnchorPane
- JavaFXTabPane
- JavaFX Scene
- JavaFX Stage
- JavaFXWebView
- JavaFX Timeline
- JavaFX Timer
- JavaFX Image
- JavaFX Background
- JavaFX dialog
- JavaFX Font
- JavaFXTextArea
- JavaFXObservableList
- JavaFX GUI
- JavaFX FXML
- JavaFXEventHandler
- JavaFXGradle
- JavafxScrollpane
- JavaFXAPI
JavaFX dialog
In JavaFX, a dialog wraps down a DialogPane and offers the required API to give it to end-users. This class has one generic type, R, that denotes the result property type. A dialog can be organized for adding content, adding buttons, setting modality, and state the blocking as well as non-blocking behavior of the dialog. Several properties can be gain access to and set by the API of the dialog– header text, title, content text, width/height, location, resizable, and the content graphic or header graphic.
Let us see more on the JavaFX dialog in the below sections:
Syntax:
Below is the syntax used for JavaFXdialog.
Dialog< String> dg = new Dialog< String>();
Constructors
Following is the constructor of JavaFX dialog.
Dialog():
A dialog will be created without an identified owner.
Methods
Below are the common methods used in JavaFXdialog.
-
buildEventDispatchChain(EventDispatchChaintail)
An Event Dispatch Chain will be constructed for the target.
-
close()
Dialog will be hidden.
-
contentTextProperty()
For the dialog, this property denotes a content text.
-
getDialogPane()
dialogPane property’s value will be retrieved.
-
dialogPaneProperty()
Dialog’s root node, the pane consists of all visual items depicted in the dialog.
-
getGraphic()
graphic property’s value will be retrieved.
-
getContentText()
currently-set text content will be returned for the dialog pane.
-
getHeaderText()
currently-set header content will be returned for the dialog pane.
-
getHeight()
Dialog’s height will be returned.
-
getModality()
Dialog’s modality attribute will be returned.
-
getOnCloseRequest()
onCloseRequest property’s value will be retrieved.
-
getOnHidden()
onHidden property’s value will be retrieved.
-
getOnHiding()
onHiding property’s value will be retrieved.
-
getOnShowing()
onShowing property’s value will be retrieved.
-
getOnShown()
onShown property’s value will be retrieved.
-
getResult()
result property’s value will be retrieved.
-
getResultConverter()
resultConverter property’s value will be retrieved.
-
getX()
x property’s value will be retrieved.
-
getY()
y property’s value will be retrieved.
-
getOwner()
Dialog’s owner window will be retrieved or if unowned, null will be retrieved.
-
getTitle()
Dialog’s title will be retrieved.
-
getWidth()
Dialog’s width will be retrieved.
-
hide()
Dialog will be closed.
-
headerTextProperty()
Dialog pane’s header text will be represented by this property.
-
heightProperty()
Dialog pane’s height will be represented by this property.
-
initModality(Modalitymodality)
Dialog’s modality will be specified.
-
initOwner(Windowwindow)
Dialog’s owner Window will be specified or if top-level unowned, null will be retrieved.
-
initStyle(StageStylestyle)
Dialog’s style will be specified.
-
isResizable()
Dialog’s resize ability will be returned. That is, checks whether it is resizable or not.
-
isShowing()
Dialog’s display ability will be returned. That is, checks whether it is shown or not.
-
onCloseRequestProperty()
If there is an external request for closing the dialog is present, this property will be called.
-
onHiddenProperty()
After dialog is hidden, this property will be called.
-
onHidingProperty()
Before dialog is hidden, this property will be called.
-
onShowingProperty()
Before dialog is shown, this property will be called.
-
onShownProperty()
After dialog is shown, this property will be called.
-
resizableProperty()
Dialog’s resize ability will be returned.
-
resultProperty()
Dialog’s return value will be checked when this property is called.
-
setContentText(StringcontentText)
String that has to be displayed in the content area of the dialog will be set.
-
setDialogPane(DialogPanevalue)
Dialog pane’s value will be set by this property.
-
setHeaderText(StringheaderText)
String that has to be displayed in the header area of the dialog will be set.
-
setHeight(double height)
Dialog’s height will be set.
-
setOnCloseRequest(EventHandler< DialogEvent> value)
onCloseRequest property’s value will be set.
-
setOnHidden(EventHandler< DialogEvent> value)
onHidden property’s value will be set.
-
setOnHiding(EventHandler< DialogEvent> value)
onHiding property’s value will be set.
-
setOnShowing(EventHandler< DialogEvent> value)
onShowing property’s value will be set.
-
setOnShown(EventHandler< DialogEvent> value)
onShown property’s value will be set.
-
setResizable(boolean resizable)
dialog’s resize ability by the user will be set.
-
setResult(Rvalue)
result property’s value will be set.
-
setResultConverter(Callback< ButtonType,R> value)
resultConverter property’s value will be set.
-
setX(double x)
x property’s value will be set.
-
setY(double y)
y property’s value will be set.
-
setTitle(Stringtitle)
Dialog’s title will be set.
-
setWidth(double width)
Dialog’s width will be set.
-
setGraphic(Nodegraphic)
dialog graphic will be set that will be shown in header if that is displaying or to the content left side.
-
show()
Dialog will be shown but won’t wait for response of the user.
-
showAndWait()
Dialog will be shown and wait for response of the user.
-
showingProperty()
This property denotes whether the dialog is currently displaying.
-
titleProperty()
Dialog’s title property will be returned.
-
widthProperty()
Dialog’s width property will be returned.
-
xProperty()
Dialog’s horizontal location.
-
yProperty()
Dialog’s vertical location.
Example
Let us see a sample program for creating a JavaFX dialog.
Code:
//JavaFXprorgram that demonstrates the dg //import all necessary classes 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; //main class public class DialogProgram extends Application { //starts here... @Override public void start(Stage st) { //dialog creation Dialog< String> dg = new Dialog< String>(); //set title dg.setTitle("Sample dialog"); ButtonTypebt = new ButtonType("Click", ButtonData.OK_DONE); //Set dialog content dg.setContentText("dialog sample for demo"); //To the dialog pane, add the buttons dg.getDialogPane().getButtonTypes().add(bt); //Set the label Text tt = new Text("Please click on the button for displaying the dialog"); //set the font Fontfn = Font.font("verdana", FontWeight.BOLD, FontPosture.ITALIC, 14); tt.setFont(fn); //Create a button Buttonbtn = new Button("Dialog display"); //Dialog display on button clicking btn.setOnAction(e -> { dg.showAndWait(); }); //create a hbox for holding button as well as label HBoxpn = new HBox(14); //Set the space seperating the nodes of a pane pn.setPadding(new Insets(60, 160, 60, 70)); //add children pn.getChildren().addAll(tt, btn); //Create a scene object Scene sc = new Scene(new Group(pn), 596, 252, Color.RED); //set the title st.setTitle("Dialogg"); //set the scene st.setScene(sc); st.show(); } public static void main(String args[]){ launch(args); } }
Apply now for Advanced Java Training Course