How can I implement a model (DialogResult) window function?
//Popup extends Stage,
Popup popup=new Popup(primaryStage,title,content);
DialogResult result=popup.show();
if(result==DialogResult.ok)//if user doesn't close stage, this line isn't triggered.
//my next code here...
public enum DialogResult
OK,
Cancel,
Yes,
No,
None
} Actually,I implemented Popup based on Stage, and I created a lot of customized control in popup,I'd like to wait for the Dialogresult value if user do something on my popup,if user doesn't close stage, if(result==DialogResult.ok) isn't triggered.any suggestion?
Edited by: imtoocute on Apr 30, 2012 1:41 PM
This has got to be one of the most asked questions on the forum - I guess because (with the exception of JavaFX 2.0), every UI technology known to man has had this functionality built-in since their first version.
There are a few different ways to achieve this:
See:
Dialog Box Problem "Dialog Box Problem"
https://gist.github.com/1887631 " JavaFX Modal Confirm Dialog Box Example"
http://javafx-jira.kenai.com/browse/RT-19783 "Provide an option to allow modal windows to be blocking" (implemented for 2.2)
http://javafx-jira.kenai.com/browse/RT-12643 "Add javafx.scene.control.Alert class"
Quick answer is that unless you are using 2.2 and can use a stage.showAndWait() function, then implement your dialog via a stage or a popup or a stackpane overlay and use callbacks on actions in the dialog to collect the result of user interaction with the dialog and resume execution.
Hopefully that helps you.
Similar Messages
-
How can I implement a comfirmation window when closing javafx application?
hi,guys
I'd like to add a confirmation window when user is closing my javafx application,if user click yes, I will close the application,if no ,I wouldn't close it ,how can I implement this function?
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>(){
@Override
public void handle(WindowEvent arg0) {
try
//todo
catch(Exception ex)
System.out.print(ex.getMessage()+"\r\n");
});Hi. Here is an example:
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.stage.*;
import javafx.scene.*;
import javafx.scene.paint.Color;
import javafx.scene.layout.*;
import javafx.scene.control.*;
public class ModalDialog {
public ModalDialog(final Stage stg) {
final Stage stage = new Stage();
//Initialize the Stage with type of modal
stage.initModality(Modality.APPLICATION_MODAL);
//Set the owner of the Stage
stage.initOwner(stg);
Group group = new Group();
HBox hb = new HBox();
hb.setSpacing(20);
hb.setAlignment(Pos.CENTER);
Label label = new Label("You are about to close \n your application: ");
Button no = new Button("No");
no.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
stage.hide();
Button yes = new Button("Yes");
yes.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
stg.close();
hb.getChildren().addAll(yes, no);
VBox vb = new VBox();
vb.setSpacing(20);
vb.setAlignment(Pos.CENTER);
vb.getChildren().addAll(label,hb);
stage.setTitle("Closing ...");
stage.setScene(new Scene( vb, 260, 110, Color.LIGHTCYAN));
stage.show();
}Test:
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.stage.*;
* @author Shakir
public class ModalTest extends Application {
* @param args the command line arguments
public static void main(String[] args) {
Application.launch(ModalTest.class, args);
@Override
public void start(final Stage primaryStage) {
primaryStage.setTitle("Hello World");
Group root = new Group();
Scene scene = new Scene(root, 300, 250, Color.LIGHTGREEN);
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>(){
@Override
public void handle(WindowEvent arg0) {
arg0.consume();
try
ModalDialog md = new ModalDialog(primaryStage);
catch(Exception ex)
System.out.print(ex.getMessage()+"\r\n");
primaryStage.setScene(scene);
primaryStage.show();
} -
How can I implement Authentication in LDAP
How can I implement Authentication in LDAP.
Hi,
If ur using JAAS, then use NTLoginModule in ur conf file and your own defined CallbackHandler for validating and obtaining the Subject (user connected to your domain).
Remember the user is the one which the code obtains when u login to your Domain based machine.
Apart from this, Apache Http Server also provides you with a popup window asking for the user's credentials when u set the SSPIDomain in the httpd.conf file.
httpd.conf
========
<Location /Seet/servlet/ >
SSPIAuth On
AllowOverride None
Order allow,deny
Allow from all
AuthName "seet190 auth"
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
require valid-user
SSPIDomain seet190
</Location>
seet190 is the domain name
Actually so far in the Security Forum, u might refer to some of the replies posted for more help but actual LDAP authentication can be done by passing the user's info too.
HTH,
Seetesh -
How can we implement SSO in SP2013
Hi,
How can we implement SSO from other applications to SP2013 web app.
Please suggest with an example.
Thanks,
Krishna
KrishnasandeepBasically it is used to store credentials in a safe way. My article at
http://sharepointdragons.com/2012/02/13/creating-a-bcs-net-assembly-connector/ discusses an example where it is leveraged within other SharePoint technology (BCS) but you can also use the object model to retrieve credentials and get login pages etc. for
free provided by the Secure Store Service framework.
Kind regards,
Margriet Bruggeman
Lois & Clark IT Services
web site: http://www.loisandclark.eu
blog: http://www.sharepointdragons.com -
How can I implement commands in Labwindows?
I have a target with 8051 microprocessor. This microprocessor have a program in MS_DOS.
I want to do an emulation with Labwindows.
I comunicate with pc by RS232.
In the MSDOS program I use the following commands:
sp(back_espace key)= Initialitation board.
vx(direction memory)(enter key)= Readed memory
My question is: How can I implement commands in Labwindows?Hi,
erm, could you re-post this question in the LabWindows/CVI forum?
You might get a few more answers in there
When you talk about emulating, I assume you're refering to getting Windows (which flavour - 9x/NT/me/xp/2k) to do some sort of display depending on button presses from a user interface, or are you wanting to turn the whole PC into an emulator, whereby another PC communicates to it through the serial port, and you want the emulating pc to react as though it was the 8051?
Thanks
S.
// it takes almost no time to rate an answer -
How can i transfer movies from my windows laptop to ipad 3
how can i transfer movies from my windows laptop to ipad 3
Import them into iTunes then sync them to your iPad
-
How can I implement a real time datawarehouse
Hi, I'm a little lost here but I want to know how can I implement a real time datawarehouse in sql server, I don't know if it is only to make the extraction process the shortest time possible.
Thank youHi Mega15,
I agree with everything Seif and Louw said, but I'd like to add that if you are using SQL Server 2012 or 2014 and you want to use DirectQuery or ROLAP mode (depending on what SSAS mode are you using, tabular or multidimensional) you may be interested on
using columnar indexes on your base tables.
Analytical and aggregated queries will take GREAT advantage from these indexes, they will perform much better than with traditional B-Tree indexes in most of your scenarios.
Regards.
Pau. -
How can I implement a Digital I/O counter with a maximum source frequency of 80 MHz (like 6602 board) using CompactRIO? It appears as if the Digital I/O modules for CompactRIO are much slower than this.
Thank you,
--RayHi Ray,
The highest frequency input we offer for C Series modules is 20 MHz if you are doing LVTTL and 10 MHz for 5 V TTL. These modules are the 9402 and 9401, respectively. Unfortunately, there is no 80 MHz input on this form-factor.
Regards,
Chris E.
Applications Engineer
National Instruments
http://www.ni.com/support -
HT1338 How can i use my data on windows or mac when i use one of them in the same time?
Hi,
i have a Mac book with 2 operating system, ( Windows& mac). How can i use my data on windows or mac when i use one of them in the same time?
Thank youThe following article(s) may help you.
Resolving duplicate calendars
Resolving duplicate contacts -
How can I download itunes from my windows vista to my ipod original?
How can I download itunes from my windows vista to my ipod classic?
If you want to add songs from iTunes to the iPod, plug it into the computer, select the iPod in iTunes and click the tabs across top to select what you want on the iPod.
-
How can i install flash player for window 8.1(64 bit) on my laptop
how can i install flash player for window 8.1(64 bit) on my laptop?
For Internet Explorer, you don't. Microsoft has already done it.
For Firefox, Opera or Safari, use the Flash Player Plug-in (All other browsers)
For Chrome, you don't need to wither because Google puts it in the browser. -
I've got an old I-phone. How can I determine what model it is? 3 or 4.
I've got an old I-phone. How can I determine what model it is? 3 or 4.
Append the last three characters of its serial number to http://www.everymac.com/ultimate-mac-lookup/?search_keywords= and load the page.
(104117) -
How can I install and run a Windows program on my MacBook Pro/?
How can I install and run a Windows program on my MacBook Pro?
You have several options.
1, Use a Virtual Machine like Vmware, Parallels etc... to Create a Virtual Windows Installation and Run your program in there. A Virtual MAchine will runn in a Window on your Desktop and share your Mac's resources RAM HD space processor. Your MAc desktop will still be available while you run Windows install.
http://www.parallels.com/
2. Install Windows on a partition using Bootcamp. It will run a full installation of Windows you can boot into, and run your programs. The Mac desktop will not available until your reboot the computer and start in OSx instead of Windows.
https://www.apple.com/support/bootcamp/
3. Use Wine / Winebottler to run the Application without the need for a complete Windows installation.
http://winebottler.kronenberg.org/ -
My 1st ipod was lost. My library is on a Dell with Windows. I registered my new ipod to a Mac. How can I get my library from Windows onto my new Ipod?
Thank you for your help. I am still having trouble. As you can tell, I am not technologically advanced AT ALL. My music is all showing up in the library but when I go to file in the top left corner, Sync is greyed out and I cannot select it. I'm gonna continue to try this. It's been a long time since I had my 1st ipod and things have changed so much I will probably need to research this stuff. Thanks again for your help.
-
How can I get icloud on my windows xp PC.
how can I get icloud on my windows xp PC.
You can't.
http://support.apple.com/kb/DL1455
System Requirements
Microsoft Windows Windows Vista SP2 or Windows 7
Safari 5.1.1 or Internet Explorer 8 or later
Microsoft Outlook 2007 or 2010 recommended
Maybe you are looking for
-
Assigning a login module to a single WebDynpro to authenticate against LDAP
Hi there, we are running the J2EE Engine 7.0 within XI on SAP NetWeaver 2004s / Linux x86_64. Basically, i want to Authenticate a Java WebDynpro against an LDAP (Active Directory). With the XI Usage installed, I can not customize the UME to authentic
-
How to find user who loaded the procs in DB
Hi guys how to find user who loaded procs in database ..and the date... is there anyway.. i tried to look at all_objects..but it didnot workout.. thanks
-
Help required! - K700i and JavaScript
Have just upgraded to a Sony Ericsson K700i and am having trouble access some web pages as it says either my browser does not support JavaScript or the JavaScript has been de-activated. As i don't know how to de-activate the JavaScript i'm sure that'
-
is there a problem in 10.5 with burning optical disks from Disk Utility? I just wasted 4 disks and this never happened before. The burned disks are unmountable, they just keep trying to be read.
-
Itunes file modified date/time
Ok, so I know for sure this is related to me travelling to Florida and back, and changing the timezone on my system (Windows 7). So I started with all of the music in my itunes at MST, went to and changed to EST, then came back MST. This is when th