|
Quick Lists
|
|
Bug ID:
|
4843575
|
|
Votes
|
0
|
|
Synopsis
|
GTK+ JFileChooser lacks the file type selection box
|
|
Category
|
java:classes_swing
|
|
Reported Against
|
mantis-beta
|
|
Release Fixed
|
|
|
State
|
11-Closed,
Not a Defect,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
|
|
Submit Date
|
07-APR-2003
|
|
Description
|
FULL PRODUCT VERSION :
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)
FULL OS VERSION :
Red Hat Linux 9, kernel 2.4.20, i686
Windows 2000
A DESCRIPTION OF THE PROBLEM :
The JFileChooser does not have a file type selection drop-down box in the GTK+ look and feel. If a ".txt" file filter is used, for example, only that type of file be visible. The box is available in the Metal look and feel.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Create a JFileChooser.
2) Pass a file filter to setFileFilter.
3) Open the JFileChooser.
EXPECTED VERSUS ACTUAL BEHAVIOR :
A file type drop-down box will be available.
No file type drop-down box will be available. Only files from the filter's default file type are visible.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.io.*;
import javax.swing.filechooser.FileFilter;
public class GTKJFileChooserTypeTest {
public static void main(String[] args) {
// Comment this block to show the Metal look and feel, where
// the file type selection box is visible
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf"
+ ".gtk.GTKLookAndFeel");
} catch (Exception e) {}
JFileChooser chooser = new JFileChooser();
chooser.setFileFilter(new TextFileFilter());
chooser.showOpenDialog(null);
}
}
class TextFileFilter extends FileFilter {
public boolean accept(File f) {
return f.getName().toLowerCase().endsWith(".txt")
|| f.isDirectory();
}
public String getDescription() {
return "Text File";
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Don't use the enjoyable GTK+ look and feel.
(Review ID: 183632)
======================================================================
|
|
Work Around
|
N/A
|
|
Evaluation
|
The native one doesn't offer these either.
xxxxx@xxxxx 2003-04-07
Yes, this was intentional, in order to mimick the GTK file dialog.
xxxxx@xxxxx 2003-04-08
|
|
Comments
|
Submitted On 28-MAY-2003
acroyear
I disagree with this approach. SOME modifications may be
necessary, in order to not disable features that other
"Look&Feels" support. All this disabling of features of the
JFileChooser is going to lead to are programmers building
their own JFileChooser clone that supports all the features
they need in ALL the look and feels they have to support.
As a result of this decision, I will make a point of
recommending against ever using the GTK+ L&F in any released
application.
Mimicking is one thing, dumming down to is another.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |