How to set the initial directory

Using the element "FileChooser' in JavaFX 2.0. How can you properly set the initial directory?

In Swing, you follow these steps:
JFileChooser Choose = new JFileChooser();
Choose.setCurrentDirectory(new File("."));
But in JavaFX:
Choose.setInitialDirectory(new File("."));
doesn't work and causes JavaFX to bomb out when this code is triggered.

Published by: 863626 on October 30, 2011 05:30
javafx.stage.FileChooser choose = newjavafx.stage.FileChooser();
 File d = new File(getClass().getResource(".").getFile());
choose.setInitialDirectory(d);

Tags: Java

Similar Questions

  • How to set the initial value programmatically in af:selectOneChoice

    Hi all

    How to set the initial value programmatically in af:selectOneChoice

    filled with view object instance, but I want to show the value initial programmactically

    This can help you: Re: how to set the default value of the component selectOneChoice in ADF

    and the default af:selectOneChoice programmatically from backing bean

  • How to set the initial state to hide/show buttons on opening PDF files?

    InDesign offering a wonderful object multi-state capacity which unfortunately does not work in PDF files. It took a bit of research for me to come with this information, the UI program itself gives indications that this should work. (Why not maybe another forum of discussion.)

    So, I create an interactive PDF using buttons to hide/show specific paragraphs (which are also implemented as buttons because only the buttons and forms can be hidden or shown, AFAIK).

    I've set up a PDF created via InDesign using the six control keys and seven paragraphs - one of these paragraphs is the initial state that I want to see when the document is opened. As long as the PDF file that I create is distributed, that's how it works: an initial paragraph appears, buttons can be clicked and the stuff of Heroes appears the mark.

    However, a colleague thoughtfully saved the PDF file (so it could rename something more to his liking). When he does this, he left one of the displayed subsidiary paragraphs, rather than the initial paragraph I intended... and of course, this is the version that came out to the customer.

    Question: Is there a way to set the initial state to hide/show buttons when a PDF document is opened first, regardless of the State in which he could let or saved? I guess it's sort of ON OPEN event that would allow me to define an initial state as a safety net to the way I save the original document. Obviously, the PDF AS I DELIVER IT will pave the way, I want it, but I'm trying to overcome the appearance of the Murphy's law of a document that can be re-recorded in another State. An event which OPENED on that cure.

    Thank you.

    in this case you would have been better if you had locked the PDF file in order to prevent changes ANDS record as actions...

  • How to set the initial value of the same value as the Page loading of SelectOneMenu

    Hello

    I noticed that in my value = "#{bean.selectedItem page}" of selectonemenu is always null when loading the page and because of that there is a difference in the initial value and the value sent as valuechangelistener is shot because of this difference, I don't want to happen. "

    I call the method to load the values into selectonemenu in the constructor of my bean.

    How can I make sure that the initial value is always the same as the value at the time of page load so that valuechangelistener would not fire unless the user changes the options in selectonemenu. Because of this problem I am facing a lot of issues like valuechangelistener is going to get fired.

    Any help is much appreciated.

    Thank you

    Yes, you will need to find a way to set the value before the creation of the part of the view. Generally, there are two ways. There are at least two ways, I tend to use:

    (1) loading deferred; you would get a Get accessor like this method:

    public String getValue(){
      if(value == null){
        // code here to get value from wherever
      }
    
      return value;
    }
    

    (2) initialize properties in a method annotated with @PostConstruct in your backing bean

    @PostConstruct
    public void initialize(){
      value = whatever;
    }
    

    Hope that helps you. If this isn't the case, so I totally misunderstood you and you try to explain more clearly what your problem is.

  • How to set the initial focus to the second field?

    Hello

    I created one for the user to enter data.
    The first field of the form has a default value.
    Therefore, when the screen is rendered, I would like to put the cursor in the second field for the user to enter data.

    How can I do this?

    Thank you

    Gabor

    Ahh and now for points...

    Set the display of Page attributes > focus cursor "do not carry the cursor".

    This allows your javascript to run.

    Gus...

    You can reward this answer by marking as being useful or correct ;-)

  • How to set the initiator

    We have a process that uses the process creation activity to start another process. When that other process is created, it doesn't have the initiator as the user who created the parent company. It includes automatic Manager as the initiator. We want to set up a view that displays processes created by the reqeustor. I know that this can be done by using the condition where initiator = CurrentUser. In this case it will not work. Any ideas?

    Hello

    You will not be able to define the predefined variable creation, but you can create a project variable new string "initiator". If you choose the name of the participant that you create the instance, you will be able to create a view of this project variable.

    Hope this helps,
    Dan

  • How to set the initial value for a single radiobutton in a group of Radio buttons

    Hi all

    I have a radiogroup with 3 buttons. The names of the RadioGroup are driven out of a XXVO.

    3 Radion buttons:

    + 9
    * XX
    * XXX

    When loading the Page I want to make an XXX option button to be the default, please suggest how.

    Note: The radiobutton values come from VO

    Thank you

    Hello

    XXCONTACT_ADDR_BUTTON1 - is the value of the radio button to select the right...

    Very well.. :))

    Concerning
    Meher Irk

  • How to set the initial position of the window and the size of a CHM file to RoboHelp 2015

    Hello.

    I use RoboHelp 2015.  After posting my chm file, when I open the file that it is always placed in the upper left of the screen and is a bit too small.  Where in 2015 of RoboHelp can I go to change the attributes of size and position for the way the chm file is shown by pressing?

    Robert

    OK, try this one:

    Click here to see

    See you soon... Rick

  • How to set the path of the report in a plugin for model

    I'm trying to figure out how to set the path of the report in a plugin process model. I can't find a way to have access to it. It seems this would be a reasonable thing to do since the plug-ins are for the treatment of the results. Does anyone know how to do this? We generally use the sequential process model, but I try to keep my plug-in as independent as possible.

    Thank you.

    If I understand correctly, you want your plug-in, when enabled, change the settings of all other instances of the report OR plugin as their reports share the same directory that your plug-in is configured to use.

    If so, your plug-in can access and change the settings of all other instances of plugin. All instances are passed to all the points of plugin entries in the subproperty of the plugins of the ModelConfiguration parameter table. You can browse this table. Any element of the array with an equal to "NI_ReportGenerator.seq" Base.SequenceFilename is an instance of the report OR plugin. Its report options are stored in the element under PluginSpecific.Options.

    You can change the report options to what you want. Note that the recall of the ReportOptions model is called from template-plugin Initialize entry point, then you might want to ensure that your changes are applied after that, so they are not replaced. To do this, you could make your changes in the Initialize entry point of your plugin and make sure your plugin runs last. To rotate the last, you can set the FileGlobals.ModelPluginComponentDescription.Default.Base.RunOrder in your file of plug-in with a value greater than 0, for example 1.0 (see Help for TestStand > Fundamentals > process template Architecture > plug-in for the model process Architecture > Structure of the plugin sequence files > plugin model of entry Points > Order Execution of Point of entry at run time).

  • How to set the number of e-mail messages that are stored on my iPhone

    How to set the number of e-mail messages that are stored on my iPhone – so when I don't have a network connection I can see a 'large' number of messages in my Inbox etc.

    This is series is not defined in the world

    You must go to settings-> mail, contacts, and calendars and check the settings of your e-mail provider offers in this area

  • How to set the time that my screen stays on?

    How to set the time that my screen lights up.  I have an iPod Touch 6?

    Settings > general > auto-lock

  • How to set the default android home page.

    How to set the home page in the latest browser of firefox for android?

    Hello:

    Unfortunately you can not remove the top sites home page but you can pin a site, remove a site from unpin it and change the url of a pinned site.

    Please read this article for instructions.

    I hope this helps!

  • How to set the time between slides in a slideshow (iPhoto, el capitan)

    How to set the time to say - 5 seconds or 20 seconds - between slide show photos in iPhoto. I use el capitan.

    See the Settings button at the bottom right of the toolbar (at the bottom of the slide show). Click on it and you have a small window with two tabes, refers to all the slides, the other to the selected slide. You can make your choice

  • Satellite C660 - how to set the focus of the webcam?

    Hello

    Just bought this laptop, the built-in webcam looks very blurry when I use Skype. Does anyone know how to set the focus to the subject?

    See you soon
    Jules

    Hello

    to be honest, I have no idea on your model of lap... Try to update driver webcamd and play with Skype video settings.

  • How to set the date and time on my HP Officejet pro 8600 more?

    How to set the date and time on my HP officejet pro 8600 more?  It just on a printed journal Jan-oo-oo fax shows 00:00 AM.  There are no instructions on how to change this.  I need proof that I sent a fax to a certain date and time.  Help, please.  Thank you

    Hello

    Below are the steps to set the Date and time for your device:

    1. On the Control Panel, press the right arrow key ( ), press Setup ( ).

Maybe you are looking for