Python javax.swing.JFileChooser() Examples
The following are 9
code examples of javax.swing.JFileChooser().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
javax.swing
, or try the search function
.
Example #1
Source File: BurpImporter.py From Burp-Importer with BSD 3-Clause "New" or "Revised" License | 6 votes |
def loadFile(self, e): chooseFile = swing.JFileChooser() fileDialog = chooseFile.showDialog(self.tab, "Choose file") if fileDialog == swing.JFileChooser.APPROVE_OPTION: file = chooseFile.getSelectedFile() filename = file.getCanonicalPath() fileExtension = os.path.splitext(filename)[1] try: loadedFile = open(filename, "r") except IOError as e: print "Error reading file.\n" + str(e) self.logArea.append('\nError reading File: %s' % filename) if fileExtension == '.gnmap': self.nmap(loadedFile) elif fileExtension == '.nessus': self.nessus(loadedFile) elif fileExtension == '.txt': self.plaintext(loadedFile) else: print '\nFile %s was read but does not have the correct extension (.gnmap, .nessus, .txt).' % filename self.logArea.append('\nFile %s was read but does not have the correct extension (.gnmap, .nessus, .txt).' % filename)
Example #2
Source File: HeadersAnalyzer.py From HeadersAnalyzer with BSD 3-Clause "New" or "Revised" License | 6 votes |
def load(self, e): chooseFile = swing.JFileChooser() ret = chooseFile.showDialog(self.tab, "Choose file") if ret == swing.JFileChooser.APPROVE_OPTION: file = chooseFile.getSelectedFile() filename = file.getCanonicalPath() try: f = open(filename, "r") text = f.readlines() if text: text = [line for line in text if not line.isspace()] text = [line.rstrip('\n') for line in text] self.boringHeadersList.setListData(text) except IOError as e: print "Error reading file.\n" + str(e)
Example #3
Source File: SQLiPy.py From sqlipy with The Unlicense | 5 votes |
def setAPI(self, e): selectFile = swing.JFileChooser() filter = swing.filechooser.FileNameExtensionFilter("python files", ["py"]) selectFile.addChoosableFileFilter(filter) returnedFile = selectFile.showDialog(self._jPanel, "SQLMap API") if returnedFile == swing.JFileChooser.APPROVE_OPTION: file = selectFile.getSelectedFile() self.apifile = file.getPath() print 'Selected API at ' + file.getPath() self._jLabelAPI.setText('API set to: ' + file.getPath())
Example #4
Source File: SQLiPy.py From sqlipy with The Unlicense | 5 votes |
def setPython(self, e): selectFile = swing.JFileChooser() returnedFile = selectFile.showDialog(self._jPanel, "Python EXE") if returnedFile == swing.JFileChooser.APPROVE_OPTION: file = selectFile.getSelectedFile() self.pythonfile = file.getPath() print 'Selected Python at ' + file.getPath() self._jLabelPython.setText('Python set to: ' + file.getPath())
Example #5
Source File: TomcatBrute.py From TomcatBrute with The Unlicense | 5 votes |
def _tomcatLoadUsersFunc(self, event): chooser = swing.JFileChooser() chooser.showOpenDialog(self._tomcatMainPanel) filePathName = '' try: if(chooser.getSelectedFile()) is not None: filePathName += (str(chooser.getSelectedFile()).replace('\\', '/')) self._tomcatMainUname.setText(filePathName.strip()) except: print 'Open User File Error'
Example #6
Source File: TomcatBrute.py From TomcatBrute with The Unlicense | 5 votes |
def _tomcatLoadPwdsDicts(self, event): chooser = swing.JFileChooser() chooser.showOpenDialog(self._tomcatMainPanel) filePathName = '' try: if(chooser.getSelectedFile()) is not None: filePathName += (str(chooser.getSelectedFile()).replace('\\', '/')) self._tomcatMainPwd.setText(filePathName.strip()) except: print 'Open Pwd File Error'
Example #7
Source File: identitycrisis.py From Identity-Crisis with MIT License | 5 votes |
def choose_file(self, event): chooseFile = JFileChooser() chooseFile.showOpenDialog(None) chosenFile = chooseFile.getSelectedFile() return str(chosenFile)
Example #8
Source File: FransLinkfinder.py From BurpJSLinkFinder with MIT License | 5 votes |
def exportLog(self, event): chooseFile = JFileChooser() ret = chooseFile.showDialog(self.logPane, "Choose file") filename = chooseFile.getSelectedFile().getCanonicalPath() print("\n" + "Export to : " + filename) open(filename, 'w', 0).write(self.outputTxtArea.text)
Example #9
Source File: FransLinkfinder.py From BurpJSLinkFinder with MIT License | 3 votes |
def initUI(self): self.tab = swing.JPanel() # UI for Output self.outputLabel = swing.JLabel("LinkFinder Log:") self.outputLabel.setFont(Font("Tahoma", Font.BOLD, 14)) self.outputLabel.setForeground(Color(255,102,52)) self.logPane = swing.JScrollPane() self.outputTxtArea = swing.JTextArea() self.outputTxtArea.setFont(Font("Consolas", Font.PLAIN, 12)) self.outputTxtArea.setLineWrap(True) self.logPane.setViewportView(self.outputTxtArea) self.clearBtn = swing.JButton("Clear Log", actionPerformed=self.clearLog) self.exportBtn = swing.JButton("Export Log", actionPerformed=self.exportLog) self.parentFrm = swing.JFileChooser() # Layout layout = swing.GroupLayout(self.tab) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) self.tab.setLayout(layout) layout.setHorizontalGroup( layout.createParallelGroup() .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(self.outputLabel) .addComponent(self.logPane) .addComponent(self.clearBtn) .addComponent(self.exportBtn) ) ) ) layout.setVerticalGroup( layout.createParallelGroup() .addGroup(layout.createParallelGroup() .addGroup(layout.createSequentialGroup() .addComponent(self.outputLabel) .addComponent(self.logPane) .addComponent(self.clearBtn) .addComponent(self.exportBtn) ) ) )