Me n My Programming

If Only I Have TIme

Marama Code 111 ~ How to create Open File Dialog

You can read the full example that I followed here: Link1

FileDialog fd = new FileDialog(s, SWT.OPEN); // open the file dialog
fd.setText(title); // set the dialog tittle
fd.setFilterPath(defDir); // get the current path
String[] filterExt =  { “*.txt”, “*.doc”, “.rtf”, “*.*” }; // filter what you want to open
fd.setFilterExtensions(filterExt);
String selected = fd.open(); // get the file path

System.out.println(selected);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on August 26, 2010 by in Java, Life on Marama.
%d bloggers like this: