United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6515169 wrong grid header in JFileChooser
JDK-6515169 : wrong grid header in JFileChooser

Details
Type:
Bug
Submit Date:
2007-01-19
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
client-libs
OS:
windows_xp,windows_2000
Sub-Component:
javax.swing
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:
Duplicate:
Duplicate:
Duplicate:
Duplicate:

Sub Tasks

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.
                                     
2007-03-20



Hardware and Software, Engineered to Work Together