SlideShare una empresa de Scribd logo
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

Más contenido relacionado

La actualidad más candente

Alexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java FxuiAlexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java Fxuirit2010
 
The AWT and Swing
The AWT and SwingThe AWT and Swing
The AWT and Swingadil raja
 
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in javaAdil Mehmoood
 
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
 
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
 
Java: Java Applets
Java: Java AppletsJava: Java Applets
Java: Java AppletsTareq Hasan
 
Java- GUI- Mazenet solution
Java- GUI- Mazenet solutionJava- GUI- Mazenet solution
Java- GUI- Mazenet solutionMazenetsolution
 
Graphics programming in Java
Graphics programming in JavaGraphics programming in Java
Graphics programming in JavaTushar B Kute
 
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
 
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
 

La actualidad más candente (20)

Alexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java FxuiAlexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java Fxui
 
AWT
AWT AWT
AWT
 
The AWT and Swing
The AWT and SwingThe AWT and Swing
The AWT and Swing
 
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in java
 
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!
 
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!
 
25 awt
25 awt25 awt
25 awt
 
Java: Java Applets
Java: Java AppletsJava: Java Applets
Java: Java Applets
 
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
 
Eclipse Tips & Tricks
Eclipse Tips & TricksEclipse Tips & Tricks
Eclipse Tips & Tricks
 
Graphics programming in Java
Graphics programming in JavaGraphics programming in Java
Graphics programming 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
 
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
 
GUI components in Java
GUI components in JavaGUI components in Java
GUI components in Java
 
Event handling
Event handlingEvent handling
Event handling
 
Swing
SwingSwing
Swing
 
Applets in java
Applets in javaApplets in java
Applets in java
 
Java applet
Java appletJava applet
Java applet
 
3. applets
3. applets3. applets
3. applets
 

Similar a Introduction to JavaFX Dialogs

Introduction to JavaFX Dialogs
Introduction to JavaFX DialogsIntroduction to JavaFX Dialogs
Introduction to JavaFX DialogsKenji HASUNUMA
 
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
 
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
 
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
 
Enterprising JavaFX
Enterprising JavaFXEnterprising JavaFX
Enterprising JavaFXRichard Bair
 
Android ui dialog
Android ui dialogAndroid ui dialog
Android ui dialogKrazy Koder
 
Python programming workshop session 1
Python programming workshop session 1Python programming workshop session 1
Python programming workshop session 1Abdul Haseeb
 
Db Triggers05ch
Db Triggers05chDb Triggers05ch
Db Triggers05chtheo_10
 
TDD by Controlling Dependencies
TDD by Controlling DependenciesTDD by Controlling Dependencies
TDD by Controlling DependenciesJorge Ortiz
 

Similar a Introduction to JavaFX Dialogs (20)

Introduction to JavaFX Dialogs
Introduction to JavaFX DialogsIntroduction to JavaFX Dialogs
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 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
 
Gui
GuiGui
Gui
 
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
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to Griffon
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
 
Unit 7 Java
Unit 7 JavaUnit 7 Java
Unit 7 Java
 
Python basics
Python basicsPython basics
Python basics
 
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
 
Enterprising JavaFX
Enterprising JavaFXEnterprising JavaFX
Enterprising JavaFX
 
Android ui dialog
Android ui dialogAndroid ui dialog
Android ui dialog
 
Python programming workshop session 1
Python programming workshop session 1Python programming workshop session 1
Python programming workshop session 1
 
Db Triggers05ch
Db Triggers05chDb Triggers05ch
Db Triggers05ch
 
TDD by Controlling Dependencies
TDD by Controlling DependenciesTDD by Controlling Dependencies
TDD by Controlling Dependencies
 

Más de Kenji 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
 
Overviewing Admin Console
Overviewing Admin ConsoleOverviewing Admin Console
Overviewing Admin ConsoleKenji 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
 
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
 
Virtualization Fundamental
Virtualization FundamentalVirtualization Fundamental
Virtualization FundamentalKenji 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 Begineers guide 2
Collections Framework Begineers guide 2Collections Framework Begineers guide 2
Collections Framework Begineers 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
 
Brand new Date and Time API
Brand new Date and Time APIBrand new Date and Time API
Brand new Date and Time APIKenji 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 Data and Time API
Introduction to Data and Time APIIntroduction to Data and Time API
Introduction to Data and Time APIKenji HASUNUMA
 

Más de Kenji HASUNUMA (17)

oop-in-javaee
oop-in-javaeeoop-in-javaee
oop-in-javaee
 
Jakarta REST in depth
Jakarta REST in depthJakarta REST in depth
Jakarta REST in depth
 
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
 
Overviewing Admin Console
Overviewing Admin ConsoleOverviewing Admin Console
Overviewing Admin Console
 
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
 
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
 
Virtualization Fundamental
Virtualization FundamentalVirtualization Fundamental
Virtualization Fundamental
 
JLS myths
JLS mythsJLS myths
JLS myths
 
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 Begineers guide 2
Collections Framework Begineers guide 2Collections Framework Begineers guide 2
Collections Framework Begineers 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
 
Brand new Date and Time API
Brand new Date and Time APIBrand new Date and Time API
Brand new Date and Time API
 
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 Data and Time API
Introduction to Data and Time APIIntroduction to Data and Time API
Introduction to Data and Time API
 

Último

AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAlluxio, Inc.
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)Max Lee
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationHelp Desk Migration
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfmbmh111980
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
 
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Gáspár Nagy
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1KnowledgeSeed
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...Alluxio, Inc.
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisNeo4j
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Krakówbim.edu.pl
 
A Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data MigrationA Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data MigrationHelp Desk Migration
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfVictor Lopez
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
CompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdfCompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdfFurqanuddin10
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfOrtus Solutions, Corp
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems ApproachNeo4j
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandIES VE
 

Último (20)

AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data Migration
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024
 
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
A Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data MigrationA Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data Migration
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
CompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdfCompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdf
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 

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