The Java Developers Almanac 1.4


Order this book from Amazon.

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

e898. Changing the Text of the Approve Button in a JFileChooser Dialog

The approve button is clicked by the user to indicate that the file has been selected. The default label for the approve button is either Open or Save, depending on the dialog type. This label can be changed.
    JFileChooser chooser = new JFileChooser();
    
    // Set the text
    chooser.setApproveButtonText("New Approve Text");
    
    // Set the mnemonic
    chooser.setApproveButtonMnemonic('a');
    
    // Set the tool tip
    chooser.setApproveButtonToolTipText("New Approve Tool Tip");
    
    // Show the dialog; wait until dialog is closed
    chooser.showOpenDialog(frame);

 Related Examples
e899. Setting an Accessory Component in a JFileChooser Dialog
e900. Displaying the Current Directory in the Title of a JFileChooser Dialog

See also: Events    Hidden Files    Icons    Selections   


© 2002 Addison-Wesley.