FULL PRODUCT VERSION : java version "1.6.0_10-rc" Java(TM) SE Runtime Environment (build 1.6.0_10-rc-b28) Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing) ADDITIONAL OS VERSION INFORMATION : Microsoft Windows XP Version 5.1.2600 A DESCRIPTION OF THE PROBLEM : When using showSaveDialog, a custom set approve button text does not appear until the second attempt. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Compile and run ApproveButtonTest. Click "Cancel" on the file chooser dialog. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The approve button text should read "Export" the first time the file chooser dialog appears. ACTUAL - The approve button text reads "Save", the first time the file chooser dialog appears. REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import javax.swing.JFileChooser; import javax.swing.SwingUtilities; import javax.swing.UIManager; import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; public class ApproveButtonTest { private static JFileChooser chooser = null; public static void main(final String[] args) throws Throwable { SwingUtilities.invokeLater(new Runnable() { public void run() { try { UIManager.setLookAndFeel(WindowsLookAndFeel.class.getName()); } catch (Throwable t) { t.printStackTrace(); } if (chooser == null) { chooser = new JFileChooser("C:/"); } for (int i = 0; i < 2; i++) { chooser.setApproveButtonText("Export"); chooser.showSaveDialog(null); } System.exit(0); } }); } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : For the example above, a workaround is to insert the following before setting the approve button text: chooser.setDialogType(JFileChooser.SAVE_DIALOG);
|