SlideShare a Scribd company logo
1 of 23
Download to read offline
Introduction to
JavaFX Dialogs
HASUNUMA Kenji

k.hasunuma@coppermine.jp
@khasunuma
Overview
JavaFX Dialogs (8u40)
• Alert - returns any ButtonType

• TextInputDialog - returns input text

• ChoiceDialog - returns choosen item

• Dialog - superclass of all dialogs
Alert - INFORMATION
Alert - WARNING
Alert - ERROR
Alert - CONFIRMATION
Alert - NONE
TextInputDialog
ChoiceDialog
Usage
Dialog on code
• Works instead of Stage.

• Often, exists into a controller as a part of
event procedures.

• showAndWait() - show and wait, then
returns a value as Optional<R>.
• show() - show and wait, then returns no
value.
Layout
DialogPane
ButtonTypes
Graphic
HeaderText
ContentText
Dialog
// Create a dialog

Alert alert = new Alert(INFORMATION);

!
// Setting properties

alert.setTitle("Title (INFORMATION)");

alert.setHeaderText("Header Text");

alert.setContentText("Content Text");

!
// Show and obtain the result

Optional<ButtonType> result 

= alert.showAndWait();

!
// Another way if the result is needless

// alert.show();
Result types
Dialog Result type
Alert
ButtonType

!
OK, CANCEL, CLOSE, APPLY,
FINISH, YES, NO, NEXT, PREVIOUS
TextInputDialog String
ChoiceDialog Type of choosen item
Tips
I want such a dialog...
How?
I want such a dialog...
How?
// Add following code

alert.setHeaderText(null);
/**

* Tips #2: the way to resize a dialog.

*/

public class SomeController {

@FXML

public void onClick(ActionEvent event) {

. . .

Alert alert = new Alert(INFORMATION);
// Using following methods to resize;
// setPrefWidth, setPrefHeight and setPrefSize
alert.getDialogPane().setPrefSize(400.0, 300.0);
Optional<String> result = dialog.showAndWait();
/* Handle the result */
}

}
/**

* Tips #3: Simple dialog-based application.

*/

public class DialogApp extends Application {

@Overrides

public void start(Stage stage) throws Exception {

TextInputDialog dialog = new TextInputDialog();
/* setting the dialog */
Optional<String> result = dialog.showAndWait();
/* handle the result */
}



public static void main(String...args) {

launch(args);

}

}
Conclusion
• The representation of JavaFX dialogs
are Dialog and their subclasses.

• JavaFX Dialog looks like Stage, but is
not Stage.

• At first create and configure a dialog,
and call showAndWait method.
Introduction to
JavaFX Dialogs
HASUNUMA Kenji

k.hasunuma@coppermine.jp

@khasunuma

More Related Content

What's hot

AWT Packages , Containers and Components
AWT Packages , Containers and ComponentsAWT Packages , Containers and Components
AWT Packages , Containers and ComponentsSohanur63
 
The AWT and Swing
The AWT and SwingThe AWT and Swing
The AWT and Swingadil raja
 
Alexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java FxuiAlexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java Fxuirit2010
 
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in javaAdil Mehmoood
 
Java- GUI- Mazenet solution
Java- GUI- Mazenet solutionJava- GUI- Mazenet solution
Java- GUI- Mazenet solutionMazenetsolution
 
Dr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWTDr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWTDrRajeshreeKhande
 
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!Noopur Gupta
 
Java: Java Applets
Java: Java AppletsJava: Java Applets
Java: Java AppletsTareq Hasan
 
What's cool in Eclipse goody bag!
What's cool in Eclipse goody bag!What's cool in Eclipse goody bag!
What's cool in Eclipse goody bag!Noopur Gupta
 
Graphics programming in Java
Graphics programming in JavaGraphics programming in Java
Graphics programming in JavaTushar B Kute
 
High productivity development with Eclipse and Java 8
High productivity development with Eclipse and Java 8High productivity development with Eclipse and Java 8
High productivity development with Eclipse and Java 8Noopur Gupta
 

What's hot (20)

