Java Code Examples for javax.swing.JFileChooser.updateUI()

The following are Jave code examples for showing how to use updateUI() of the javax.swing.JFileChooser class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: bddproject   File: File.java   View Source Code Vote up 5 votes
/**
* Use the readFile method with a JFileChooser interface to select the file to convert.
* @return The file convert in String
*/
public static String selectAndReadFile(){
    String ret = "";
    JFileChooser chooser = new JFileChooser("../ws/samples");
    java.util.Locale.setDefault(java.util.Locale.ENGLISH);
    chooser.setLocale(java.util.Locale.ENGLISH);
    chooser.setLocale(java.util.Locale.getDefault());
    chooser.updateUI();
    chooser.setFileFilter(new FileNameExtensionFilter("SQL file (*.sql)", "sql"));
    int returnVal = chooser.showOpenDialog(null);
    if(returnVal == JFileChooser.APPROVE_OPTION){
        ret = readFile(chooser.getSelectedFile().getAbsolutePath());
    }
    return ret;
}
 
Example 2
Project: bddproject   File: File.java   View Source Code Vote up 5 votes
/**
* Use the writeFile method with a JFileChooser interface to select where you want to save your file.
* @param data The String to save in a file.
*/
public static void selectAndWriteFile(String data){
    JFileChooser chooser = new JFileChooser("../ws/samples");
    java.util.Locale.setDefault(java.util.Locale.ENGLISH);
    chooser.setLocale(java.util.Locale.ENGLISH);
    chooser.setLocale(java.util.Locale.getDefault());
    chooser.updateUI();
    chooser.setFileFilter(new FileNameExtensionFilter("SQL file (*.sql)", "sql"));

    int returnVal = chooser.showSaveDialog(null);
    if(returnVal == JFileChooser.APPROVE_OPTION){
        writeFile(chooser.getSelectedFile().getAbsolutePath()+".sql", data);
    }
}