문제

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

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

도움이 되었습니까?

해결책

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

다른 팁

Maybe a solution would be to extend the JFileChooser class and overload the constructor with the new setSize method. Not sure if this will work. I know you can extend the very basic JDialog to create custom dialogs and calling setSize there worked for me last time I tried it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top