0 Replies Latest reply: Nov 27, 2009 1:52 AM by 843807 RSS

    File Dialog Control Issue - SWT

    843807
      I have created a file dialog using eclispe's SWT. Here is the code:
      PrintWriter out = response.getWriter();
      Display display = new Display();
      Shell shell = new Shell(display, SWT.ON_TOP);
      String selectedFile = browseFile();
      MessageJSON fileNameJSON = new MessageJSON();
      fileNameJSON.setMessage(selectedFile);
      out.write(fileNameJSON.toJSONString());
      try {
                      FileDialog fileDialog = new FileDialog(shell, SWT.SINGLE);
                      fileDialog.setFilterPath(System.getProperty("user.home")+ "/Desktop");
           fileDialog.setFilterExtensions(new String[] {"*.bin"});
           fileDialog.setFilterNames(new String[] {"Binary Files (*.bin)"});
           fileSelected = fileDialog.open();
           if (fileSelected != null) {
                filePath = fileSelected;
                shell.close();
                display.dispose();
                } else {
                     shell.close();
                     display.dispose();
                }
                } catch (Exception e) {
                     e.printStackTrace();
                }
      Now the issue is with the control. When I click on the "Browse" button from the JSP, the file dialog opens, but the control will be on the browser but not on the file dialog. When the file dialog is open and on click of "Esc", it doesnot close as the control rests on the browser still. Can you please suggest how to get the control on to file dialog? Thanks in advance.