List of usage examples for javax.swing JFileChooser setToolTipText
@BeanProperty(bound = false, preferred = true, description = "The text to display in a tool tip.") public void setToolTipText(String text)
From source file:modelibra.swing.app.util.FileSelector.java
/** * Selects a file (path)./*from w w w . ja v a 2 s. c om*/ * * @param lang * language * @return chosen file path */ public String selectFile(NatLang lang) { JFileChooser fileChooser = new JFileChooser(lastFilePath); fileChooser.setLocale(lang.getLocale()); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setToolTipText(lang.getText("selectFile")); fileChooser.setDialogTitle(lang.getText("selectFile")); fileChooser.showDialog(null, lang.getText("selectFile")); File f = fileChooser.getSelectedFile(); if (f != null) { lastFilePath = f.getPath(); return lastFilePath; } else { return null; } }
From source file:modelibra.swing.app.util.FileSelector.java
/** * Selects a directory (path).// w w w . j a va2 s . c o m * * @param lang * language * @return chosen directory path */ public String selectDirectory(NatLang lang) { JFileChooser dirChooser = new JFileChooser(lastDirectoryPath); dirChooser.setLocale(lang.getLocale()); dirChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); dirChooser.setToolTipText(lang.getText("selectDirectory")); dirChooser.setDialogTitle(lang.getText("selectDirectory")); dirChooser.showDialog(null, lang.getText("selectDirectory")); File f = dirChooser.getSelectedFile(); if (f != null) { lastDirectoryPath = f.getPath(); return lastDirectoryPath; } else { return null; } }