Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open JFileChooser with predefined size

chooser = new JFileChooser();
chooser.setSize(300, 200);
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
.......
}

This doesn't work. Always opens in default size.

like image 578
Stefanos Kargas Avatar asked Nov 22 '10 13:11

Stefanos Kargas


People also ask

How many files can a file chooser let a user select by default?

By default, a user can choose only one file.

Which of the following is built in dialog that lets a user select a file JFileChooser?

The object of JFileChooser class represents a dialog window from which the user can select file.


1 Answers

Try chooser.setPreferredSize(new Dimension(300, 200))

like image 191
Gilbert Le Blanc Avatar answered Nov 06 '22 11:11

Gilbert Le Blanc