How to set default file extension in the FileChooser?

We are trying to use the FileChooser but for some reason, it doesn't have any file extensions in the drop down menu (like in windows). Does anyone know how to put this in?
Also, how do we set the file name for the saving file, rather than typing the name in ourself?
Also, how do we position the file chooser dialog in the middle of the screen? Right now, it's in the top left corner of the screen.
Here's our piece of code, used for saving file.
FileChooser fileChooser = new FileChooser();
        File file = fileChooser.showSaveDialog(stage);
        /*User might clicked on the cancel button*/
        if (file != null) {
            try {
                Writer output = new BufferedWriter(new FileWriter(file));
                output.write(text);
                output.close();
            } catch (IOException ex) {
                logger.error("save file error", ex);
        }Any help would be appreciated! Thanks!

867511 wrote:
We are trying to use the FileChooser but for some reason, it doesn't have any file extensions in the drop down menu (like in windows). Does anyone know how to put this in?Have you read the API? What's the nested class of FileChooser that's listed immediately after it in the classes list?
Also, how do we set the file name for the saving file, rather than typing the name in ourself?I don't see any API for that. You could file a RFE on kenai.
Also, how do we position the file chooser dialog in the middle of the screen? Right now, it's in the top left corner of the screen.I don't see any API for that either.
db

Similar Messages

  • How to set default file path while downloading alv output

    Hi,
    Can anyone tell me that how to set default file path while downloading the ALV output to system using Local file button on tool bar.
    Please look below screenshots:
    Kindly help me resolve it.
    Thanks in advance.
    Regards,
    Ashutosh Katara

    This information initial value is (maybe) stored in Windows Register (register.exe) at Software\SAP\SAPGUI Front\SAP Frontend Server\Filetransfer -> PathDownload, you can read it thru class CL_GUI_FRONTEND_SERVICES method GET_UPLOAD_DOWNLOAD_PATH and update it thru method REGISTRY_SET_VALUE. (Else there may be some parameter ID to force data, but I'm no longer sure)
    Regards,
    Raymond

  • How to set default file path for save

    Hello all,
    I'm currently blocked on the below issue and is hoping to gain your help and insights.
    We have recently upgraded to InDesign CS6. Now when an INDD file created in an older version of INDD is opened in CS6, all the save dialogs would not default to the location of the original INDD file. Though if the same file is opened in the version of InDesign that created it, the save dialog goes to the proper location by default.
    Debugged using our custom plugin as a gate way, and found out that after InDesign CS6 performed the document upgrade/convert, the database for the converted document loses file information. i.e.  IDataBase::GetSysFile() returns nil. I think we can figure out some way to get the original file path. For example, we can intercept "kAfterOpenDocSignalResponderService", and get the original file path of the opened file from IDocumentSignalData. Though I haven't yet able to figure out a safe way to set this file path to the document, so that the save dialogs would by default point at this path.
    Utils<Facade::IWorkgroupFacade>()->InitDocumentAssetManagement(docRef, filePath) seems to do the right thing, but it seems to be quite intruding, and I'm afraid that it is overkilling and will cause bad side effect for the use case I'm looking for.
    So I'm wondering if anyone has any suggestions to achieve this without implementing/overriding the file save dialog.
    Thanks.
    -Jeff

    You should be able to avoid writing your own open-doc trap by using kDocBoss's IOpenedFileInfo to obtain the original file's path. It seems fairly reliable; the only time I've seen it come up empty is for an opened QuarkXPress document.
    I'm afraid I don't know of a sanctioned way to change IDataBase::GetSysFile() without going through the database's SaveAs machinery. Overriding this behavior might only be possible by replacing the regular Save dialog with your own.
    But if InitDocumentAssetManagement() is helping, maybe the workgroup/asset management approach is worth pursuing. Have you tried spying on that call in the debug app? You might be able to isolate and use one of the commands that it's invoking (IAMSPManager::BindAsset() / kSetAssetAttributesCmdBoss?) without all of the side-effects of the higher-level call.

  • How to set default file type for Open dialog

    Dear my friends,
    I am using "At selection-screen ON VALUE-REQUEST FOR filepath" to display open dialog and i want to set default file type for open dialog = *.txt.
    Thank your times !

    Hello,
    U can make use of this code:
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SP_FILE.
      PERFORM SAVE_DIALOG CHANGING SP_FILE G_F_RC.
    FORM SAVE_DIALOG CHANGING PO_FILE PO_RC.
      DATA: L_VA_BOXTITLE     TYPE STRING,
            L_VA_DEFAULTFILE  TYPE STRING,
            L_VA_DEFAULTNAME  TYPE STRING,
            L_VA_DEFAULTPATH  TYPE STRING,
            L_VA_DEFAULTFULL  TYPE STRING,
            L_VA_FILTERTEXT   TYPE STRING,
            L_VA_CODE         TYPE I.
      CLEAR: PO_RC, G_F_CONF.
      L_VA_BOXTITLE   = TEXT-B01.
      L_VA_FILTERTEXT = TEXT-B02.
      IF PO_FILE IS INITIAL.
        CLEAR L_VA_DEFAULTFILE.
      ELSE.
        L_VA_DEFAULTFILE = PO_FILE.
      ENDIF.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
        EXPORTING
          WINDOW_TITLE            = L_VA_BOXTITLE
          DEFAULT_EXTENSION       = 'TXT'
          DEFAULT_FILE_NAME       = L_VA_DEFAULTFILE
          FILE_FILTER             = L_VA_FILTERTEXT
          INITIAL_DIRECTORY       = 'C:SAPWorkdir'
        CHANGING
          FILENAME                = L_VA_DEFAULTNAME
          PATH                    = L_VA_DEFAULTPATH
          FULLPATH                = L_VA_DEFAULTFULL
          USER_ACTION             = L_VA_CODE
        EXCEPTIONS
          CNTL_ERROR              = 1
          ERROR_NO_GUI            = 2
          OTHERS                  = 3.
      IF SY-SUBRC <> 0.
        PERFORM CHECK_ERRORTYPE(Z48M_MATDATA_UP) CHANGING SY-MSGTY.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        CLEAR PO_FILE.
        EXIT.
      ENDIF.
      IF L_VA_CODE NE 0.
        MESSAGE S818(3F) WITH TEXT-011.
        CLEAR: PO_FILE, PO_RC.
        EXIT.
      ELSE.
        WRITE L_VA_DEFAULTFULL TO PO_FILE.
        G_F_CONF = G_C_XFELD.
      ENDIF.
    ENDFORM.                    " save_dialog
    If useful reward.
    Vasanth

  • How to set default file browser and web browser

    I am using openbox as the window manager and don't have a desktop environment.
    My file browser is pcmam file manager and my web browser is chromium.
    I add
    export BROWSER=/usr/bin/pcmanfm
    in .bashrc so that the system uses pcman file manager to open a local file from an external application. But it will also uses pcman file manager to open a url. I want the url opened in chromium, but chromium doesn't let me set the default web browser (as the picture shows blow).:(
    What shall deal with it?
    Thank you.

    ashesxera: Thanks for the pointers!
    After some hours of persistent puzzling I finally figured out how to make Thunderbird/Lanikai open URIs in Chromium instead of Firefox in the XFCE desktop environment.
    In fact I found two solutions that both work.
    1) The straightforward solution: make some changes to Thunderbird/Lanikai's prefs.js
    Add two string variables:
    string: network.protocol-handler.app.ftp; value: exo-open
    string: network.protocol-handler.app.http; value: exo-open
    string: network.protocol-handler.app.https; value: exo-open
    and importantly: change the values of the Boolean variables network.protocol-handler.warn-external.ftp network.protocol-handler.warn-external.http and network.protocol-handler.warn-external.https to 'true'.
    It turns out that for some unclear reason the standard Arch Linux Thunderbird/Lanikai package uses gnome-open to open URLs. The persistent popping up of Firefox was caused by some settings in .gconf that come with the gconfd package. I didn't find these values in gconf-editor.
    2) Change xml files in .gconf
    As I don't want to use Firefox as standard browser any longer, I wanted to get rid of these hidden settings in .gconfd so that "gnome-open [URI]" opens a webpage in Chromium.
    I succeeded in getting there by replacing firefox with chromium in the following files:
    .gconf/desktop/gnome/applications/browser/%gconf.xml
    .gconf/desktop/gnome/url-handlers/chrome/%gconf.xml
    .gconf/desktop/gnome/url-handlers/ftp/%gconf.xml
    .gconf/desktop/gnome/url-handlers/http/%gconf.xml
    .gconf/desktop/gnome/url-handlers/https/%gconf.xml
    .gconf/desktop/gnome/url-handlers//%gconf.xml

  • How to set default file location in Illustrator?

    I'm using Creative Suite CS5 in Windows Pro 64, and would like to set a default location for files in Illustrator and Photoshop when I execute the File > Open or File > Save commands.
    Yes, the program defaults to the location of the last file opened, but sometimes that file is gone, or I'm creating a new one from scratch, and the program looks for files in a distant place in my file structure.
    ** Is it possible to set a default file location for opening and saving in Illustrator CS5 (and in Photoshop CS5)?
    Thanks.

    Not that I know of. It simply reverts to the global "My Documents"/ "Documents" folder as provided by your operating system. these can of course be changed using variables and editing the Windows Registry/ Group Policies, but that affects all programs...
    Mylenium

  • How to set default file permissions for applicatio...

    I have the nokia n86 and was wondering if there was any way of setting the file permissions of a program via the phone. To put it in context, i downloaded a program that edits photos but everytime i try to load a picture from my phone it asks me (for every single folder in my phone, not just the photo ones) if the program can open it. I can be there clicking yes all day as i there is a lot of folders and subfolders on the phone. I know sony ericssons had an option where you could select the programs permissions to always ask or never ask but i cant seem to find a similar option on the nokia.
    Does anyone have any ideas?

    Same issue here. Everything I put on the drive is set to Read-only for the group.

  • How to set default variable value in the workbook

    Dear experts,
    I used several queries in a workbook and one of these queries contained a variable, so when every time the workbook is opened there is a window popping up to ask user to input the value for the variable.
    Now I wanna set an default value for this variable so that the variable input window will not pop up when the workbook is opened.
    I searched the forum and found most solutions is to use the SAPBEXqueries to set value for the variable.
    But in my BEx analyzer I can not find this sheet named SAPBEXqueries. and I also found some difference  between my analyzer and the ones descripted in the forum.
    My BEx analyzer version is 6.40. I think it's a new version.
    Do you know how to solve my problem with this version BEx analyzer?
    Thanks in advance!
    Best regards
    Fanchest

    Hi Leo,
    Yes I tried the personalization but it seems doesn't work, I don't know why.
    I set the personalization in the BEx analyzer according to the help documentation step by step but the variable selection screen still pop up when the workbook is opened.
    If I executed  the query which contained in the workbook seperately there is no variable selection screen pop up.
    And because I don't wanna change the variable, so I didn't uncheck the ready to input.
    Thanks for your infomation!

  • How to set multiple file extension in ForEach Loop Component.

    I want to enumerate all *.xls and *.xlsx file. How to fill the Files box? 

    This is correct, even after you have enumerated over the marked (xls and xlsx files) how do you intend to process these files. What are the subsequent tasks in the for each loop?
    Please vote as helpful or mark as answer, if it helps
    Cheers, Raunak | t: @raunakjhawar |
    My Blog
    can the excel data provider process both xlsx and xls file?
    is there any way to process  both xlsx and xls file in dataflow?

  • How to set default file type for screen capture?

    I want to change the default from .jpg2 to .jpg when doing a screen selection
    capture (cmd-shft-4). Where is the place to do this?
    Thank you,
    todd

    Todd,
    OnyX has 10 screen shot options available in Parameters>General>Screen Capture format:
    ;~)

  • How to set default .PDF file extension for Form Downloads

    I am trying to find a way of setting the PDF file extension when I download forms.
    I author the forms under a Plus subscription and am then downloading the forms under a basic subscription Collaborator account (diffrent person)
    If I don't include .pdf as the file type when downloading a form with a unique name as the Collaborator, it downloads without a file extension.
    Remembering to continually add the pdf file extension is a pain so I'm hoping there is away of setting this as a defaulet for my 'collaborator' account ?

    Firstly, apologies for multiple posts, I received messages saying my comment hadn't posted and also checked my history before re-submitting.
    Okay, the process is
    1. Log in as the Author account and I can rename the file without having to set the extension
    2. Log in as the Collaboartor account - same PC, browser etc and it doesn't save with a default file extension; HOWEVER, I have done this whilst also being logged in on a diffrent browser as the Author
    3 I have just tried logging out as Author and only being in as the collaborator and the form downloaded with a default PDF.
    4. I had someone else log in as the collaborator from thei PC and browser whilst I was still signed inunder my author account and again they were unable to save as PDF by default
    This has me wondering if there is anything at play when you've got multiple Users?

  • Plsss help me: how to set default values in html:file and html:radio

    Hai,
    To set default value to text box i use the following code. It works well.
    <html:text property="modifyserverdesc" value="<%= serverDesc%>" styleClass="text" size="38"/>But for file i use the code
    <html:file styleClass="file" property="modifyserverimgfile" value="<%= serverImage%>" size="40"/>It doesn't display value. What is problem here?
    how to set default selection in <html:radio>.

    No it won't help.
    You can't set a value into an <input type="file"> control at all. The user has to put values in themselves.
    The reason behind this is security. If the programmer could put any value they liked in there, you could upload any file at all from a users computer without their intervention. eg C:\windows\system32\passwords.txt
    Bottom line: you can't put a default value into the input type="file" control.
    And a good thing too ;-)

  • How to set default values on the screen painter parameters?

    Hello ABAP Gurus,
    I would just want to ask how to set default values on the screen painter parameters.
    Thank you for your replies.

    Hi,
    To set default values for screen painter parameters initialize the field names with default values in the PBO module....
    say u have the field name as f_field1....
    in the PBO of that screen initialize it....
    f_field1 = '100'  "here 100 is the default value.
    <b>reward points if useful.</b>
    regards,
    Vinod Samuel.

  • How to set default view for preview?

    Every time I open a PDF using Preview I have to set the view to 'thumbnails', then 'two pages up', then adjust the zoom. Complete waste of time.
    Anyone know how to set defaults so that it opens in a predictable way?
    thanks,

    I customized my Toolbar to look like the following. Click the middle button that has the 1 circled. That tells Preview to remember to display pages at actual size (100%). Every file that I open now displays at 100%.

  • How to set default selection in html:radio

    hai
    how to set default selection in <html:radio>.

    No it won't help.
    You can't set a value into an <input type="file"> control at all. The user has to put values in themselves.
    The reason behind this is security. If the programmer could put any value they liked in there, you could upload any file at all from a users computer without their intervention. eg C:\windows\system32\passwords.txt
    Bottom line: you can't put a default value into the input type="file" control.
    And a good thing too ;-)

