本文整理汇总了Python中javax.swing.JFileChooser.getSelectedFiles方法的典型用法代码示例。如果您正苦于以下问题:Python JFileChooser.getSelectedFiles方法的具体用法?Python JFileChooser.getSelectedFiles怎么用?Python JFileChooser.getSelectedFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFileChooser
的用法示例。
在下文中一共展示了JFileChooser.getSelectedFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MultiFileDialog
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import getSelectedFiles [as 别名]
def MultiFileDialog(title):
#hide/show debug prints
verbose = 0
# Choose image file(s) to open
fc = JFileChooser()
fc.setMultiSelectionEnabled(True)
fc.setDialogTitle(title)
sdir = OpenDialog.getDefaultDirectory()
if sdir!=None:
fdir = File(sdir)
if fdir!=None:
fc.setCurrentDirectory(fdir)
returnVal = fc.showOpenDialog(IJ.getInstance())
if returnVal!=JFileChooser.APPROVE_OPTION:
return
files = fc.getSelectedFiles()
paths = []
for i in range(len(files)):
paths.append(os.path.join(files[i].getParent(), files[i].getName()))
if verbose > 0:
for i in range(len(files)):
path = os.path.join(files[i].getParent(), files[i].getName())
print "Path: " + path
return paths
示例2: actionPerformed
# 需要导入模块: from javax.swing import JFileChooser [as 别名]
# 或者: from javax.swing.JFileChooser import getSelectedFiles [as 别名]
def actionPerformed(self, actionEvent):
global yara_rules
global yara_path
if actionEvent.getSource() is self.menuItem:
yara_path = self._yara_exe_txtField.getText()
yara_rules = self._yara_rules_files
t = Thread(self)
t.start()
elif actionEvent.getSource() is self._yara_clear_button:
# Delete the LogEntry objects from the log
row = self._log.size()
self._lock.acquire()
self._log.clear()
# Update the Table
self.fireTableRowsDeleted(0, row)
# Clear data regarding any selected LogEntry objects from the request / response viewers
self._requestViewer.setMessage([], True)
self._responseViewer.setMessage([], False)
self._currentlyDisplayedItem = None
self._lock.release()
elif actionEvent.getSource() is self._yara_rules_select_files_button:
fileChooser = JFileChooser()
yarFilter = FileNameExtensionFilter("Yara Rules", ["yar"])
fileChooser.addChoosableFileFilter(yarFilter)
fileChooser.setFileFilter(yarFilter)
fileChooser.setMultiSelectionEnabled(True)
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY)
ret = fileChooser.showOpenDialog(None)
if ret == JFileChooser.APPROVE_OPTION:
self._yara_rules_files.clear()
for file in fileChooser.getSelectedFiles():
self._yara_rules_files.add(file.getPath())
self._yara_rules_fileList.setListData(self._yara_rules_files)
else:
stdout.println("Unknown Event Received.")