XML Feeds

.

[java-dev] Open Dialog is worthless

Matthew Aidekman puuukeey at comcast.net
Tue Feb 26 20:37:29 MST 2008


The included code for bringing up a file chooser appears to crash max unless housed in a ...

new Runnable(){but my stuff here}

...type of deally.  Unfortunately it seems that if you house it in a runnable, anything it reads (that is the point of a file chooser) can't be shared with the rest of the program since it's on a different thread.

Has anyone else successfully read a file selected by a filechooser into their mxj?





		String initialPath = ".";
		String selectedPathname = null;
		JFileChooser openDialog = new JFileChooser();
		openDialog.setSelectedFile( new File(initialPath) );
		int openResult = openDialog.showOpenDialog(null);
		
		if(openResult == JFileChooser.APPROVE_OPTION)
		{
			selectedPathname = openDialog.getSelectedFile().getPath();
			System.out.println(selectedPathname);
		}


More information about the java-dev mailing list