SlideShare a Scribd company 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

More Related Content

What's hot

AWT Packages , Containers and Components
AWT Packages , Containers and ComponentsAWT Packages , Containers and Components
AWT Packages , Containers and Components
Sohanur63
 
The AWT and Swing
The AWT and SwingThe AWT and Swing
The AWT and Swing
adil 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 java
Adil Mehmoood
 
25 awt
25 awt25 awt
25 awt
degestive
 
Java- GUI- Mazenet solution
Java- GUI- Mazenet solutionJava- GUI- Mazenet solution
Java- GUI- Mazenet solution
Mazenetsolution
 
Awt and swing in java
Awt and swing in javaAwt and swing in java
Awt and swing in java
Shehrevar Davierwala
 
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
DrRajeshreeKhande
 
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 Applets
Tareq 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 Java
Tushar B Kute
 
GUI components in Java
GUI components in JavaGUI components in Java
GUI components in Java
kirupasuchi1996
 
Eclipse Tips & Tricks
Eclipse Tips & TricksEclipse Tips & Tricks
Eclipse Tips & Tricks
Eclipse Day India
 
Swing
SwingSwing
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
Noopur Gupta
 
Applets in java
Applets in javaApplets in java
Applets in java
Wani Zahoor
 

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 content
Yogesh Kumar
 
GUI (graphical user interface)
GUI (graphical user interface)GUI (graphical user interface)
GUI (graphical user interface)
rishi ram khanal
 
GUI programming
GUI programmingGUI programming
GUI programming
Vineeta Garg
 
Complete java swing
Complete java swingComplete java swing
Complete java swing
jehan1987
 
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
 
Qt Workshop
Qt WorkshopQt Workshop
Qt Workshop
Johan Thelin
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to Griffon
James Williams
 
Python basics
Python basicsPython basics
Python basics
RANAALIMAJEEDRAJPUT
 
Gui
GuiGui
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
shanmuga rajan
 
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
Tonny 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 JavaFX
Cole Markham
 
Db Triggers05ch
Db Triggers05chDb Triggers05ch
Db Triggers05ch
theo_10
 
TDD by Controlling Dependencies
TDD by Controlling DependenciesTDD by Controlling Dependencies
TDD by Controlling Dependencies
Jorge Ortiz
 
Input and Output In C Language
Input and Output In C LanguageInput and Output In C Language
Input and Output In C Language
Adnan Khan
 
Python programming workshop session 1
Python programming workshop session 1Python programming workshop session 1
Python programming workshop session 1
Abdul Haseeb
 
45 aop-programming
45 aop-programming45 aop-programming
45 aop-programmingdaotuan85
 
Enterprising JavaFX
Enterprising JavaFXEnterprising JavaFX
Enterprising JavaFX
Richard 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 applications
Kenji HASUNUMA
 
Life of our small product
Life of our small productLife of our small product
Life of our small product
Kenji HASUNUMA
 
Jakarta EE: The First Parts
Jakarta EE: The First PartsJakarta EE: The First Parts
Jakarta EE: The First Parts
Kenji HASUNUMA
 
Introduction to MicroProfile Metrics
Introduction to MicroProfile MetricsIntroduction to MicroProfile Metrics
Introduction to MicroProfile Metrics
Kenji HASUNUMA
 
Introduction to JCA and MDB
Introduction to JCA and MDBIntroduction to JCA and MDB
Introduction to JCA and MDB
Kenji 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 Profile
Kenji HASUNUMA
 
Brand New Date and Time API
Brand New Date and Time APIBrand New Date and Time API
Brand New Date and Time API
Kenji HASUNUMA
 
Virtualization Fundamental
Virtualization FundamentalVirtualization Fundamental
Virtualization Fundamental
Kenji 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 4
Kenji HASUNUMA
 
Fundamental Java
Fundamental JavaFundamental Java
Fundamental Java
Kenji HASUNUMA
 
Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2
Kenji 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 3
Kenji 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 2
Kenji HASUNUMA
 
Introduction to Date and Time API
Introduction to Date and Time APIIntroduction to Date and Time API
Introduction to Date and Time API
Kenji 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

Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 

Recently uploaded (20)

Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 

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