How to set selected file in FileChooser showSaveDialog to default file name

Hi,
How do I set selected file in JavaFX 2.0 FileChooser showSaveDialog, so I can prompt the user with a suggested default file name?
I am converting a Java Swing application I wrote a few years ago to JavaFX 2.0.
In the Swing application, I use setSelectedFile() as follows:
JFileChooser jFileChooser = new JFileChooser();
jFileChooser.setSelectedFile(new File(backupfile));
jFileChooser.setCurrentDirectory(new File(outputDirectory));
FileFilter filter = new FileNameExtensionFilter("Comma Delimited (*.csv)", "csv");
jFileChooser.addChoosableFileFilter(filter);
jFileChooser.setFileFilter(filter);
filter = new FileNameExtensionFilter("XML Document (*.xml)", "xml");
jFileChooser.addChoosableFileFilter(filter);
jFileChooser.setAcceptAllFileFilterUsed(false);
jFileChooser.setDialogTitle("Export File");
int returnVal = jFileChooser.showDialog(jFrame, "Export");
This would show a file chooser with the file name text field pre-populated with a default backup file name.
I can't find an equivalent in JavaFX.
Also, in the Swing application, I was able to determine which extension filter was selected at run time using getFileFilter().getDescription() as follows:
String extension = jFileChooser.getFileFilter().getDescription();
if (extension.equals("XML Document (*.xml)")) { ...
I can't find an equivalent in JavaFX.
Thanks,
Barry

You can use the open sequence file method on the application manager (then you only need to wire the file path)
Rodéric L
Certified LabVIEW Architect

Similar Messages

  • How to set selected radioButton

    Hi,
    There are tons of examples on the websites to show you how to detect selected radioButton or click event. But It is not easy to find aone example to show you how to set selected radioButton.
    Here is my code, but not working, Is it not well handle on it for Flex?
    [Bindable]       
    private var selectedRadioButton:RadioButton;
    private function initSelect(): void {
            selectedRadioButton = rb1;
    <mx:RadioButtonGroup id="rbg" selection="{selectedRadioButton}"
                       change="rbg_change(event);" />
                    <mx:HBox>
                  <mx:RadioButton id="rb1"
                          label="Active" group="{rbg}" />
                  <mx:RadioButton id="rb2"
                          label="Lock" group="{rbg}" />
    </mx:HBox>
    Thanks

    it's simple set its selected property true. For instance
    myRadioButtonSelectedOnStart.selected="true"
    Sincerely,
    Michael
    El 14/05/2009, a las 10:32, "master.card" <[email protected]> escribió:
    >
    Hi,
    >
    There are tons of examples on the websites to show you how to detect 
    selected radioButton or click event. But It is not easy to find aone 
    example to show you how to set selected radioButton.
    >
    Here is my code, but not working, Is it not well handle on it for 
    Flex?
    >
    private var selectedRadioButton:RadioButton;
    private function initSelect(): void {
            selectedRadioButton = rb1;
    <mx:RadioButtonGroup id="rbg" selection=""
                       change="rbg_change(event);" />
                    <mx:HBox>
                  <mx:RadioButton id="rb1"
                          label="Active" group="" />
    >               <mx:RadioButton id="rb2"
    >                       label="Lock" group="" />
    </mx:HBox>
    >
    >
    >
    Thanks
    >

  • Adobe Reader XI...How to set it to Print as Image as default

    Hello I  using Windows 7 64 bits version and using Adobe Reader XI. I need to know how to set reader to Print As Image to default. Is there registry setting in windows or VB script that can do it?  I alread found it in version. I need to find it this in Version XI. Any usefull solution or suggestions would be helpful.
    Thanks

      Are you using the Organizer? If you have imported your photos into the organizer it’s possible to select thumbnails and then on the top menu click Edit à Edit With Photoshop Elements
      Click to view

  • How to set adobe acrobat 9 pro as pdf default program on mac snow leopard OS?

    how to set adobe acrobat 9 pro as pdf default program on mac snow leopard OS?

    I say to highlight more than one if you can because if the PDF you highlight was made by using Acrobat, it will change all PDF's made by Acrobat but if you have one made by some other product, it may not change them to open with Acrobat.
    So in other words, at some point you may have to do it to a PDF made by some other product.

  • How to set selection screen

    I have a question that ...
    i have 2 options --
    when select 1st option , show group1 screen
    when select 2nd option, show group2 screen
    like the follow ..which is pretty work!....but i have another question that how to set the screen field ..
    my question is that if i select group1 screen...i want to set
    if S1_EBELN = '' and S1_IHREZ = ''.
        message e398 with 'pls input one of these two options!'.
      elseif S1_EBELN ne '' and S1_IHREZ ne ''.
        message e398 with 'Only one of these two options input is allowed&#65281;'.
      endif.
    i've tried to insert these statement within the LOOP...but not work ......
    so can anyone know how to set?
    PARAMETERS:
    R1 RADIOBUTTON GROUP OPT1 USER-COMMAND R DEFAULT 'X'.
    PARAMETERS:
    R2 RADIOBUTTON GROUP OPT1.
    SELECTION-SCREEN BEGIN OF BLOCK RPT1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS: S1_BUKRS FOR EKKO-BUKRS MODIF ID ABC. 
    SELECT-OPTIONS: S1_EBELN FOR EKKO-EBELN MODIF ID ABC . 
    SELECT-OPTIONS: S1_IHREZ FOR EKKO-IHREZ MODIF ID ABC .  
    SELECTION-SCREEN END OF BLOCK RPT1.
    SELECTION-SCREEN BEGIN OF BLOCK RPT2 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS:  S2_BUKRS FOR EKKO-BUKRS MODIF ID DEF.
    SELECT-OPTIONS: S2_MBLNR FOR MKPF-MBLNR MODIF ID DEF.   
    SELECT-OPTIONS: S2_XBLNR FOR MKPF-XBLNR MODIF ID DEF .   
    SELECTION-SCREEN END OF BLOCK RPT2.
    IF R1 = 'X'.
        LOOP AT SCREEN.
          IF screen-group1 = 'DEF'.
            screen-input = '1'.
            SCREEN-required = '1'.
            SCREEN-INVISIBLE = '1'.
            screen-input = '0'.
            screen-output = '1'.
            screen-active = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
    ELSEIF R2 = 'X'.
        LOOP AT SCREEN.
          IF screen-group1 = 'ABC' .
            screen-active = '0'.
            screen-input = '0'.
            screen-output = '1'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.

    Modified ur code .
    tables : ekko, mkpf.
    PARAMETERS : R1 RADIOBUTTON GROUP RG USER-COMMAND R DEFAULT 'X'.
    PARAMETERS : R2 RADIOBUTTON GROUP RG .
    SELECTION-SCREEN BEGIN OF BLOCK RPT1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS: S1_BUKRS FOR EKKO-BUKRS MODIF ID ABC.
    SELECT-OPTIONS: S1_EBELN FOR EKKO-EBELN MODIF ID ABC .
    SELECT-OPTIONS: S1_IHREZ FOR EKKO-IHREZ MODIF ID ABC .
    SELECTION-SCREEN END OF BLOCK RPT1.
    SELECTION-SCREEN BEGIN OF BLOCK RPT2 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS: S2_BUKRS FOR EKKO-BUKRS MODIF ID DEF.
    SELECT-OPTIONS: S2_MBLNR FOR MKPF-MBLNR MODIF ID DEF.
    SELECT-OPTIONS: S2_XBLNR FOR MKPF-XBLNR MODIF ID DEF .
    SELECTION-SCREEN END OF BLOCK RPT2.
    at selection-screen output.
    IF R1 = 'X'.
    LOOP AT SCREEN.
    IF screen-group1 = 'DEF' .
    screen-active = '0'.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    IF R2 = 'X'.
    LOOP AT SCREEN.
    IF screen-group1 = 'ABC' .
    screen-active = '0'.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    at selection-screen .
    if r1 = 'X'.
    if s1_ebeln[] is initial and s1_ihrez[] is initial..
    message e001(zxx) with 'pls input one of these two options!'.
    endif.
    if NOT s1_ebeln[] IS initial.
    IF NOT s1_ihrez[] IS INITIAL.
    message e001(zxx) with 'only one entry in Ebeln or Ihrez is
    allowed'.
    ENDIF.
    ENDIF.
    endif.
    START-OF-SELECTION.
    WRITE:/ 'hi'.
    ***add on
    split the text into two texts .
    <b>if NOT s1_ebeln[] IS initial.
    IF NOT s1_ihrez[] IS INITIAL.
    message e001(zxx) with text-001 text-002.
    *'only one entry in Ebeln   = text-001
    or Ihrez is allowed'.       = text-002.</b> 
    regards,
    vijay

  • How to set selected Language from Portal dropdown in Logon to User profile

    Hi Gurus,
    I select a language in Portal Language dropdown in the Logon Page.
    After login in the content is getting displayed in the browser language.
    I want the portal content to be displayed in the selected language in the portal LogonPage.
    I checked the thread Logon page change to add a dropdown for language
    The is the requirement for me too .
    Kindly suggest me on how to set the language in the Portal user Profile so that the portal contents gets displayed in the selected languages from the dropdown .
    Thanks in Advance

    Hi Prasanna,
    The language that the portal is displayed in depends on the following
    heirarchy, with the languages at the top of the list taking precedence
    over those at the bottom:
    1. Component (iview) language (defined in the portalapp.xml)
    2. Portal Mandatory language (defined in the prtDefault.properties)
    3. User language (defined in the user#s profile).
    4. Request language (defined by the browser).
    5. Portal Default language (defined in the prtDefault.properties)
    6. System Default language (default locale defined by the OS).
    So for example, if you have your portal user language (as in point 3)
    set to Russian, but the language of the iView that is the logon page
    (as in point 1) set to English, that logon page will be displayed in
    English.
    Keeping the above in mind, please make the necessary changes to the
    configurations and check if it helps.
    Regards,
    Sowmya
    Edited by: Sowmya K on Jun 2, 2011 11:32 AM

  • How to set selected all checkboxes in all dataTable's rows?

    Hi there,
    I'm trying to perform this simple task: having a dataTable with a column containing checkboxes, how can I allow (with a button, a "super" checkbox or so) to simultaneously set selected all checkboxes in all rows?
    And - is it possible to do so without calling the submit of the page?
    Thanks to everyone!

    Yes, the paging for <h:dataTable> works pretty good, it manages the task through four methods created in the java code -- DataTable1_firstPageAction(), DataTable1_previousPageAction(), DataTable1_nextPageAction(), DataTable1_lastPageAction() -- without adding any javascript in the jsp page.
    Maybe I could test if a java script similar to the <ui:table>'s one fit also the dataTable...
    thanks

  • ADF Faces: af:menuTabs - How to set selected tab

    I cannot find any documentation on how to set the selected tab of an af:menuTabs instance.
    Please help.

    Hi,
    the method above works if you manually inserts the menu items into a menu component, but not if you declaratively bind each component to a menu model.
    Following the ADF developer's guide, I created a dynamic menu using menuTabs (Section 11.2 Using dynamic menus for navigation). But somehow I don't get a difference in appearance between the selected and unselected tabs.
    I am also confused with the explanation in the tutorial. It says "The menu model in conjuction with nodeStamp controls whether a menu item is rendered as selected. As described earlier, a menu model is created from a tree model, which contains viewId information for each node. ViewIdPropertyMenuModel, which is an instance of MenuModel, uses the viewId of a node to determine the focus rowKey. Each item in the menu model is stamped based on the current rowKey. As the user navigates and the current viewId changes, the focus path of the model also changes and a new set of items is accessed. MenuModel has a method getFocusRowKey(), which determines which page has focus, and automatically renders a node as selected if the node is on the focus path."
    Any suggestions where I should add code to change the appearance of the selected tab? I am using the default Oracle skin.
    Greetings,
    Birgit

  • How to set selected row in alv display?

    Hi,
    How do I select some particular row in alv - say at first display i want to highlight 4th row. How can i do that?
    Thanks,
    Sheel

    try to use method set_selected_rows just after method for first display.

  • How to set character encoding to Greek in a javascript file in Dreamweaver CS4?

    I have a javascript file built with a text editor some time
    ago, which has Greek characters in one of the variables:
    1.) --> var
    scrollercontent='</font><br><font face="Verdana"
    color="#333333" size="-1">11-04-2008:
    <b>ΜΑΝΩΛΗΣ
    ΜΗΤΣΙΑΣ
    </b><br><img SRC="mitsias2.gif" height=148 width=104
    border="0" /><p></font>' <--
    In DW CS4 it displays as
    2.) --> var
    scrollercontent='</font><br><font face="Verdana"
    color="#333333" size="-1">11-04-2008: <b>???O??S ???S??S
    </b><br><img SRC="mitsias2.gif" height=148 width=104
    border="0" /><p></font>' <--
    When trying to save the corrected content in 1.) I get an
    error message that DW cannot save the Greek characters. I am asked
    to change the character encoding.
    I don't know how to change the character encoding in a js
    file. Is there a "head" file like in HTML? Or how does one
    determine the character encoding in a js file?
    When I change the encoding in the prefereces, which is
    "Western" to "Greek" or "UTF", I have the same result.
    Thanks for help.
    jml

    The .js file and the html need to have the same encoding. If
    your html uses iso-8859-7, then the .js must also use that. But if
    the original text editor created the .js file using utf-8, then
    that is what the html needs to use.

  • How to set selected text on JTextPane ?

    I need to set selected text on a JTextPane. I used setSelectionStart(); and setSelectionEnd(); but it doesn't work.
    Can anybody help me?

    I'm not sure if this is what you are looking for, but the following code sample was revised from the tutorial TextSamplerDemo.java. It will hightlight the word "selected" in yellow in the JTextPane.
    //created with j2sdk1.4.0_01
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    import java.awt.event.*;      
    public class SelectedText extends JFrame {
        public SelectedText() {
            super("Selected Text");       
            //Create a text pane.
            JTextPane textPane = createTextPane();
            JScrollPane paneScrollPane = new JScrollPane(textPane);
            paneScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
            paneScrollPane.setPreferredSize(new Dimension(250, 155));
            paneScrollPane.setMinimumSize(new Dimension(10, 10));
            Container pane = getContentPane();
            pane.add(paneScrollPane);
        private JTextPane createTextPane() {
            JTextPane textPane = new JTextPane();
            String[] initString =
                    { "This is the ", //regular
                      "selected",     //selected
                      " text. "       //regular
            String[] initStyles = {"regular", "selected", "regular"};
            initStylesForTextPane(textPane);
            Document doc = textPane.getDocument();
            try {
                for (int i=0; i < initString.length; i++) {
                    doc.insertString(doc.getLength(), initString,
    textPane.getStyle(initStyles[i]));
    } catch (BadLocationException ble) {
    System.err.println("Couldn't insert initial text.");
    return textPane;
    protected void initStylesForTextPane(JTextPane textPane) {
    //Initialize some styles.
    Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
    Style regular = textPane.addStyle("regular", def);
    StyleConstants.setFontFamily(def, "SansSerif");
    Style s = textPane.addStyle("selected", regular);
    StyleConstants.setBackground(s, Color.YELLOW);
    public static void main(String[] args) {
    JFrame frame = new SelectedText();
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    frame.pack();
    frame.setVisible(true);
    S.L.

  • How to set closed captioning to turn 'on' as default setting?

    Does anyone know how to set the closed captioning so that
    this feature is turned "on" as the default when people view the
    finished product? As it stands right now, users must select the
    "cc" button on the "control pad" to turn on closed captioning, but
    I want it to automatically appear.

    Hi again
    All you should have to do is to edit the first slide in
    Captivate. Click Insert > Animation and point at the .SWF file.
    Once you have done this, publish your project again and your Closed
    Captions should display automagickally.
    Cheers... Rick

  • How to set settings to do 'right' thing by default, than default to 'wrong things...?

    (How vague a title can i come up wth)...
    Well it could apply to more than one situation, which is why I left it a bit(!) open...
    Specifically, I find one of the reasons my current file has grown from a 60MB file to a 2.5GB file, is my use of gradients and fills in shapes.  By default, when I create a layer,
    I press control-N, then draw a shape, bind the vector to the layer, then fill it with a gradient.  Trouble is, they aren't 'gradient layers', they are gradients ON layers...and there
    doesn't seem to be any easy way to convert from one to the other...
    And why would I care?  ... well my picture is 4.5Kpx^2, if it is a gradient on a layer, then it's a 80MB/layer image of a gradient.  (OUCH), vs. a gradient layer, that is just
    a formula with the gradient. (<1K,). Compressed they seem to take around 20MB on disk...so, from that, you can see I've added about 120 of those layers to the file.... each
    layer, a small faction of the orignal image, yet taking almost as much as the original!...
    So it would be convenient if when I create a layer, it could do the right thing to begin with.  Problem is -- when I hve tried to create a gradient layer, the program doesn't let me create the gradient -- I can only use a predefined gradient.   Which is awkward to say the least!...
    So this is related to the same problem I'm trying to find a work-around for (though it would addresss other simlar problems in the various other tools)...
    If I had the control when creating the gradient for it to take it's rotation from the line I drew...  As long as I am only drawing gradients, it can copy the formula and direction of each and apply/store them as the layer's 'gradient' forumula...?

    That is what I do.
    But I'd want it to create the gradient layer, blank to begin with.  My process wasn't aligned with the requirements...but I usually like to go delete the layer mask 1st, and then I need to make sure the newly created gradient layer is below the old layer so I can pick off the colors from the old layer.   then I can go back into the gradient fill as you show above to create the gradient.
    What is very NOT intuitive,  is DIRECTION on the gradient.   On a normal layer, it's pretty accurate, go from point a to point b. 
    But trying to duplicate that accuracy -- the agle from that tiny little circle, , and then trying to find the 'edge of the graident and where it lines up with the layer you see....
    All those are trial and error... 
    What Horribly threw me off was I was used to working with the canvas rotated for the area I was in....
    The rotated canvas isn't integrated into hardly any of the tools -- they all still have their x-y aligned on what is a "skewed sight line" for one looking
    at a rotated canvas.
    Ideally, the tool coordinates would be relative to the view (or toggleable between absolute and relative as some might prefer the other...)...
    But trying to figure out the gradient directly when your canvas is rotated... isn't exactly *obvious*, nor simple.   Doable, yes, but not very easily...

  • How to set my windows to open at their default size every time.

    Ok, when I connect to my computer with splash top from my ipad my windows resize.  Is there a way to set my windows to just open at default size no matter what.  So every time I open a program the window is at default factory settings size.
    Thank you,
    Byggy687

    > How can I create a username and password pop up window?
    Use DW's OpenBrowser Window behavior.
    > Is that database related?
    The pop up window is not, but the processing of the login is
    likely to be.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Inokat" <[email protected]> wrote in
    message
    news:efd2l7$nns$[email protected]..
    > :), Man there are some excited people out there.
    > I got the picture after the first answer. Thanks David.
    >
    > I have another Q.
    > How can I create a username and password pop up window?
    Is that database
    > related?
    >
    > By the way, for those excited people out there, ?CHILL?
    >
    >
    >

  • How to set selected text color in Spark TextInput

    I'm trying to make Spark TextInputs and MXFTETextInputs look like Halo/MX TextInputs as much as possible, since I have a mix of both Spark and MX TextInputs in my application. I know I can set the
    selection background color to black using focusedTextSelectionColor. How can I set the selected text color to white so it matches the MX white-on-black look?

    This works, if you set the enabled property directly on the s:TextInput:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx">
        <s:layout>
            <s:VerticalLayout horizontalAlign="center" verticalAlign="middle" />
        </s:layout>
        <s:controlBarContent>
            <s:CheckBox id="ch" label="enabled" selected="true" />
        </s:controlBarContent>
        <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            s|TextInput:disabled {
                color: red;
        </fx:Style>
        <s:Group>
            <s:TextInput id="ti" text="The quick brown fox jumps over the lazy dog" enabled="{ch.selected}" />
        </s:Group>
    </s:Application>
    It can get a bit trickier when you're setting the enabled property on a parent container, since (I believe) that the child control's enabled properties are still set to true and just the container is disabled. One possible workaround would be to bind the child TextInput control's enabled property to the container's enabled property. That way the s:TextInput should still go to it's disabled state and you can customize the disabled state's styles to have darker text, or whatever else you want.
    <s:Group id="gr" enabled="{ch.selected}">
        <s:TextInput id="ti" text="The quick brown fox jumps over the lazy dog" enabled="{gr.enabled}" />
    </s:Group>
    Peter

Maybe you are looking for

  • External Speaker stopped working - get sound through headset

    I have a Zire 72.  The external speaker stopped working.  If I listen to music or voice memos through a headset, I can hear the message so the programs are working.  I have tried a soft reset but no results.  Has anyone had this expierience?  Sounds

  • Count of number of campaigns executed for a business partner?

    Hi all I'm hoping someone can advise me on how to fulfil this requirement. Basically I need to find a way of ensuring that customers are only included in a maximum of five campaigns per month. My current idea centres around 1) Creating an interaction

  • How to update table styles in the new Pages?

    Anyone found out how to update table styles in the new Pages? I see it's done in some of the templates that Apple provided, but I can't find it. Also, the Copy table style command is gone, so I can't make my tables look in a uniform way, unless I use

  • How can i change normal document to pdf in pages

    Hey, I'm using pages for writing documents. I was wondering how can I change my normal document to PDF-format. Thanks.

  • Newbee question - Track mods?

    I want to create a CD of some songs from my library (iTunes based) for my spinning class. I would like to shorten several tracks and add a fadeout effect so it sounds professional...not cheezy. Are there affordable Apps for doing this easily? I only