def __init__(self, frame, what, entries, pingFun): JDialog(frame, what) self.frame = frame self.entries = entries self.pingFun = pingFun pane = self.getRootPane().getContentPane() self.ent_pane, self.ent_list, self.ent = self.createList(entries) pane.add(self.ent_pane, BorderLayout.WEST) actionPanel = JPanel() actionPanel.setLayout(GridLayout(20, 1)) self.text = JTextField(20) actionPanel.add(self.text) change = JButton('Change') change.setActionCommand('Change') change.addActionListener(self) actionPanel.add(change) actionPanel.add(JLabel('')) quit = JButton('Exit') quit.setActionCommand('Exit') quit.addActionListener(self) actionPanel.add(quit) actionPanel.add(JLabel('')) pane.add(actionPanel, BorderLayout.CENTER) self.pack()
def initUI(self): self.tab = JPanel() # UI for Output self.outputLabel = JLabel("AutoRecon Log:") self.outputLabel.setFont(Font("Tahoma", Font.BOLD, 14)) self.outputLabel.setForeground(Color(255, 102, 52)) self.logPane = JScrollPane() self.outputTxtArea = JTextArea() self.outputTxtArea.setFont(Font("Consolas", Font.PLAIN, 12)) self.outputTxtArea.setLineWrap(True) self.logPane.setViewportView(self.outputTxtArea) self.clearBtn = JButton("Clear Log", actionPerformed=self.clearLog) self.exportBtn = JButton("Export Log", actionPerformed=self.exportLog) self.parentFrm = JFileChooser() # Layout layout = 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))))
def registerExtenderCallbacks(self, callbacks): self.callbacks = callbacks self.helpers = callbacks.getHelpers() self.callbacks.setExtensionName("KkMultiProxy") self.PROXY_LIST = [] self.jPanel = JPanel() boxVertical = Box.createVerticalBox() boxHorizontal = Box.createHorizontalBox() boxHorizontal.add(JButton("File", actionPerformed=self.getFile)) self.FileText = JTextField("") boxHorizontal.add(self.FileText) boxVertical.add(boxHorizontal) TableHeader = ('IP', 'PORT') TableModel = DefaultTableModel(self.PROXY_LIST, TableHeader) self.Table = JTable(TableModel) boxVertical.add(self.Table) boxHorizontal = Box.createHorizontalBox() boxHorizontal.add(JButton("Add", actionPerformed=self.addIP)) boxHorizontal.add(JButton("Delete", actionPerformed=self.deleteIP)) boxHorizontal.add(JButton("Save", actionPerformed=self.saveIP)) boxVertical.add(boxHorizontal) self.jPanel.add(boxVertical) self.callbacks.addSuiteTab(self) self.callbacks.registerHttpListener(self) return
def set_settings(self): self.settings = JPanel() layout = GroupLayout(self.settings) self.settings.setLayout(layout) layout.setAutoCreateGaps(True) load_file_button = JButton("Load JSON File") load_file_button.setActionCommand("load") load_file_button.addActionListener(SettingsAction(self, load_file_button, None)) save_file_button = JButton("Save JSON File") save_file_button.setActionCommand("save") save_file_button.addActionListener(SettingsAction(None, save_file_button, self.tabbed_panes)) horizontal_group1 = layout.createParallelGroup(GroupLayout.Alignment.LEADING) horizontal_group1.addComponent(load_file_button) horizontal_group1.addComponent(save_file_button) horizontal_group = layout.createSequentialGroup() horizontal_group.addGroup(horizontal_group1) layout.setHorizontalGroup(horizontal_group) vertical_group1 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE) vertical_group1.addComponent(load_file_button) vertical_group2 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE) vertical_group2.addComponent(save_file_button) vertical_group = layout.createSequentialGroup() vertical_group.addGroup(vertical_group1) vertical_group.addGroup(vertical_group2) layout.setVerticalGroup(vertical_group)
def addLine(self, objectID, category, text): """ Add a new panel containing the text corresponding to one line in the ATF file. This panel will show the line type (ruling, comment, text, translation...), followed by the line content and a group of icons to add, edit or remove the line. """ linePanel = JPanel() linePanel.setLayout(BorderLayout()) label = JLabel(category) combo = JComboBox(text) combo.setEditable(True) combo.setPreferredSize(Dimension(500, 20)) combo.setSize(combo.getPreferredSize()) combo.setMinimumSize(combo.getPreferredSize()) combo.setMaximumSize(combo.getPreferredSize()) buttonsPanel = JPanel() addButton = JButton("Add") editButton = JButton("Edit") deleteButton = JButton("Delete") buttonsPanel.add(addButton) buttonsPanel.add(editButton) buttonsPanel.add(deleteButton) linePanel.add(label, BorderLayout.WEST) linePanel.add(combo, BorderLayout.CENTER) linePanel.add(buttonsPanel, BorderLayout.EAST) # Add metadataPanel to object tab in main panel self.objectTabs[objectID].add(linePanel)
def run( self ) : frame = JFrame( 'BorderLayout', layout = BorderLayout(), defaultCloseOperation = JFrame.EXIT_ON_CLOSE ) data = [ [ 'PAGE_START', BorderLayout.PAGE_START ], [ 'PAGE_END' , BorderLayout.PAGE_END ], [ 'LINE_START', BorderLayout.LINE_START ], [ 'LINE_END' , BorderLayout.LINE_END ], ] for name, pos in data : frame.add( JButton( name ), pos ) big = JButton( 'CENTER', preferredSize = Dimension( 256, 128 ) ) frame.add( big, BorderLayout.CENTER ) frame.pack() frame.setVisible( 1 )
def changePasswordForm(check): global frame global tfOldPassword global tfNewPassword global tfConfirmPassword global value value = check frame = JFrame("Change Password") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500, 350) frame.setLocation(200, 200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500, 350) panel.setLocation(0, 0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel("Change Password") heading.setBounds(200, 30, 150, 40) lbOldPassword = JLabel("Old Password") lbNewPassword = JLabel("New Password") lbConfirmPassword = JLabel("Confirm Password") tfOldPassword = JTextField() tfNewPassword = JTextField() tfConfirmPassword = JTextField() lbOldPassword.setBounds(50, 100, 150, 30) lbNewPassword.setBounds(50, 150, 150, 30) lbConfirmPassword.setBounds(50, 200, 150, 30) tfOldPassword.setBounds(220, 100, 150, 30) tfNewPassword.setBounds(220, 150, 150, 30) tfConfirmPassword.setBounds(220, 200, 150, 30) btnSave = JButton("Save", actionPerformed=clickSave) btnCancel = JButton("Cancel", actionPerformed=clickCancel) btnSave.setBounds(350, 280, 100, 30) btnCancel.setBounds(50, 280, 100, 30) panel.add(heading) panel.add(lbOldPassword) panel.add(lbNewPassword) panel.add(lbConfirmPassword) panel.add(tfOldPassword) panel.add(tfNewPassword) panel.add(tfConfirmPassword) panel.add(btnSave) panel.add(btnCancel) frame.add(panel)
def __init__(self): # constructor #origing of coordinates self.coordx = 10 self.coordy = 10 #inintialize values self.Canvas = None #create panel (what is inside the GUI) self.panel = self.getContentPane() self.panel.setLayout(GridLayout(9, 2)) self.setTitle('Subdividing ROIs') #define buttons here: self.Dapi_files = DefaultListModel() mylist = JList(self.Dapi_files, valueChanged=self.open_dapi_image) #mylist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); mylist.setLayoutOrientation(JList.VERTICAL) mylist.setVisibleRowCount(-1) listScroller1 = JScrollPane(mylist) listScroller1.setPreferredSize(Dimension(300, 80)) self.output_files = DefaultListModel() mylist2 = JList(self.output_files) #mylist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); mylist2.setLayoutOrientation(JList.VERTICAL) mylist2.setVisibleRowCount(-1) listScroller2 = JScrollPane(mylist2) listScroller2.setPreferredSize(Dimension(300, 80)) quitButton = JButton("Quit", actionPerformed=self.quit) selectInputFolderButton = JButton("Select Input", actionPerformed=self.select_input) cubifyROIButton = JButton("Cubify ROI", actionPerformed=self.cubify_ROI) saveButton = JButton("Save ROIs", actionPerformed=self.save) summsaveButton = JButton("Save Summary", actionPerformed=self.save_summary) self.textfield1 = JTextField('500') #add buttons here self.panel.add(listScroller1) self.panel.add(listScroller2) self.panel.add(selectInputFolderButton) self.panel.add(Label("Adjust the size of the ROIs")) self.panel.add(self.textfield1) self.panel.add(cubifyROIButton) self.panel.add(saveButton) self.panel.add(summsaveButton) self.panel.add(quitButton) #self.panel.add(saveButton) #self.panel.add(Zslider) #other stuff to improve the look self.pack() # packs the frame self.setVisible(True) # shows the JFrame self.setLocation(self.coordx, self.coordy)
def run(self): frame = JFrame('SplitPane1', defaultCloseOperation=JFrame.EXIT_ON_CLOSE) frame.add( JSplitPane(JSplitPane.HORIZONTAL_SPLIT, JButton('Left'), JButton('Right'))) frame.pack() frame.setVisible(1)
def __init__(self): self.setName('Jython Floating') self.setLayout(GridLayout(-1, 1)) self.add(JButton('Action 1')) self.add(JButton('Action 2')) self.add(JButton('Action 3')) self.setLocation(200, 200) self.setSize(100, 100)
def run(self): frame = JFrame('SplitPane2', defaultCloseOperation=JFrame.EXIT_ON_CLOSE) frame.add( JSplitPane(JSplitPane.VERTICAL_SPLIT, JButton('Top'), JButton('Bottom'))) frame.pack() frame.setVisible(1)
def addCourse(): global tfCourseName global tfCourseId global tfCourseFee global frame global btnEnter frame = JFrame("Add Course ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(450, 450) frame.setLocation(200, 200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(450, 450) panel.setLocation(0, 0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel("ADD COURSE") heading.setBounds(200, 30, 150, 40) lbCourseName = JLabel("Course Name ") lbCourseId = JLabel("Course Id") lbCourseFee = JLabel(" Course Fee") tfCourseName = JTextField() tfCourseId = JTextField() tfCourseFee = JTextField() lbCourseName.setBounds(70, 120, 130, 30) lbCourseId.setBounds(70, 170, 130, 30) lbCourseFee.setBounds(70, 220, 130, 30) tfCourseName.setBounds(220, 120, 150, 30) tfCourseId.setBounds(220, 170, 150, 30) tfCourseFee.setBounds(220, 220, 150, 30) btnEnter = JButton("Enter", actionPerformed=clickAddCourseFee) btnEnter.setBounds(300, 300, 100, 40) btnCancel = JButton("Cancel", actionPerformed=clickCancel) btnCancel.setBounds(70, 300, 100, 40) panel.add(heading) panel.add(lbCourseName) panel.add(lbCourseId) panel.add(lbCourseFee) panel.add(tfCourseFee) panel.add(tfCourseName) panel.add(tfCourseId) panel.add(tfCourseFee) panel.add(btnEnter) panel.add(btnCancel) frame.add(panel)
def __init__(self): super(BeautifierPanel, self).__init__() self.setLayout(BorderLayout()) self.beautifyTextArea = JTextArea(5, 10) self.beautifyTextArea.setLineWrap(True) self.beautifyTextArea.setDocument(self.CustomUndoPlainDocument()) # The undo doesn't work well before replace text. Below is rough fix, so not need to know how undo work for now self.beautifyTextArea.setText(" ") self.beautifyTextArea.setText("") self.undoManager = UndoManager() self.beautifyTextArea.getDocument().addUndoableEditListener( self.undoManager) self.beautifyTextArea.getDocument().addDocumentListener( self.BeautifyDocumentListener(self)) beautifyTextWrapper = JPanel(BorderLayout()) beautifyScrollPane = JScrollPane(self.beautifyTextArea) beautifyTextWrapper.add(beautifyScrollPane, BorderLayout.CENTER) self.add(beautifyTextWrapper, BorderLayout.CENTER) self.beautifyButton = JButton("Beautify") self.beautifyButton.addActionListener(self.beautifyListener) self.undoButton = JButton("Undo") self.undoButton.addActionListener(self.undoListener) formatLabel = JLabel("Format:") self.formatsComboBox = JComboBox() for f in supportedFormats: self.formatsComboBox.addItem(f) self.statusLabel = JLabel("Status: Ready") preferredDimension = self.statusLabel.getPreferredSize() self.statusLabel.setPreferredSize( Dimension(preferredDimension.width + 20, preferredDimension.height)) self.sizeLabel = JLabel("0 B") preferredDimension = self.sizeLabel.getPreferredSize() self.sizeLabel.setPreferredSize( Dimension(preferredDimension.width + 64, preferredDimension.height)) self.sizeLabel.setHorizontalAlignment(SwingConstants.RIGHT) buttonsPanel = JPanel(FlowLayout()) buttonsPanel.add(formatLabel) buttonsPanel.add(self.formatsComboBox) buttonsPanel.add(Box.createHorizontalStrut(10)) buttonsPanel.add(self.beautifyButton) buttonsPanel.add(self.undoButton) bottomPanel = JPanel(BorderLayout()) bottomPanel.add(self.statusLabel, BorderLayout.WEST) bottomPanel.add(buttonsPanel, BorderLayout.CENTER) bottomPanel.add(self.sizeLabel, BorderLayout.EAST) self.add(bottomPanel, BorderLayout.SOUTH) self.currentBeautifyThread = None
def initializeGUI(self): # table panel of scope entries self._url_table = Table(self) table_popup = JPopupMenu(); remove_item_menu = JMenuItem(self._remove_description, actionPerformed=self.removeFromScope) table_popup.add(remove_item_menu) self._url_table.setComponentPopupMenu(table_popup) self._url_table.addMouseListener(TableMouseListener(self._url_table)) scrollPane = JScrollPane(self._url_table) # setting panel ## locate checkboxes ### for constants, see: https://portswigger.net/burp/extender/api/constant-values.html#burp.IBurpExtenderCallbacks.TOOL_PROXY self._checkboxes = { 2: JCheckBox('Target'), 4: JCheckBox('Proxy'), 8: JCheckBox('Spider'), 16: JCheckBox('Scanner'), 32: JCheckBox('Intruder'), 64: JCheckBox('Repeater'), 128: JCheckBox('Sequencer'), 1024: JCheckBox('Extender') } checkboxes_components = {0: dict(zip(range(1,len(self._checkboxes) + 1), self._checkboxes.values()))} self._label_value_regex_now_1 = JLabel("(1) Regex for the value to store: ") self._label_value_regex_now_2 = JLabel("") self._label_value_regex = JLabel("(1) New regex:") self._form_value_regex = JTextField("", 64) self._button_value_regex = JButton('Update', actionPerformed=self.updateTokenSourceRegex) self._label_header_now_1 = JLabel("(2) Header for sending the value: ") self._label_header_now_2 = JLabel("") self._label_header = JLabel("(2) New header key: ") self._form_header = JTextField("", 64) self._button_header = JButton('Update', actionPerformed=self.updateHeaderName) self._label_add_url = JLabel("Add this URL: ") self._form_add_url = JTextField("", 64) self._button_add_url = JButton('Add', actionPerformed=self.addURLDirectly) ## logate regex settings ui_components_for_settings_pane = { 0: { 0: JLabel("Local Settings:") }, 1: { 0: self._label_value_regex_now_1, 1: self._label_value_regex_now_2 }, 2: { 0: self._label_value_regex, 1: self._form_value_regex, 2: self._button_value_regex}, 3: { 0: self._label_header_now_1, 1: self._label_header_now_2 }, 4: { 0: self._label_header, 1: self._form_header, 2: self._button_header}, 5: { 0: {'item': JSeparator(JSeparator.HORIZONTAL), 'width': 3, }}, 6: { 0: JLabel("General Settings:") }, 7: { 0: self._label_add_url, 1: self._form_add_url, 2: self._button_add_url}, 8: { 0: JLabel("Use this extender in:"), 1: {'item': self.compose_ui(checkboxes_components), 'width': 3} } } # build a split panel & set UI component self._splitpane = JSplitPane(JSplitPane.VERTICAL_SPLIT) self._splitpane.setResizeWeight(0.85) self._splitpane.setLeftComponent(scrollPane) self._splitpane.setRightComponent(self.compose_ui(ui_components_for_settings_pane)) self._callbacks.customizeUiComponent(self._splitpane)
def getUiComponent(self): self.HaEPanel = JPanel() self.HaEPanel.setBorder(None) self.HaEPanel.setLayout(BorderLayout(0, 0)) self.panel = JPanel() self.HaEPanel.add(self.panel, BorderLayout.NORTH) self.panel.setLayout(BorderLayout(0, 0)) self.tabbedPane = JTabbedPane(JTabbedPane.TOP) self.panel.add(self.tabbedPane, BorderLayout.CENTER) self.setPanel = JPanel() self.tabbedPane.addTab("Set", None, self.setPanel, None) self.setPanel.setLayout(BorderLayout(0, 0)) self.setPanel_1 = JPanel() self.setPanel.add(self.setPanel_1, BorderLayout.NORTH) self.nameString = JLabel("Name") self.setPanel_1.add(self.nameString) self.nameTextField = JTextField() self.setPanel_1.add(self.nameTextField) self.nameTextField.setColumns(10) self.regexString = JLabel("Regex") self.setPanel_1.add(self.regexString) self.regexTextField = JTextField() self.setPanel_1.add(self.regexTextField) self.regexTextField.setColumns(10) self.extractCheckBox = JCheckBox("Extract") self.setPanel_1.add(self.extractCheckBox) self.highlightCheckBox = JCheckBox("Highlight") self.setPanel_1.add(self.highlightCheckBox) self.setPanel_2 = JPanel() self.setPanel.add(self.setPanel_2) self.colorString = JLabel("Color") self.setPanel_2.add(self.colorString) self.colorTextField = JTextField() self.setPanel_2.add(self.colorTextField) self.colorTextField.setColumns(5) self.addBottun = JButton("Add", actionPerformed=self.addConfig) self.setPanel_2.add(self.addBottun) self.tipString = JLabel("") self.setPanel_2.add(self.tipString) self.configPanel = JPanel() self.tabbedPane.addTab("Config", None, self.configPanel, None) self.configPanel.setLayout(BorderLayout(0, 0)) self.configString = JLabel("This is config file content.") self.configString.setHorizontalAlignment(SwingConstants.CENTER) self.configPanel.add(self.configString, BorderLayout.NORTH) self.configTextArea = JTextArea() self.configTextArea.setEnabled(False) self.configTextArea.setTabSize(4) self.configTextArea.setLineWrap(True) self.configTextArea.setRows(20) self.configPanel.add(self.configTextArea, BorderLayout.SOUTH) self.scrollPane = JScrollPane(self.configTextArea) self.configPanel.add(self.scrollPane, BorderLayout.SOUTH) self.reloadButton = JButton("Reload", actionPerformed=self.reloadConfig) self.configPanel.add(self.reloadButton, BorderLayout.CENTER) return self.HaEPanel
def callBoss(self, event): self.chatWindow = swing.JFrame("Incoming message!") newPanel = JPanel(GridLayout()) self.chatWindow.add(newPanel) newPanel.add(swing.JLabel("New message from The Boss. Accept?")) newPanel.add(JButton("Yes", actionPerformed=self.launchChatIn)) newPanel.add(JButton("No", actionPerformed=self.hide)) self.chatWindow.pack() self.chatWindow.show()
def build_buttons_panel(self): ''' Builds the buttons panel to save or cancel changes. TODO: Reset button to reset to defaults? ''' panel = JPanel(FlowLayout()) panel.add(JButton('Cancel', actionPerformed=self.cancel)) panel.add(JButton('Save', actionPerformed=self.save)) return panel
def make_chf_panel(self): """ chf --> common hseg files """ chf_panel = JPanel() chf_panel.setLayout(MigLayout('insets 0')) chf_files_label = JLabel('Hemisegment cells') chf_files_text = JTextArea( BobGui.archetype_to_str( self.exper.hseg_cell_files_cab().archetype)) chf_panel.add(chf_files_label, 'growx, wrap') chf_panel.add(chf_files_text, 'grow, wrap') chf_files_label = JLabel('Hemisegment binary image files') chf_files_text = JTextArea( BobGui.archetype_to_str(self.exper.hseg_bin_files_cab().archetype)) chf_panel.add(chf_files_label, 'growx, wrap') chf_panel.add(chf_files_text, 'grow, wrap') chf_files_label = JLabel('Intensity Image Files') # chf_files_text = JTextArea(BobGui.archetype_to_str(self.exper.hseg_intens_im_files_cab().archetype)) # print(self.exper.hseg_intens_im_files_cab().archetype) # chf_panel.add(chf_files_label, 'growx, wrap') # chf_panel.add(chf_files_text, 'grow, wrap') self.intens_im_boxes = [] intens_im_panel = JPanel() intens_im_panel.setLayout(MigLayout('insets 0')) for poss_im_file in self.exper.hseg_intens_im_files_cab().archetype: self.intens_im_boxes.append(JCheckBox(poss_im_file)) intens_im_panel.add(self.intens_im_boxes[-1], 'wrap') chf_panel.add(chf_files_label, 'growx, wrap') chf_panel.add(intens_im_panel, 'grow, wrap') mdf_create_button = JButton( 'Create meta_data file from default outline') # mdf_create_button = JButton('<html>Create meta_data file<br>from default outline</html>') mdf_create_button.addActionListener( ActionListenerFactory(self, self.mdf_create_al)) mdf_open_button = JButton('Open existing meta_data file') mdf_open_button.addActionListener( ActionListenerFactory(self, self.mdf_open_al)) # meta_data_file_buttton = JButton('Open/Create meta_data file') # meta_data_file_buttton.addActionListener(ActionListenerFactory(self, self.meta_data_al)) # chf_panel.add(meta_data_file_buttton) chf_panel.add(mdf_create_button, 'wrap') chf_panel.add(mdf_open_button, 'wrap') chf_scroll_pane = JScrollPane() chf_scroll_pane.getViewport().setView(chf_panel) return chf_scroll_pane
def registerExtenderCallbacks(self, callbacks): self.callbacks = callbacks self.helpers = callbacks.getHelpers() callbacks.setExtensionName("WebTech") self.out = callbacks.getStdout() self.callbacks.printOutput("Sucessfully loaded WebTech {}".format(VERSION)) try: self.webtech = WebTech(options={'json': True}) except UpdateInBurpException as e: #self.callbacks.printOutput(e) for db_file in databases: db = self.callbacks.makeHttpRequest( 'raw.githubusercontent.com', # we are hardcoding this since there isn't a nice api for that 443, True, self.helpers.buildHttpRequest(URL(db_file[0])) ); db = db.tostring() save_database_file(db[db.index("\r\n\r\n") + len("\r\n\r\n"):], db_file[1]) self.webtech = WebTech(options={'json': True}) # define all checkboxes self.cbPassiveChecks = self.defineCheckBox("Enable Passive Scanner Checks") self.cbActiveChecks = self.defineCheckBox("Enable Active Scanner Checks", True, False) self.btnSave = JButton("Set as default", actionPerformed=self.saveConfig) self.btnRestore = JButton("Restore", actionPerformed=self.restoreConfig) self.grpConfig = JPanel() self.grpConfig.add(self.btnSave) self.grpConfig.add(self.btnRestore) self.restoreConfig() # definition of config tab self.tab = JPanel() layout = GroupLayout(self.tab) self.tab.setLayout(layout) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) layout.setHorizontalGroup( layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(self.cbPassiveChecks) .addComponent(self.cbActiveChecks) ) .addGroup(layout.createParallelGroup() .addComponent(self.grpConfig, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) ) ) layout.setVerticalGroup( layout.createSequentialGroup() .addComponent(self.cbPassiveChecks) .addComponent(self.cbActiveChecks) .addComponent(self.grpConfig, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) ) callbacks.registerScannerCheck(self) callbacks.addSuiteTab(self)
def __init__(self): # constructor # origing of coordinates self.coordx = 10 self.coordy = 10 # inintialize values self.Canvas = None self.default_naming = 'MouseID_ExperimentalGroup_slide-X' # create panel (what is inside the GUI) self.panel = self.getContentPane() self.panel.setLayout(GridLayout(8, 2)) self.setTitle('Subdividing ROIs') # define buttons here: self.subimage_number = DefaultListModel() mylist = JList(self.subimage_number, valueChanged=self.open_lowres_image) # mylist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); mylist.setLayoutOrientation(JList.VERTICAL) mylist.setVisibleRowCount(1) listScroller1 = JScrollPane(mylist) listScroller1.setPreferredSize(Dimension(200, 90)) quitButton = JButton("Quit", actionPerformed=self.quit) selectInputFolderButton = JButton("Select Input", actionPerformed=self.select_input) cubifyROIButton = JButton("Cubify ROI", actionPerformed=self.cubify_ROI) saveButton = JButton("Save ROIs", actionPerformed=self.save_ROIs) self.textfield1 = JTextField('18') self.textfield2 = JTextField(self.default_naming) self.textfield3 = JTextField('R-Tail') self.textfield4 = JTextField('6, 4, 22.619') self.textfield5 = JTextField('0') # add buttons here self.panel.add(Label("Name your image, or use filename")) self.panel.add(self.textfield2) self.panel.add(selectInputFolderButton) self.panel.add(listScroller1) self.panel.add(Label("Adjust the size of the squared ROIs")) self.panel.add(self.textfield1) self.panel.add(Label("give a name of your hand-drawn ROI")) self.panel.add(self.textfield3) self.panel.add(Label("For ARA: piram, ch, res")) # piramid number (high to low), channel number, final resolution (um/px)")) self.panel.add(self.textfield4) self.panel.add(Label("Piramid to check (0:none; 1:highest)")) self.panel.add(self.textfield5) self.panel.add(cubifyROIButton) self.panel.add(saveButton) self.panel.add(quitButton) # other stuff to improve the look self.pack() # packs the frame self.setVisible(True) # shows the JFrame self.setLocation(self.coordx, self.coordy)
def draw(self): """ init Save/Restore """ exportLabel = JLabel("Export:") exportLabel.setBounds(10, 10, 100, 30) labelFont = exportLabel.getFont() boldFont = Font(labelFont.getFontName(), Font.BOLD, labelFont.getSize()) exportLabel.setFont(boldFont) exportLType = JLabel("File Type:") exportLType.setBounds(10, 50, 100, 30) exportFileTypes = ["HTML", "CSV"] self.exportType = JComboBox(exportFileTypes) self.exportType.setBounds(100, 50, 200, 30) exportES = ["All Statuses", "As table filter", self._extender.BYPASSSED_STR, self._extender.IS_ENFORCED_STR, self._extender.ENFORCED_STR] self.exportES = JComboBox(exportES) self.exportES.setBounds(100, 90, 200, 30) exportLES = JLabel("Statuses:") exportLES.setBounds(10, 90, 100, 30) self.exportButton = JButton("Export", actionPerformed=self.export) self.exportButton.setBounds(390, 50, 100, 30) saveRestoreLabel = JLabel("Save / Restore:") saveRestoreLabel.setBounds(10, 250, 100, 30) saveRestoreLabel.setFont(boldFont) self.saveStateButton = JButton("Save state", actionPerformed=self.saveStateAction) self.saveStateButton.setBounds(10, 200, 100, 30) self.restoreStateButton = JButton("Restore state", actionPerformed=self.restoreStateAction) self.restoreStateButton.setBounds(390, 200, 100, 30) self._extender.exportPnl = JPanel() exportPnl = self._extender.exportPnl exportPnl.setLayout(None) exportPnl.setBounds(0, 0, 1000, 1000) exportPnl.add(exportLabel) exportPnl.add(exportLType) exportPnl.add(self.exportType) exportPnl.add(exportLES) exportPnl.add(self.exportES) exportPnl.add(self.exportButton) exportPnl.add(saveRestoreLabel) exportPnl.add(self.saveStateButton) exportPnl.add(self.restoreStateButton)
def initConfigurationTab(self): # ## init configuration tab # self.prevent304 = JCheckBox("Prevent 304 Not Modified status code") self.prevent304.setBounds(290, 25, 300, 30) self.ignore304 = JCheckBox("Ignore 304/204 status code responses") self.ignore304.setBounds(290, 5, 300, 30) self.ignore304.setSelected(True) self.autoScroll = JCheckBox("Auto Scroll") #self.autoScroll.setBounds(290, 45, 140, 30) self.autoScroll.setBounds(160, 40, 140, 30) self.doUnauthorizedRequest = JCheckBox("Check unauthenticated") self.doUnauthorizedRequest.setBounds(290, 45, 300, 30) self.doUnauthorizedRequest.setSelected(True) startLabel = JLabel("Authorization checks:") startLabel.setBounds(10, 10, 140, 30) self.startButton = JButton("Autorize is off", actionPerformed=self.startOrStop) self.startButton.setBounds(160, 10, 120, 30) self.startButton.setBackground(Color(255, 100, 91, 255)) self.clearButton = JButton("Clear List", actionPerformed=self.clearList) self.clearButton.setBounds(10, 40, 100, 30) self.replaceString = JTextArea("Cookie: Insert=injected; header=here;", 5, 30) self.replaceString.setWrapStyleWord(True) self.replaceString.setLineWrap(True) self.replaceString.setBounds(10, 80, 470, 180) self.filtersTabs = JTabbedPane() self.filtersTabs.addTab("Enforcement Detector", self.EDPnl) self.filtersTabs.addTab("Detector Unauthenticated", self.EDPnlUnauth) self.filtersTabs.addTab("Interception Filters", self.filtersPnl) self.filtersTabs.addTab("Export", self.exportPnl) self.filtersTabs.setBounds(0, 280, 2000, 700) self.pnl = JPanel() self.pnl.setBounds(0, 0, 1000, 1000) self.pnl.setLayout(None) self.pnl.add(self.startButton) self.pnl.add(self.clearButton) self.pnl.add(self.replaceString) self.pnl.add(startLabel) self.pnl.add(self.autoScroll) self.pnl.add(self.ignore304) self.pnl.add(self.prevent304) self.pnl.add(self.doUnauthorizedRequest) self.pnl.add(self.filtersTabs)
def getUiComponent(self): self.spePanel = JPanel() self.spePanel.setBorder(None) self.spePanel.setLayout(None) self.logPane = JScrollPane() self.outputTxtArea = JTextArea() self.outputTxtArea.setFont(Font("Consolas", Font.PLAIN, 12)) self.outputTxtArea.setLineWrap(True) self.logPane.setViewportView(self.outputTxtArea) self.spePanel.add(self.logPane) self.clearBtn = JButton("Clear", actionPerformed=self.clearRst) self.exportBtn = JButton("Export", actionPerformed=self.exportRst) self.parentFrm = JFileChooser() self.spePanel.add(self.clearBtn) self.spePanel.add(self.exportBtn) self.logPane.setBounds(20, 50, 800, 600) self.clearBtn.setBounds(20, 650, 100, 30) self.exportBtn.setBounds(600, 650, 100, 30) self.sensitiveParamsRegularListPanel = JList(self.sensitiveParamR) self.sensitiveParamsRegularListPanel.setVisibleRowCount( len(self.sensitiveParamR)) #self.spePanel.add(self.sensitiveParamsRegularListPanel) #self.sensitiveParamsRegularListPanel.setBounds(850,50,150,600) self.sensitiveParamsRegularListScrollPanel = JScrollPane() self.sensitiveParamsRegularListScrollPanel.setViewportView( self.sensitiveParamsRegularListPanel) self.spePanel.add(self.sensitiveParamsRegularListScrollPanel) self.sensitiveParamsRegularListScrollPanel.setBounds(850, 50, 150, 600) self.addAndSaveNewParamRegularButton = JButton( 'add&&save', actionPerformed=self.addAndSaveNewParamRegular) self.spePanel.add(self.addAndSaveNewParamRegularButton) self.addAndSaveNewParamRegularButton.setBounds(1000, 50, 150, 30) self.addAndSaveNewParamRegularTextField = JTextField('NewParamRegular') self.spePanel.add(self.addAndSaveNewParamRegularTextField) self.addAndSaveNewParamRegularTextField.setBounds(1150, 50, 100, 30) self.alertSaveSuccess = JOptionPane() self.spePanel.add(self.alertSaveSuccess) self.delParamRegularButton = JButton( "delete", actionPerformed=self.delParamRegular) self.spePanel.add(self.delParamRegularButton) self.delParamRegularButton.setBounds(1000, 90, 100, 30) return self.spePanel
def run(self): self.frame = frame = JFrame('SimpleDialog', size=(250, 100), layout=GridLayout(0, 2), locationRelativeTo=None, defaultCloseOperation=JFrame.EXIT_ON_CLOSE) frame.add(JButton('Modal', actionPerformed=self.makeDialog)) frame.add(JButton('non-Modal', actionPerformed=self.makeDialog)) self.boxNum = 0 frame.setVisible(1)
def __init__(self): self.frame = JFrame('StopWatch', defaultCloseOperation=JFrame.EXIT_ON_CLOSE) self.start = JButton('Start', actionPerformed=self.start) self.frame.add(self.start, BorderLayout.WEST) self.stop = JButton('Stop', actionPerformed=self.stop) self.frame.add(self.stop, BorderLayout.EAST) self.label = JLabel(' ' * 45) self.frame.add(self.label, BorderLayout.SOUTH) self.frame.pack()
def tab_ui(self): self.panel = JPanel() self.panel.setLayout(None) self.ui_client_dnslog_label_1 = JLabel('-' * 10 + u' IP伪造请求头 & DNSLog 配置 ' + '-' * 155) self.ui_client_dnslog_label_1.setBounds(20, 10, 1000, 28) self.ui_client_ip_label_1 = JLabel(u'伪造IP: ') self.ui_client_ip_label_1.setBounds(20, 40, 70, 30) self.ui_client_ip = JTextField('127.0.0.1') self.ui_client_ip.setBounds(80, 40, 200, 28) self.ui_client_url_label_1 = JLabel(u'dnslog url: ') self.ui_client_url_label_1.setBounds(10, 80, 70, 30) self.ui_client_url = JTextField('http://examlpe.com') self.ui_client_url.setBounds(80, 80, 200, 28) self.ui_button_label = JLabel('-' * 210) self.ui_button_label.setBounds(20, 110, 1000, 28) #self.ui_web_test_button = JButton(u'登录测试', actionPerformed=self.login_test) #self.ui_web_test_button.setBounds(20, 140, 100, 28) self.ui_save_button = JButton(u'保存配置', actionPerformed=self.save_configuration) self.ui_save_button.setBounds(20, 140, 100, 28) self.ui_debug_button = JButton('Debug', actionPerformed=self.debug_fun) self.ui_debug_button.setBounds(135, 140, 100, 28) self.panel.add(self.ui_debug_button) self.ui_log_box = JTextArea('') self.ui_log_box.setLineWrap(True) self.ui_log_box.setEditable(False) self.ui_log_scroll_pane = JScrollPane(self.ui_log_box) self.ui_log_scroll_pane.setBounds(20, 190, self.log_box_width, self.log_box_height) self.panel.add(self.ui_client_dnslog_label_1) self.panel.add(self.ui_client_ip_label_1) self.panel.add(self.ui_client_ip) self.panel.add(self.ui_client_url_label_1) self.panel.add(self.ui_client_url) self.panel.add(self.ui_button_label) #self.panel.add(self.ui_web_test_button) self.panel.add(self.ui_save_button) self.panel.add(self.ui_log_scroll_pane) self.tools.panel = self.panel self.tools.log_box = self.ui_log_box self.tools.log_scroll_pane = self.ui_log_scroll_pane
def buildpane(self): buttons = JPanel(FlowLayout(), doublebuffered) buttons.add(JButton("Send Message", actionPerformed=self.message)) buttons.add(JButton("Add Contact", actionPerformed=self.addContact)) #buttons.add(JButton("Quit", actionPerformed=self.quit)) mainpane = self.mainframe.getContentPane() mainpane.setLayout(BoxLayout(mainpane, BoxLayout.Y_AXIS)) mainpane.add(JScrollPane(self.table)) mainpane.add(buttons) self.update()
def __init__(self): self.running = True menuBar = JMenuBar() menu = JMenu("File") menu.add(OpenAction(self)) menu.add(CloseAction(self)) menu.addSeparator() menu.add(QuitAction(self)) self.addWindowListener(ProfelisWindowAdapter(self)) menuBar.add(menu) self.setJMenuBar(menuBar) self.contentPane = JPanel() self.contentPane.layout = GridBagLayout() constraints = GridBagConstraints() self.blastLocation = JTextField( System.getProperty("user.home") + "/blast") self.databaseLocation = JTextField( System.getProperty("user.home") + "/blast/db") self.projects = JTabbedPane() constraints.gridx, constraints.gridy = 0, 0 constraints.gridwidth, constraints.gridheight = 1, 1 constraints.fill = GridBagConstraints.NONE constraints.weightx, constraints.weighty = 0, 0 self.contentPane.add(JLabel("Blast Location"), constraints) constraints.gridx, constraints.gridy = 1, 0 constraints.fill = GridBagConstraints.HORIZONTAL constraints.weightx, constraints.weighty = 1, 0 self.contentPane.add(self.blastLocation, constraints) constraints.gridx, constraints.gridy = 2, 0 constraints.fill = GridBagConstraints.NONE constraints.weightx, constraints.weighty = 0, 0 self.contentPane.add(JButton(BlastAction(self)), constraints) constraints.gridx, constraints.gridy = 3, 0 constraints.fill = GridBagConstraints.NONE constraints.weightx, constraints.weighty = 0, 0 self.contentPane.add(JLabel("Database Location"), constraints) constraints.gridx, constraints.gridy = 4, 0 constraints.fill = GridBagConstraints.HORIZONTAL constraints.weightx, constraints.weighty = 1, 0 self.contentPane.add(self.databaseLocation, constraints) constraints.gridx, constraints.gridy = 5, 0 constraints.fill = GridBagConstraints.NONE constraints.weightx, constraints.weighty = 0, 0 self.contentPane.add(JButton(DatabaseAction(self)), constraints) constraints.gridx, constraints.gridy = 0, 1 constraints.gridwidth, constraints.gridheight = 6, 1 constraints.fill = GridBagConstraints.BOTH constraints.weightx, constraints.weighty = 1, 1 self.contentPane.add(self.projects, constraints)
def buildpane(self): buttons = JPanel(doublebuffered) buttons.add(JButton("Send", actionPerformed=self.send)) buttons.add(JButton("Hide", actionPerformed=self.hidewindow)) mainpane = self.mainframe.getContentPane() mainpane.setLayout(BoxLayout(mainpane, BoxLayout.Y_AXIS)) mainpane.add(JScrollPane(self.display)) self.typepad.actionPerformed = self.send mainpane.add(self.typepad) mainpane.add(buttons)
def initUI(self): self.panel = JPanel(size=(50, 50)) self.panel.setLayout(FlowLayout()) self.panel.setToolTipText("GPU Demo") self.textfield1 = JTextField('Smoothing Parameter', 15) self.panel.add(self.textfield1) joclButton = JButton("JOCL", actionPerformed=self.onJocl) joclButton.setBounds(100, 500, 100, 30) joclButton.setToolTipText("JOCL Button") self.panel.add(joclButton) javaButton = JButton("Java", actionPerformed=self.onJava) javaButton.setBounds(100, 500, 100, 30) javaButton.setToolTipText("Java Button") self.panel.add(javaButton) qButton = JButton("Quit", actionPerformed=self.onQuit) qButton.setBounds(200, 500, 80, 30) qButton.setToolTipText("Quit Button") self.panel.add(qButton) newImage = ImageIO.read(io.File("input.png")) resizedImage = newImage.getScaledInstance(600, 600, 10) newIcon = ImageIcon(resizedImage) label1 = JLabel("Input Image", newIcon, JLabel.CENTER) label1.setVerticalTextPosition(JLabel.TOP) label1.setHorizontalTextPosition(JLabel.RIGHT) label1.setSize(10, 10) label1.setBackground(Color.orange) self.panel.add(label1) self.getContentPane().add(self.panel) self.clockLabel = JLabel() self.clockLabel.setSize(1, 1) self.clockLabel.setBackground(Color.orange) self.clockLabel.setVerticalTextPosition(JLabel.BOTTOM) self.clockLabel.setHorizontalTextPosition(JLabel.LEFT) myClockFont = Font("Serif", Font.PLAIN, 50) self.clockLabel.setFont(myClockFont) self.panel.add(self.clockLabel) self.setTitle("GPU Demo") self.setSize(1200, 600) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True)