The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > javax.swing.filechooser  [19 examples]

e894. Copying the Filename Path from a JFileChooser Dialog to the Clipboard

Typing control-c in a file chooser dialog copies the names of the selected files to the clipboard. If there is only a single selected file, the absolute path of the file is copied to the clipboard. Here is an example:
    C:\Documents and Settings\Administrator\Start Menu\Programs\Internet Explorer.lnk
If there are multiple selected files, the absolute paths of the selected files are wrapped in HTML code and copied to the clipboard. Here is an example of the HTML code:
    <html><ol>
    <li>C:\Documents and Settings\Administrator\Start Menu\Programs\Internet Explorer.lnk
    <li>C:\Documents and Settings\Administrator\Start Menu\Programs\MSN Messenger Service.lnk
    <li>C:\Documents and Settings\Administrator\Start Menu\Programs\Outlook Express.lnk
    <li>C:\Documents and Settings\Administrator\Start Menu\Programs\Windows Media Player.lnk
    </ol></html>

 Related Examples
e887. Creating a JFileChooser Dialog
e888. Displaying Only Directories in a File Chooser Dialog
e889. Adding a Filter to a File Chooser Dialog
e890. Determining If the Approve or Cancel Button Was Clicked in a JFileChooser Dialog
e891. Getting and Setting the Current Directory of a JFileChooser Dialog
e892. Getting and Setting the Selected File of a JFileChooser Dialog
e893. Getting the File-Type Name of a File

See also: Events    Hidden Files    Icons    Layout    Selections   


© 2002 Addison-Wesley.