Dialog Box Problem

i have created dialog box manually using stage and modility. the problem is when the dialog box executes the code following dialog box
gets executed before closing the dialog box. i want to use it like confirmation box in swing. i want to stop further execution of code till yes/no button of dialog box clicked.please suggest... please help me....

Ok, so it doesn't look like there is an easy way to do modality in JFX. I had thought since Swing does and JFX uses the same threading model that it should be do-able, but from what I can tell, Swing does some serious magic under the covers to make modal dialogs work.
Your best bet probably is to use callbacks instead. Make your own dialog window and instead of doing something like this:
int choice = MyDialog.show("Are you sure you want to do that?");
if (choice == MyDialog.OK)
    doTheAction();
} Do something more like:
MyDialog dialog = new MyDialog("Are you sure you want to do that?");
dialog.setOnOk(new EventHandler<ActionEvent>()
    public void handle(ActionEvent actionEvent)
        doTheAction();
});In fairness, that is probably a bit more 'correct' anyway and inline with the JFX style of doing things (although it is more code).
Here's some very, very rough code for doing something like what you want. You could obviously customise the class to take an enum of the button options available etc. It could all be improved a lot.
public class TestApp extends Application
    public static void main(String[] args) throws Exception
        launch(args);
    public void start(final Stage stage) throws Exception
        StackPane rootPane = new StackPane();
        FlowPane contentPane = new FlowPane();
        BorderPane dialogContent = new BorderPane();
        dialogContent.setStyle("-fx-background-color: white");
        dialogContent.setCenter(new Label("This is a dialog"));
        final Dialog dialog = new Dialog(dialogContent);
        dialog.setOnOk(new EventHandler<ActionEvent>()
            public void handle(ActionEvent actionEvent)
                System.out.println("Ok selected");
        dialog.setOnCancel(new EventHandler<ActionEvent>()
            public void handle(ActionEvent actionEvent)
                System.out.println("Cancel selected");
        Button showDialogButton = new Button("Show Dialog");
        showDialogButton.setOnAction(new EventHandler<ActionEvent>()
            public void handle(ActionEvent actionEvent)
                dialog.show(stage);
        contentPane.getChildren().add(showDialogButton);
        rootPane.getChildren().add(contentPane);
        BorderPane glassPane = new BorderPane();
        glassPane.setStyle("-fx-background-color: rgba(200, 200, 200, 0.5)");
        glassPane.visibleProperty().bind(dialog.showingProperty());
        rootPane.getChildren().add(glassPane);
        Scene scene = new Scene(rootPane, 300, 300);
        stage.setScene(scene);
        stage.show();
    private class Dialog extends Popup
        private BorderPane root;
        private EventHandler<ActionEvent> onOk;
        private EventHandler<ActionEvent> onCancel;
        private Button cancelButton;
        private Dialog(Node content)
            root = new BorderPane();
            root.setPrefWidth(200);
            root.setPrefHeight(200);
            root.setStyle("-fx-background-color: white; -fx-border-width: 1; -fx-border-color: gray");
            root.setTop(buildTitleBar());
            root.setCenter(content);
            root.setBottom(buildButtonBar());
            getContent().add(root);
        public void setOnOk(EventHandler<ActionEvent> onOk)
            this.onOk = onOk;
        public void setOnCancel(EventHandler<ActionEvent> onCancel)
            this.onCancel = onCancel;
        public void setContent(Node content)
            root.setCenter(content);
        private Node buildTitleBar()
            BorderPane pane = new BorderPane();
            pane.setStyle("-fx-background-color: #0000aa; -fx-text-fill: white; -fx-padding: 5");
            pane.setOnMouseDragged(new EventHandler<MouseEvent>()
                public void handle(MouseEvent event)
                    // not sure why getX and getY don't work
                    // double x = getX() + event.getX();
                    // double y = getY() + event.getY();
                    double x = event.getScreenX();
                    double y = event.getScreenY();
                    setX(x);
                    setY(y);
            Label title = new Label("My Dialog");
            pane.setLeft(title);
            Button closeButton = new Button("X");
            closeButton.setOnAction(new EventHandler<ActionEvent>()
                public void handle(ActionEvent actionEvent)
                    hide();
            pane.setRight(closeButton);
            return pane;
        protected Node buildButtonBar()
            FlowPane pane = new FlowPane(6, 6);
            pane.setAlignment(Pos.CENTER);
            Button okButton = new Button("OK");
            okButton.setOnAction(new EventHandler<ActionEvent>()
                public void handle(ActionEvent actionEvent)
                    hide();
                    if (onOk != null)
                        onOk.handle(actionEvent);
            pane.getChildren().add(okButton);
            Button cancelButton = new Button("Cancel");
            cancelButton.setOnAction(new EventHandler<ActionEvent>()
                public void handle(ActionEvent actionEvent)
                    hide();
                    if (onCancel != null)
                        onCancel.handle(actionEvent);
            pane.getChildren().add(cancelButton);
            return pane;
}

Similar Messages

  • "Dialog box "PROBLEM WITH SHORTCUT"

    When my T40 p starts up I keep getting the following message, over and over again until I close the system tray IBM Connect bar. 
    "Dialog box “PROBLEM WITH SHORTCUT”
    The drive or network connection that the shortcut IBM Access Support.lnk refers to is unavailable.  Make sure that the disc is properly inserted to the network resource is available, and then try again. "
    Help!

    You'll need to find your iTunes folder. It's usually located on your main hard disk under My Documents/My Music/iTunes. Copy this whole folder to another hard drive (if possible) or burn it on a CD (probably will take more than one--depending upon how large your library is) or DVD. Once you have a good backup of your library, try downloading and reinstalling iTunes.

  • Dialog Box  Problem in BDC Program...

    Hi friends,
    I am facing a problem while  creating service entry sheet no  throgh bdc ( Tcode ML81N) . I use 'no disply' mode in call transaction method.
    whenever i regarding in our development client there is no dialog box with the following screen.  But in QAS server it displays the same. I have already include the following code in my bdc program. But the dialog box  been displayed finally. Our user doesn't require this interaction. Kindly give solutions.
    perform bdc_dynpro      using 'SAPLMLSR' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'IMKPF-BLDAT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=OK'.
    perform bdc_transaction using 'ML81N'.
    Thanks & Regards,
    SP.Manavalan.

    Hi,
    Thanks for reply.
    I have checked log using SM37, it is not showing any error.
    Log details are as follows...
    Date       Time     Message text                                                                             Message class Message no. Messag
    08.05.2010 11:47:10 Job started                                                                                00           516          S
    08.05.2010 11:47:10 Step 001 started (program ZSDB_J1I5_REG_UPDATE_BDC, variant 1101_1_RMA, user ID STK)      00           550          S
    08.05.2010 11:47:20 Job finished                                                                                00           517          S

  • Wizard Dialog  Box Problems - Screen Redraws

    I've encountered a frequently occurring problem with JDev dialog boxes. After launching and entering into a wizard, the
    dialog boxes do not draw correctly on my screen. For example, if I try using the Create Table Wizard, the input boxes for the table name,datatype, etc.. become a jumbled mess on the screen. I've tried re-sizing the dialog box and this has worked to some degree, but sadly in most cases it doesn't help. I don't think (although it's possible) that it's a bug on my computer.
    Any ideas? Workarounds? Solutions?

    Personally I would recommend against using JDK 1.4, either to run JDeveloper itself with, or to simply run your projects with.
    I've experienced some problems with that version, while the default 1.3.x works just fine. Problems range from minor GUI glitches to complete deadlocks in JClient applications.

  • Having a dialog box problem in InDesign CC

    The dialog boxes on my just downloaded version of InDesign CC look like Windows dialog boxes, not Mac ones (although Save and Save As do appear as normal OSX design). Obviously I am on a Mac and don't want a partial Mac version of InDesign. My previous versions, including most recently CS6, have not had this problem. Suggestions?

    Hi there. I don't have anything to help you but I am curious about something you have done that I was told was not possible. I am VERY new to this forum and I wanted to upload an image to one of my posts. However, I couldn't see a way of doing it.
    Thankfully, someone pointed out to me that I had to use Workspaces and gave me a link to the instructions. So in my post, there is only a link, and the reader has to click on it, wait for Workspaces to load etc. I found this very annoying and weird given than most forums allow users to upload simple files.
    I came across your post and you have managed to include the actual images in your post! This is great. It is instant feedback for those who are trying to help you.
    So please, can you tell me how you achieved this without having to go through Workspaces?
    I would love to know.
    Thanks in advance.

  • Blank dialog boxes problem

    When trying to modify properties, that use a pop-up dialog box, by right-clicking on a component or by using the properties panel the information in these dialog boxes are not visible.
    I'm working with Update6 (but without installing this upgrade I have the same problem).

    I mentioned I have this problem when trying to use a datasource pointing to Informix.
    I created a database server type for Informix followed by a Data Source using this entry.
    What I see is that when doing a View Data, the system gives me the records of the table.
    But nothing works when using this daa source in my page.
    Guy

  • File download dialog box problem!

    Hi,
    How do you force file download message box to use specified file name instead of JSP or servlet name.
    I am using:
    // code in attachment.jsp
    <%
    response.setContentType(mimeType.trim());
    response.setHeader("Content-Disposition","attachment;filename=\""+attachmentViewBean.getAttachmentName()+ "\"");
    %>
    With the above code, browser first pop up file download dialog box informing
    'You are downloading the file:[attachment.jsp] from host. Would u like to open the file or save?'
    I want the file name that I had specified in setHeader("Content-disposition","attachment;filename=resume.doc") to appear(i.e. resume.doc) in above dialog box and not the servlet name.
    Any suggestions/tips on this?
    Your help would be greatly appreciated.
    Thanks,
    Yogesh

    For saving the document I have used -
    res.setHeader("Content-disposition", "attachment; filename="+ FileName );
    and it is working very fine, it saves the document with name specified in FileName
    For opening the file in browser without any prompt-
    res.setHeader("Content-disposition", "inline" );
    For setting the content type -
    try {
         if(FileType.equalsIgnoreCase("pdf")) contentType = "application/pdf";
         if(FileType.equalsIgnoreCase("doc")) contentType = "application/msword";
         if(FileType.equalsIgnoreCase("rtf")) contentType = "application/msword";
         if(FileType.equalsIgnoreCase("gif")) contentType = "image/gif";
         if(FileType.equalsIgnoreCase("jpg")) contentType = "image/jpeg";
         if(FileType.equalsIgnoreCase("html")) contentType = "text/html";
         if(FileType.equalsIgnoreCase("htm")) contentType = "text/html";
         if(contentType == null){
         contentType="text/plain";
         res.setContentType(contentType);
    } catch (Exception e){
              out.println("Exception while setting content type");
              out.println("Exception : " + e);
              return;
    Hope this helps

  • [JS][CS3] Simple dialog box problem

    Hi
    I am wanting to make my script do 1 of 2 things depending on the result of a dialog box.  I cannot seem to register the users response.  Here is the code:
    var myDialog = new Window('dialog', 'Confirm Changes');
    myDialog.frameLocation = [600,400];
    myDialog.size = [590, 250];
    myImage = myDialog.add('image',[480,41,572,127],'/Macintosh HD/Applications/Adobe InDesign CS3/Scripts/Scripts Panel/Images/xxxx.png');
    myPanel= myDialog.add('panel', [10,10,580,240], 'Select the action you wish to use');
    //Adding Buttons
    myUseExistingTextButton = myPanel.add('button', [48,190,75,25], 'Use Existing Text',{name:'select'});
    myUseNewButton = myPanel.add('button', [260,190,75,25], 'Use New text as shown',{name:'select'});
    myCancelButton = myPanel.add('button', [480,190,75,25], 'Cancel',{name:'select'});
    myExistingTextWindow = myDialog.add('edittext',[20,40,230,200],'Existing Text');
    myNewTextWindow = myDialog.add("edittext",[250,40,460,200],"New Text");
    myResult = myDialog.show();
    if(myResult == true)
         if (myResult == 0)
                        alert("Old was selected");
         if (myResult == 1)
                        alert("New was selected");
    which gives the following result:
    All I want to do is use the selected button do do the next part of my script depending on the text selected.
    I will keep on looking, and di-secting other scripts, but any help here would be nice.
    Thanks as always
    Roy

    Here is code created with RapidScriptUI in about 2 minutes. It includes multiline editbox, dimensions without using co-ordinates  that display accurately cross platform and simple to edit code for beginners like you to learn and understand (This is a free advertisement).
    var rapidDlg = new Window('dialog',"Confirm Changes",undefined);
    buildWindow();
    rapidDlg.show();
    function buildWindow(){
    // Properties for rapidDlg.Panel1
         rapidDlg.Panel1 = rapidDlg.add('panel',undefined,"Select the action you wish to choose");
         rapidDlg.Panel1.margins= [20,20,20,20];
         rapidDlg.Panel1.orientation = "row";
    // Properties for rapidDlg.Panel1.Group1
         rapidDlg.Panel1.Group1 = rapidDlg.Panel1.add('group',undefined);
         rapidDlg.Panel1.Group1.orientation = "column";
    // Properties for rapidDlg.Panel1.Group1.EditText1
         rapidDlg.Panel1.Group1.EditText1 = rapidDlg.Panel1.Group1.add('edittext',undefined,"Existing Text", {multiline:true});
         rapidDlg.Panel1.Group1.EditText1.preferredSize.width = 200;
         rapidDlg.Panel1.Group1.EditText1.preferredSize.height = 100;
    // Properties for rapidDlg.Panel1.Group1.ExistingText
         rapidDlg.Panel1.Group1.ExistingText = rapidDlg.Panel1.Group1.add('button',undefined,"Use Existing Text");
    rapidDlg.Panel1.Group1.ExistingText.onClick = ExistingText_Clicked;
    // Properties for rapidDlg.Panel1.Panel2
         rapidDlg.Panel1.Panel2 = rapidDlg.Panel1.add('panel',undefined,undefined);
         rapidDlg.Panel1.Panel2.alignment = [' ','fill'];
    // Properties for rapidDlg.Panel1.Group2
         rapidDlg.Panel1.Group2 = rapidDlg.Panel1.add('group',undefined);
         rapidDlg.Panel1.Group2.orientation = "column";
    // Properties for rapidDlg.Panel1.Group2.EditText2
         rapidDlg.Panel1.Group2.EditText2 = rapidDlg.Panel1.Group2.add('edittext',undefined,"New Text", {multiline:true});
         rapidDlg.Panel1.Group2.EditText2.preferredSize.width = 200;
         rapidDlg.Panel1.Group2.EditText2.preferredSize.height = 100;
    // Properties for rapidDlg.Panel1.Group2.NewText
         rapidDlg.Panel1.Group2.NewText = rapidDlg.Panel1.Group2.add('button',undefined,"Use New text as shown");
    rapidDlg.Panel1.Group2.NewText.onClick = NewText_Clicked;
    // Properties for rapidDlg.Button3
         rapidDlg.Button3 = rapidDlg.add('button',undefined,"Cancel", {name:"cancel"});
         rapidDlg.Button3.alignment = ['right',' '];
    function ExistingText_Clicked(){
         alert(this.text +  ' was clicked!');
    function NewText_Clicked(){
         alert(this.text +  ' was clicked!');
    Steven
    http://scriptui.com

  • Dialog box problem in a while loop

    Hi!
    I would like to open a dialog box with one button. Therefore I am using the
    VI located in "time&dialog". I have a while-loop for the rest of my
    application. When I place this VI in this while loop, the dialog box opens
    always and not once. What do I have to do, to open it only once? Thank you
    for your help,
    Oliver.

    Hi Oliver,
    following Dennis answers and your reply, I attach a simple vi that shows a dialog when a value is out of range, but it is shown only once when the value is updated.
    Good luck,
    Alberto
    Attachments:
    out_of_range.vi ‏28 KB

  • Dialog box problem when controlling front panel remotely

    I have encountered an issue with the Web Publishing Tool- I have a VI that calls a subvi that uses the Promt User for Input function.  When controlling the front panel from another computer I get a message saying that you "Cannot control subVI front panels remotely" and points you to the machine actually running LabView to enter the information in the Prompt User dialog box.  I set the subVI front panel to show when called, which does show the front panel of the subVI, but still get the error related to the dialog box.
    Is there any way to make this work?  Am I missing something obvious?
    Thanks,
    Nathan

    Hi Nathan.
    There are some limitations with dialog boxes in remote applications.  This tutorial has some good examples and explanations on functionality to avoid with web applications.  Additionally, the LabVIEW online Help offers some general guidance for Viewing and Controlling Front Panels Remotely, which may help you in further developing your application.
    Hope that helps!
    Lorielle P.
    Applications Engineer
    National Instruments

  • PSD print dialog box problem.

    I recently upgraded to CS5 Extended and cannot figure out the source of this problem. This is the first time I have tried to print from PSD CS5.
    I have a PSD photo placed in a document sized 130.25mm deep x 110mmwide. I am trying to print on an Epson R2400 Inkjet.
    When I open the Print Dialogue box, the image of the photo at left, is incorrect in scale and cropping because the frame around it, which I understand represents the document size, is 89.96mm x 89.96mm, and is too small for the PSD photo. All the Scaled Print Sizes do is make size changes within the 89.96 x 98.96 frame. There are no controls for document size in the Print Settings. It appears to be automatic.
    I would have expected the frame to match the size of 130.25mm x 110mm that I created for the document.
    I can tick bounding box and adjust image size and cropping but I cannot adjust the 89.96mm x 89.96mm frame to allow for a larger, 130.25mm print.
    I created a new file of a different size, placed a different photo and tried to print it. Same problem exactly. The printer works fine but images must be sized to fit within the 89.96mm x 89.96mm area. Obviously there is something wrong.
    Can anyone tell me wether the frame size is a function of PSD or is it the the Epson driver which dictates the size. Surely the Epson printer driver will obtain its information from my PSD document settings.
    Can anyone tell me what the frame represents (document or paper size), and what dictates its size setting please.?

    The paper size is selected within the "Print Settings" dialog. That's what the frame (and the numbers above the preview) represent.
    The image size and position control the size of the image on the selected paper size.

  • Firefox and AVG dialog box problems

    I have a weird problem that has just started today. My AVG antiviris program keeps opening dialogue boxes to download what it claims is a cpm.htm file, described as a Firefox HTML file, and coming from cpm.avg.com. The box asks if I want to download the file. I can't shut the wretched things out; if I close one, another one opens up, it's like dealing with the Medusa's head.
    There doesnt seem to be any support by email for AVG, just a USA phone number (I'm in the UK). Has anyone come across this problem? I'm assuming it's a virus but none of my "tools" have detected anything (SpyBot, Winzip Malware).

    '''http://helpx.adobe.com/flash-player/kb/installation-problems-flash-player-windows.html'''
    '''http://helpx.adobe.com/flash-player/kb/installation-problems-flash-player-mac.html'''
    Adobe Support '''https://forums.adobe.com/community/flashplayer'''

  • Problem with File Open Dialog box

    Gurus,
    I am using Forms 10g with Windows environment .. My requirement is, to display File Open Dialog Box, and whatever file I am selecting it has to open .. I am able to get Dialog box, problem is, when I select a file (for example, test.txt), I cant see the file getting opened .. Can anyone suggest me how to get the desired result ...
    Pasting my code below
    declare
         a varchar2(100);
    begin
         a := WEBUTIL_FILE.FILE_SELECTION_DIALOG('c:\temp','','*.*','c:\temp',OPEN_FILE, TRUE);
    end;
    Regards

    You can see the code in the webutil.pll library.
    FUNCTION CLIENT_GET_FILE_NAME (directory_name Varchar2 := NULL,
                                   file_name      Varchar2 := NULL,
                                   file_filter    Varchar2 := NULL,
                                   message        Varchar2 := NULL,
                                   dialog_type    Number   := OPEN_FILE,
                                   select_file    Boolean  := TRUE) return Varchar2 is                             
    * CLIENT_GET_FILE_NAME
    *   Client (Browser) side implementation of the standard GET_FILE_NAME Built-in
    *   Used to display File Open, Save  and directory listing dialogs
    *   Implemented using calls to WEBUTIL_FILE
    * Version 1.0.0
    * Change History
    *   1.0.0 DRMILLS 23/DEC/2002 - Creation
    \*********************************************************************************/ Here is one example:
    the_file := client_get_file_name('c:/', null, 'All Files (*.*)|*.*|',null,open_file,true);Francois

  • Why are dialog boxes acting up in Indesign CC 64-bit?

    Hi. I have Windows 7. When I use the regular Indesign, it works fine, but if I try sing the 64-bit version, I cannot use my mouse on the dialog boxes - they don't respond. The only way to navigate around them is with the Tab and arrow keys.
    Any ideas?

    I'm confused. My original Q was:
    If having my Windows text set at 150% messes up ID, bec, I can't work its dialog boxes correctly with my mouse (only, to some extent, with my keyboard), then I have to reset my WIndows text setting to 125%.
    But my vision is poor, so I find 1125% a bit small.
    (BTW IDCC 2014 32-Bit Edition does not have the dialog box problem. But even when Windows text is 150%, ID 32-bit's text is tiny)
    Do you have any suggestions?

  • Advanced Dialog Box

    Advanced  Dialog Box
    Can anyone help ?  Does Adobe have a fix for the Advanced Dialog Box problem ?
    This problem is ridiculous.
    dotsun7

    It IS more than ridiculous but HUGELY frustrating.
    Barbara's suggestion will work for some but not for a lot of PSE 9 users and you may be one too?
    Go to this link to a discussion on this issue that started back in SEPTEMBER 2010 to see what your problem may be and also to see what the current situation is regarding a fix from Adobe for what is a lot of PSE 9 users.
    http://forums.adobe.com/thread/727892?tstart=0

Maybe you are looking for