Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Please ask technical questions in the appropriate category. Thank you!

JFileChooser setMinimunSize not working?

843805Jan 10 2007 — edited Jan 11 2007
I'm using Windows Xp service pack 2 and Java 6 build 104
maybe I'm doing something wrong, but setMinimumSize(Dimension) on JFileChooser is not working for me.

can someone help me?


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;


public class FileChooserSizeTest {


JFrame frame;
////////////////////////////////////////////////////////////////////////////////
public FileChooserSizeTest(){

frame = new JFrame("File Chooser Test");
frame.setLayout(new BorderLayout());
JButton clicMe = new JButton("click me");
clicMe.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){

JFileChooser fc = new JFileChooser();
fc.setMinimumSize(new Dimension(200,200)); // ????
fc.setDialogTitle("Save file As");

final int rVal = fc.showSaveDialog(frame);
if(rVal == JFileChooser.APPROVE_OPTION)
{

}

}
});
frame.setSize(300,300);
frame.add(clicMe, BorderLayout.CENTER);
frame.setVisible(true);
}
////////////////////////////////////////////////////////////////////////////////
public static void main(String[] args){

SwingUtilities.invokeLater(new Runnable(){
public void run(){

new FileChooserSizeTest();
}});

}

}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 8 2007
Added on Jan 10 2007
6 comments
438 views