AWT Packages , Containers and Components
AWT Packages , Containers and ComponentsAWT Packages , Containers and Components
AWT Packages , Containers and Components
 
AWT
AWT AWT
AWT
 
The AWT and Swing
The AWT and SwingThe AWT and Swing
The AWT and Swing
 
Alexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java FxuiAlexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java Fxui
 
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in java
 
25 awt
25 awt25 awt
25 awt
 
Java- GUI- Mazenet solution
Java- GUI- Mazenet solutionJava- GUI- Mazenet solution
Java- GUI- Mazenet solution
 
Awt and swing in java
Awt and swing in javaAwt and swing in java
Awt and swing in java
 
Dr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWTDr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWT
 
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!
 
Java: Java Applets
Java: Java AppletsJava: Java Applets
Java: Java Applets
 
What's cool in Eclipse goody bag!
What's cool in Eclipse goody bag!What's cool in Eclipse goody bag!
What's cool in Eclipse goody bag!
 
Graphics programming in Java
Graphics programming in JavaGraphics programming in Java
Graphics programming in Java
 
GUI components in Java
GUI components in JavaGUI components in Java
GUI components in Java
 
Eclipse Tips & Tricks
Eclipse Tips & TricksEclipse Tips & Tricks
Eclipse Tips & Tricks
 
Event handling
Event handlingEvent handling
Event handling
 
Swing
SwingSwing
Swing
 
High productivity development with Eclipse and Java 8
High productivity development with Eclipse and Java 8High productivity development with Eclipse and Java 8
High productivity development with Eclipse and Java 8
 
Applets in java
Applets in javaApplets in java
Applets in java
 
Chapter 1 swings
Chapter 1 swingsChapter 1 swings
Chapter 1 swings
 

Similar to Introduction to JavaFX Dialogs

Gui programming a review - mixed content
Gui programming   a review - mixed contentGui programming   a review - mixed content
Gui programming a review - mixed contentYogesh Kumar
 
GUI (graphical user interface)
GUI (graphical user interface)GUI (graphical user interface)
GUI (graphical user interface)rishi ram khanal
 
Complete java swing
Complete java swingComplete java swing
Complete java swingjehan1987
 
Alexandre.iline rit 2010 java_fxui_extra
Alexandre.iline rit 2010 java_fxui_extraAlexandre.iline rit 2010 java_fxui_extra
Alexandre.iline rit 2010 java_fxui_extrarit2010
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to GriffonJames Williams
 
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insEclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insTonny Madsen
 
Modernize Your Real-World Application with Eclipse 4 and JavaFX
Modernize Your Real-World Application with Eclipse 4 and JavaFXModernize Your Real-World Application with Eclipse 4 and JavaFX
Modernize Your Real-World Application with Eclipse 4 and JavaFXCole Markham
 
Db Triggers05ch
Db Triggers05chDb Triggers05ch
Db Triggers05chtheo_10
 
TDD by Controlling Dependencies
TDD by Controlling DependenciesTDD by Controlling Dependencies
TDD by Controlling DependenciesJorge Ortiz
 
Input and Output In C Language
Input and Output In C LanguageInput and Output In C Language
Input and Output In C LanguageAdnan Khan
 
Python programming workshop session 1
Python programming workshop session 1Python programming workshop session 1
Python programming workshop session 1Abdul Haseeb
 
45 aop-programming
45 aop-programming45 aop-programming
45 aop-programmingdaotuan85
 
Enterprising JavaFX
Enterprising JavaFXEnterprising JavaFX
Enterprising JavaFXRichard Bair
 

Similar to Introduction to JavaFX Dialogs (20)

Gui programming a review - mixed content
Gui programming   a review - mixed contentGui programming   a review - mixed content
Gui programming a review - mixed content
 
GUI (graphical user interface)
GUI (graphical user interface)GUI (graphical user interface)
GUI (graphical user interface)
 
GUI programming
GUI programmingGUI programming
GUI programming
 
Complete java swing
Complete java swingComplete java swing
Complete java swing
 
