help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: uigetfile


From: schnumbl
Subject: Re: uigetfile
Date: Mon, 8 Nov 2010 03:09:28 -0800 (PST)

Here is another approch using the octave java package:

function [filename filepath] =uigetfile(titlestr, defaultpathstr)

 %FileChooser doc:
http://download.oracle.com/javase/1.4.2/docs/api/javax/swing/JFileChooser.html
 %File doc:
http://download.oracle.com/javase/1.4.2/docs/api/java/io/File.html
 %JFileFilter doc:
http://www.lamatek.com/lamasoft/javadocs/swingextras/com/lamatek/util/JFileFilter.html

 %load octave java package
 pkg load java;
 
 %create java File Chooser
 FileChooser = java_new('javax.swing.JFileChooser',defaultpathstr);
 FileChooser.setDialogTitle(titlestr);

 %%include additional java classes
 %javajarpath="C:\\Programme\\Java\\jre6\\lib\\rt.jar";
 %javaaddpath("C:\\Programme\\Java\\jre6\\lib\\rt.jar");
 %javaaddpath("C:\\SwingExtras.jar"); %http://www.lamatek.com/lamasoft/
 
 %%define a JFileFilter
  %JFileFilter = java_new('com.lamatek.util.JFileFilter',"Octave Files
","m");
        %FileChooser.setFileFilter(JFileFilter);
  
 %show Dialog
 FileChooser.showOpenDialog([]);
 
 %get file information
 File = FileChooser.getSelectedFile(); 
 filename = File.getName();
 filepath = File.getPath();
end
-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/uigetfile-tp1899460p3031784.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]