Maybe you are looking for

  • Report on Archieved data for Object MM_SPSTOCK

    Hi All. We require a report on Archieved data for the Object 'MM_SPSTOCK'.which has the tables mcha,mchb,mbew. I require the data for the table MCHB. I have Archieve Key (Index) & Offset Value. we are using Ecc 4.7 version. Please help me to solve th

  • Java 5.0 XML Parsing Error

    I've written a XML parser awhile ago, and it works perfectly when running using Java 1.4.2_04. Now when running with Java 5.0 Beta 2, the parser simply crashes. It looks like when using node.getAttributes(), it reads in each attributes in reverse ord

  • Transfer PC to Mac

    just became a Mac convert. how do i move my itunes library from my PC desktop to my MacBook? thanks

  • Error in uploading TIFF imge

    Working on SAP 4.7. Trying to upload TIFF image using program RSTXLDMC. The tiff image is made using Microsoft Photo Editor 3.0.2.3 While uploading its gives Error message that Image is not Baseline 6.0 TIFF format. what could be the reason. Kindly h

  • Is there a way to compress media and project files into something small

    I have a 2TB hard disk where all my FCP files - project files, media files and rendered files are stored. I am not sure I will reopen those projects but still to be onthe safer side I do not want to delete them but keep the compresed so that in case