Alexandre.iline rit 2010 java_fxui_extra
Alexandre.iline rit 2010 java_fxui_extraAlexandre.iline rit 2010 java_fxui_extra
Alexandre.iline rit 2010 java_fxui_extra
 
Qt Workshop
Qt WorkshopQt Workshop
Qt Workshop
 
Chapter 05
Chapter 05Chapter 05
Chapter 05
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to Griffon
 
Python basics
Python basicsPython basics
Python basics
 
Unit 7 Java
Unit 7 JavaUnit 7 Java
Unit 7 Java
 
Gui
GuiGui
Gui
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
 
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insEclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
 
Modernize Your Real-World Application with Eclipse 4 and JavaFX
Modernize Your Real-World Application with Eclipse 4 and JavaFXModernize Your Real-World Application with Eclipse 4 and JavaFX
Modernize Your Real-World Application with Eclipse 4 and JavaFX
 
Db Triggers05ch
Db Triggers05chDb Triggers05ch
Db Triggers05ch
 
TDD by Controlling Dependencies
TDD by Controlling DependenciesTDD by Controlling Dependencies
TDD by Controlling Dependencies
 
Input and Output In C Language
Input and Output In C LanguageInput and Output In C Language
Input and Output In C Language
 
Python programming workshop session 1
Python programming workshop session 1Python programming workshop session 1
Python programming workshop session 1
 
45 aop-programming
45 aop-programming45 aop-programming
45 aop-programming
 
Enterprising JavaFX
Enterprising JavaFXEnterprising JavaFX
Enterprising JavaFX
 

More from Kenji HASUNUMA

How to adapt MicroProfile API for generic Web applications
How to adapt MicroProfile API for generic Web applicationsHow to adapt MicroProfile API for generic Web applications
How to adapt MicroProfile API for generic Web applicationsKenji HASUNUMA
 
Life of our small product
Life of our small productLife of our small product
Life of our small productKenji HASUNUMA
 
Jakarta EE: The First Parts
Jakarta EE: The First PartsJakarta EE: The First Parts
Jakarta EE: The First PartsKenji HASUNUMA
 
Introduction to MicroProfile Metrics
Introduction to MicroProfile MetricsIntroduction to MicroProfile Metrics
Introduction to MicroProfile MetricsKenji HASUNUMA
 
Introduction to JCA and MDB
Introduction to JCA and MDBIntroduction to JCA and MDB
Introduction to JCA and MDBKenji HASUNUMA
 
Basic method for Java EE Web Profile
Basic method for Java EE Web ProfileBasic method for Java EE Web Profile
Basic method for Java EE Web ProfileKenji HASUNUMA
 
Brand New Date and Time API
Brand New Date and Time APIBrand New Date and Time API
Brand New Date and Time APIKenji HASUNUMA
 
Virtualization Fundamental
Virtualization FundamentalVirtualization Fundamental
Virtualization FundamentalKenji HASUNUMA
 
JLS Myths - If-then-else statement -
JLS Myths - If-then-else statement -JLS Myths - If-then-else statement -
JLS Myths - If-then-else statement -Kenji HASUNUMA
 
Introduction to Date and Time API 4
Introduction to Date and Time API 4Introduction to Date and Time API 4
Introduction to Date and Time API 4Kenji HASUNUMA
 
Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Kenji HASUNUMA
 
Introduction to Date and Time API 3
Introduction to Date and Time API 3Introduction to Date and Time API 3
Introduction to Date and Time API 3Kenji HASUNUMA
 
Introduction to Date and Time API 2
Introduction to Date and Time API 2Introduction to Date and Time API 2
Introduction to Date and Time API 2Kenji HASUNUMA
 
Introduction to Date and Time API
Introduction to Date and Time APIIntroduction to Date and Time API
Introduction to Date and Time APIKenji HASUNUMA
 

More from Kenji HASUNUMA (15)

How to adapt MicroProfile API for generic Web applications
How to adapt MicroProfile API for generic Web applicationsHow to adapt MicroProfile API for generic Web applications
How to adapt MicroProfile API for generic Web applications
 
Life of our small product
Life of our small productLife of our small product
Life of our small product
 
