Google

Thursday, March 13, 2008

How to Enable JFileChooser in Java Web Start

To enable JFileChooser to open the local HDD via Java Web Start, you will need to Self-Sign your Jar files:





To enable JFileChooser:

import javax.swing.JFileChooser;

public void openFile() {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(
JFileChooser.FILES_AND_DIRECTORIES );


int result = fileChooser.showOpenDialog( null );

}

Note that fileChooser.showOpenDialog( null );

param must be null because you need to open the dialogbox in a separate window like this: