JDK-6515169 : wrong grid header in JFileChooser
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_2000,windows_xp
  • CPU: x86
  • Submitted: 2007-01-19
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u4Fixed 7 b15Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Versione 5.1.2600]

EXTRA RELEVANT SYSTEM CONFIGURATION :
I tested the problem only on Italian Windows, for the bug type i think could be relevant.

A DESCRIPTION OF THE PROBLEM :
If you use JFileChooser with:

setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES)

and

setCurrentDirectory (new java.io.File("."))

the header grid in the "detail" mode is wrong.


see below for more detail.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
compile and run the program attached.
click on the push button "datail" in the right-top corner.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
this is the Expected Result:
http://img205.imageshack.us/img205/384/50ng0.gif

the header value correspond to the column content
ACTUAL -
this it the actual result:
http://img181.imageshack.us/img181/4775/60cs9.gif

the third header value is "last edited time" but the column content is "file type"

there is a mismatch between the header and the column content

note: if you change directory, the header change to the correct one

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.font.*;
import javax.swing.*;
import java.io.*;

public class T2 {

   public static void main (String argv[]) {
      JFileChooser theDialog = new JFileChooser (".");
      theDialog.setAcceptAllFileFilterUsed (false);
      theDialog.setDialogTitle("Prova 2");

      theDialog.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

      theDialog.setCurrentDirectory (new java.io.File("."));

      theDialog.showOpenDialog(null);
   }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
use:

CurrentDirectory (new java.io.File("absolute url"));

insted of:

CurrentDirectory (new java.io.File("."));

Release Regression From : 5.0u10
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION This happens if an instance of java.io.File (instead of sun.awt.shell.Win32ShellFolder2) is set as the current dir. This case should be handled properly.
20-03-2007