Jakarta EE: The First Parts
Jakarta EE: The First PartsJakarta EE: The First Parts
Jakarta EE: The First Parts
 
Introduction to MicroProfile Metrics
Introduction to MicroProfile MetricsIntroduction to MicroProfile Metrics
Introduction to MicroProfile Metrics
 
Introduction to JCA and MDB
Introduction to JCA and MDBIntroduction to JCA and MDB
Introduction to JCA and MDB
 
Basic method for Java EE Web Profile
Basic method for Java EE Web ProfileBasic method for Java EE Web Profile
Basic method for Java EE Web Profile
 
Brand New Date and Time API
Brand New Date and Time APIBrand New Date and Time API
Brand New Date and Time API
 
Virtualization Fundamental
Virtualization FundamentalVirtualization Fundamental
Virtualization Fundamental
 
JLS Myths - If-then-else statement -
JLS Myths - If-then-else statement -JLS Myths - If-then-else statement -
JLS Myths - If-then-else statement -
 
Introduction to Date and Time API 4
Introduction to Date and Time API 4Introduction to Date and Time API 4
Introduction to Date and Time API 4
 
Fundamental Java
Fundamental JavaFundamental Java
Fundamental Java
 
Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2
 
Introduction to Date and Time API 3
Introduction to Date and Time API 3Introduction to Date and Time API 3
Introduction to Date and Time API 3
 
Introduction to Date and Time API 2
Introduction to Date and Time API 2Introduction to Date and Time API 2
Introduction to Date and Time API 2
 
Introduction to Date and Time API
Introduction to Date and Time APIIntroduction to Date and Time API
Introduction to Date and Time API
 

Recently uploaded

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 

Introduction to JavaFX Dialogs

  • 1. Introduction to JavaFX Dialogs HASUNUMA Kenji k.hasunuma@coppermine.jp @khasunuma
  • 3. JavaFX Dialogs (8u40) • Alert - returns any ButtonType • TextInputDialog - returns input text • ChoiceDialog - returns choosen item • Dialog - superclass of all dialogs
  • 11. Usage
  • 12. Dialog on code • Works instead of Stage. • Often, exists into a controller as a part of event procedures. • showAndWait() - show and wait, then returns a value as Optional<R>. • show() - show and wait, then returns no value.
  • 14. // Create a dialog Alert alert = new Alert(INFORMATION); ! // Setting properties alert.setTitle("Title (INFORMATION)"); alert.setHeaderText("Header Text"); alert.setContentText("Content Text"); ! // Show and obtain the result Optional<ButtonType> result = alert.showAndWait(); ! // Another way if the result is needless // alert.show();
  • 15. Result types Dialog Result type Alert ButtonType ! OK, CANCEL, CLOSE, APPLY, FINISH, YES, NO, NEXT, PREVIOUS TextInputDialog String ChoiceDialog Type of choosen item
  • 16. Tips
  • 17. I want such a dialog... How?
  • 18. I want such a dialog... How? // Add following code alert.setHeaderText(null);
  • 19. /** * Tips #2: the way to resize a dialog. */ public class SomeController { @FXML public void onClick(ActionEvent event) { . . . Alert alert = new Alert(INFORMATION); // Using following methods to resize; // setPrefWidth, setPrefHeight and setPrefSize alert.getDialogPane().setPrefSize(400.0, 300.0); Optional<String> result = dialog.showAndWait(); /* Handle the result */ } }
  • 20. /** * Tips #3: Simple dialog-based application. */ public class DialogApp extends Application { @Overrides public void start(Stage stage) throws Exception { TextInputDialog dialog = new TextInputDialog(); /* setting the dialog */ Optional<String> result = dialog.showAndWait(); /* handle the result */ } public static void main(String...args) { launch(args); } }
  • 22. • The representation of JavaFX dialogs are Dialog and their subclasses. • JavaFX Dialog looks like Stage, but is not Stage. • At first create and configure a dialog, and call showAndWait method.
  • 23. Introduction to JavaFX Dialogs HASUNUMA Kenji k.hasunuma@coppermine.jp @khasunuma