-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
beta2
-
generic
-
generic
Name: yyT116575 Date: 05/17/2001
java version "1.3.0_02"
Java(TM) 2 Runtime Enviroment, Standard Edition (build 1.3.0_02)
Java HotSpot(TM) Client (build 1.3.02_02, mixed mode)
When selecting multiple files if your list of files is greater than the
displayable amount each time you select a file it takes you back to the top.
This can be really very tedious when doing over a 40 files.
To see the problem perform the following actions.
1) Start the application
2) Press the File button. This will display the JFileChooser
3) Change to a directory with lots of files.
4) Start selecting files one by one using the mouse and holding down the
control key. Scroll down when necessary to select more files. Once more
files have been selected than can be displayed in the file list the scroll
bar of the list will shift towards the top of the window. This forces you
to scroll back down to select the next file. And then after it is selected
--- wham-o -- it scroll back. This is VERY frustrating to our users.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
public class FileChooserBug extends JFrame implements ActionListener {
JButton fileButton = new JButton("Files");
JButton exitButton = new JButton("Exit");
Container contentPane;
public FileChooserBug() {
super("File Chooser Bug Test");
contentPane = this.getContentPane();
fileButton.setActionCommand("File");
exitButton.setActionCommand("Exit");
fileButton.addActionListener(this);
exitButton.addActionListener(this);
//Add the Panel toolbar to the outter window
contentPane.add(fileButton, BorderLayout.NORTH);
contentPane.add(exitButton, BorderLayout.SOUTH);
setSize(100, 100);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("Exit")) {
setVisible(false);
dispose();
System.exit(0);
} else if (e.getActionCommand().equals("File")) {
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
//file only
fc.setMultiSelectionEnabled(true);
//multiple files
int response = fc.showOpenDialog(this);
}
}
public static void main(String args[]) {
new FileChooserBug();
}
}
(Review ID: 124416)
======================================================================