def __init__(self): super(AboutDialog, self).__init__() # Open the files and build a tab pane self.tabbedPane = tabs = JTabbedPane() for title, path in self.INFO_FILES: textPane = JTextPane() textPane.editable = False scrollPane = JScrollPane(textPane) scrollPane.preferredSize = (32767, 32767) # just a large number with open(path, 'r') as fd: infoText = fd.read().decode('utf8') textPane.text = infoText textPane.caretPosition = 0 tabs.addTab(title, scrollPane) # Load this tabbed pane into the layout self.add(tabs, BorderLayout.CENTER) # Add a label at the top versionLabel = JLabel(JESVersion.TITLE + " version " + JESVersion.RELEASE) versionLabel.alignmentX = Component.CENTER_ALIGNMENT versionPanel = JPanel() versionPanel.add(versionLabel) self.add(versionPanel, BorderLayout.PAGE_START) # Make an OK button self.okButton = JButton(self.ok) self.buttonPanel.add(self.okButton)
def __init__(self, controller): ''' Creates default empty text area in a panel. It will contain the ATF file content, and allow text edition. It should highlight reserved words and suggest autocompletion or possible typos, a la IDEs like Eclipse. It might need refactoring so that there is a parent panel with two modes or contexts, depending on user choice: text view or model view. ''' #Give reference to controller to delegate action response self.controller = controller #Make text area occupy all available space and resize with parent window self.setLayout(BorderLayout()) #Create text edition area self.editArea = JTextArea() self.editArea.border = BorderFactory.createEmptyBorder(4,4,4,4) self.editArea.font = Font("Monaco", Font.PLAIN, 14) #Will need scrolling controls scrollingText = JScrollPane(self.editArea) scrollingText.setPreferredSize(Dimension(1,500)) #Add to parent panel self.add(scrollingText, BorderLayout.CENTER)
def __init__(self, controller): ''' Creates default empty console-looking panel. It should be separated from the rest of the GUI so that users can choose to show or hide the console. Or should it be a split panel? This panel will display log and validation/lemmatization messages. It might need its own toolbar for searching, etc. It will also accept commands in later stages of development, if need be. ''' #Give reference to controller to delegate action response self.controller = controller #Make text area occupy all available space and resize with parent window self.setLayout(BorderLayout()) #Create console-looking area self.editArea = JTextArea() self.editArea.border = BorderFactory.createEmptyBorder(4,4,4,4) self.editArea.font = Font("Courier New", Font.BOLD, 14) self.editArea.background = Color.BLACK self.editArea.foreground = Color.WHITE self.editArea.text = "Console started. Nammu's log will appear here.\n\n" #Will need scrolling controls scrollingText = JScrollPane(self.editArea) scrollingText.setPreferredSize(Dimension(1,150)) #Make text area auto scroll down to last printed line caret = self.editArea.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); #Add to parent panel self.add(scrollingText, BorderLayout.CENTER)
class ConsoleTab(ITab): def __init__(self, burp): self.burp = burp self.log = burp.log self.config = burp.config self.caption = burp.loadExtensionSetting(*settings.CONSOLE_CAPTION) self.scrollpane = JScrollPane() self.console = Console(burp) self.scrollpane.setViewportView(self.console.textpane) self.burp.addSuiteTab(self) self.burp.customizeUiComponent(self.getUiComponent()) def getUiComponent(self): return self.scrollpane def getTabCaption(self): return self.caption @property def interpreter(self): return self.console.interp
class BurpExtender(IBurpExtender, IExtensionStateListener, IHttpListener, IProxyListener, ITab): def registerExtenderCallbacks(self, callbacks): self.callbacks = callbacks self.helpers = callbacks.helpers self.scriptpane = JTextPane() self.scriptpane.setFont(Font('Monospaced', Font.PLAIN, 11)) self.scrollpane = JScrollPane() self.scrollpane.setViewportView(self.scriptpane) self._code = compile('', '<string>', 'exec') self._script = '' callbacks.registerExtensionStateListener(self) callbacks.registerProxyListener(self) callbacks.customizeUiComponent(self.getUiComponent()) callbacks.addSuiteTab(self) self.scriptpane.requestFocus() def extensionUnloaded(self): try: self.callbacks.saveExtensionSetting( 'script', base64.b64encode(self._script)) except Exception: traceback.print_exc(file=self.callbacks.getStderr()) return def processProxyMessage(self, messageIsRequest, message): try: globals_ = {'extender': self, 'callbacks': self.callbacks, 'helpers': self.helpers } locals_ = {'messageIsRequest': messageIsRequest, 'message': message } exec(self.script, globals_, locals_) except Exception: traceback.print_exc(file=self.callbacks.getStderr()) return def getTabCaption(self): return 'Script' def getUiComponent(self): return self.scrollpane @property def script(self): end = self.scriptpane.document.length _script = self.scriptpane.document.getText(0, end) if _script == self._script: return self._code self._script = _script self._code = compile(_script, '<string>', 'exec') return self._code
def getControlPanel(): global controlPanel controlPanel = JPanel() controlPanel.setLayout(BoxLayout(controlPanel, BoxLayout.Y_AXIS)) for row in keyLayout: rowPanel = JPanel() rowPanel.setLayout(BoxLayout(rowPanel, BoxLayout.X_AXIS)) controlPanel.add(rowPanel) for key in row: button = JButton(key[0], actionPerformed=handleKeyButton) button.setActionCommand(key[1]) rowPanel.add(button) global terminalResult terminalResult = JTextArea() scroller = JScrollPane(terminalResult) terminalResult.setLineWrap(True) scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) controlPanel.add(scroller) global terminalInput termInputPanel = JPanel() termInputPanel.setLayout(BoxLayout(termInputPanel, BoxLayout.X_AXIS)) termInputLabel = JLabel("Command") termInputPanel.add(termInputLabel) terminalInput = JTextField(actionPerformed=handleTerminalInput) minimumSize = terminalInput.getMinimumSize() maximumSize = terminalInput.getMaximumSize() terminalInput.setMaximumSize(Dimension(maximumSize.width, minimumSize.height)) termInputPanel.add(terminalInput) controlPanel.add(termInputPanel) return controlPanel
def p_build_ui(self, event): """ Adds a list of checkboxes, one for each loaded plugin to the Selct plugins window """ if not self.loaded_p_list: self.update_scroll("[!!] No plugins loaded!") return scroll_pane = JScrollPane() scroll_pane.setPreferredSize(Dimension(200, 250)) check_frame = JPanel(GridBagLayout()) constraints = GridBagConstraints() constraints.fill = GridBagConstraints.HORIZONTAL constraints.gridy = 0 constraints.anchor = GridBagConstraints.FIRST_LINE_START for plug in self.loaded_p_list: check_frame.add(JCheckBox(plug.get_name(), plug.enabled, actionPerformed=self.update_box), constraints) constraints.gridy += 1 vport = JViewport() vport.setView(check_frame) scroll_pane.setViewport(vport) self.window.contentPane.add(scroll_pane) self.window.pack() self.window.setVisible(True)
def __init__(self): # Panel for Measurements self.setLayout(BorderLayout()) # PAGE_START ''' show group/dataset names in the list (component/variable) names ''' self.cbfilemeasOut = JComboBox([]) bfilemeasOut= JButton('Measurements', actionPerformed= self.loadMeasOut) p3= JPanel() p3.setLayout(GridLayout(1,2)) p3.add(self.cbfilemeasOut) p3.add(bfilemeasOut) self.add(p3, BorderLayout.PAGE_START) # LINE_START root = DefaultMutableTreeNode('VarMeasurements') self.tree = JTree(root) scrollPane = JScrollPane() # add a scrollbar to the viewport scrollPane.setPreferredSize(Dimension(230,320)) scrollPane.getViewport().setView((self.tree)) p4 = JPanel() p4.add(scrollPane) self.add(p4, BorderLayout.LINE_START) # CENTER ''' represent a signal with matplot lib in textarea places ''' graficMeas= JTextArea() self.add(graficMeas, BorderLayout.CENTER)
def createList(self, content): model = DefaultListModel() for elem in content: model.addElement(elem) list = JList(model) listPane = JScrollPane(list) listPane.setPreferredSize(Dimension(250, 400)) return listPane, list, model
def __initTable(self): table = JTable(HitListModel()) scrollpane = JScrollPane(table) table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF) table.addMouseListener(HitListMouseListener()) self.add(scrollpane, self.__createTableConstraints()) scrollpane.addComponentListener(PanelSizeChangeListener(table)) return table
def fillPanel(self, question): self.pnlQuestion.removeAll() if question.getKind() == 2: panel = TrueFalsePanel(question).getPanel() elif question.getKind() == 3: panel = MultipleChoicePanel(question).getPanel() scrollpanel = JScrollPane(panel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED) scrollpanel.setBorder(None) self.pnlQuestion.add(scrollpanel, BorderLayout.CENTER) self.pnlQuestion.updateUI()
def __init__(self, window, api): self.api = api self.component = JPanel(BorderLayout()) # Create editor pane scrollpane = JScrollPane() self.script_area = InputPane(window) self.script_area.undo = UndoManager() line_numbers = LineNumbering(self.script_area.component) scrollpane.viewport.view = self.script_area.component scrollpane.rowHeaderView = line_numbers.component self.component.add(scrollpane, BorderLayout.CENTER) # Create Selection pane select_pane = JPanel() self.objects_box = JComboBox([], actionCommand="object") select_pane.add(self.objects_box) self.events_box = JComboBox( ["update", "click"], actionCommand="event" ) self.event_types = [EventType.UPDATE, EventType.CLICK] select_pane.add(self.events_box) self.languages = list(ScriptType.values()) self.language_box = JComboBox( [l.getName() for l in self.languages], actionCommand="language" ) select_pane.add(self.language_box) self.save_btn = JButton("Save") select_pane.add(self.save_btn) self.component.add(select_pane, BorderLayout.PAGE_START) self.events_box.addActionListener(self) self.objects_box.addActionListener(self) self.language_box.addActionListener(self) self.save_btn.addActionListener(self) self.current = None self.update_geos() interface.addEventListener("add", self.event_listener) interface.addEventListener("remove", self.event_listener) interface.addEventListener("rename", self.event_listener) # Listen to script_area changes in order to know when the save # button can be activated self.script_area.doc.addDocumentListener(self) # Hack to be able to change the objects_box self.building_objects_box = False self.active = False
def timeline(self, username): timeline = self.api.GetFriendsTimeline(username) self.resultPanel = JPanel() self.resultPanel.layout = BoxLayout(self.resultPanel, BoxLayout.Y_AXIS) for s in timeline: self.showTweet(s) scrollpane = JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) scrollpane.preferredSize = 400, 800 scrollpane.viewport.view = self.resultPanel self.frame.add(scrollpane)
def __init__(self, window, api): self.api = api self.component = JPanel(BorderLayout()) # Create editor pane scrollpane = JScrollPane() self.script_area = InputPane(window) line_numbers = LineNumbering(self.script_area.component) scrollpane.viewport.view = self.script_area.component scrollpane.rowHeaderView = line_numbers.component self.component.add(scrollpane, BorderLayout.CENTER) self.script_area.undo = UndoManager() self.reset()
def run(self): #----------------------------------------------------------------------- # Size the frame to use 1/2 of the screen #----------------------------------------------------------------------- screenSize = Toolkit.getDefaultToolkit().getScreenSize() frameSize = Dimension(screenSize.width >> 1, screenSize.height >> 1) frame = JFrame('javadocInfo_04', size=frameSize, defaultCloseOperation=JFrame.EXIT_ON_CLOSE) #----------------------------------------------------------------------- # Reposition the frame to be in the center of the screen #----------------------------------------------------------------------- frame.setLocation((screenSize.width - frameSize.width) >> 1, (screenSize.height - frameSize.height) >> 1) #----------------------------------------------------------------------- # Initialize the list to have exactly 1 element #----------------------------------------------------------------------- self.List = JList(['One moment please...'], valueChanged=self.pick, selectionMode=ListSelectionModel.SINGLE_SELECTION) #----------------------------------------------------------------------- # Put the List in a ScrollPane and place it in the middle of a pane #----------------------------------------------------------------------- pane = JPanel(layout=BorderLayout()) pane.add(JScrollPane(self.List), BorderLayout.CENTER) #----------------------------------------------------------------------- # Add a TextField [for the URL of the selected entry] at the bottom #----------------------------------------------------------------------- self.msg = JTextField() pane.add(self.msg, BorderLayout.SOUTH) #----------------------------------------------------------------------- # Add the pane and a scrollable TextArea to a SplitPane in the frame #----------------------------------------------------------------------- self.area = JTextArea() frame.add( JSplitPane(JSplitPane.HORIZONTAL_SPLIT, pane, JScrollPane(self.area), propertyChange=self.propChange)) #----------------------------------------------------------------------- # Create a separate thread to locate & proces the remote URL #----------------------------------------------------------------------- self.Links = {} # Initialize the Links dictionary soupTask( self.List, # The visible JList instance self.msg, # The message area (JTextField) JAVADOC_URL, # Remote web page URL to be processed self.Links # Dictionary of links found ).execute() frame.setVisible(1)
def __init__(self): self.programs = [] self.setLayout(BoxLayout(self, BoxLayout.PAGE_AXIS)) self.JprogramList = JList() self.JprogramList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION) self.JprogramList.addListSelectionListener(self.handle_select) scrollPane = JScrollPane(self.JprogramList) scrollPane.setMinimumSize(Dimension(300, 0)) self.splitPane = SplitPanel(scrollPane, JPanel()) self.add(self.splitPane) self.load_program_list()
def __init__(self, controller): ''' Creates default empty console-looking panel. It should be separated from the rest of the GUI so that users can choose to show or hide the console. Or should it be a split panel? This panel will display log and validation/lemmatization messages. It might need its own toolbar for searching, etc. It will also accept commands in later stages of development, if need be. ''' # Give reference to controller to delegate action response self.controller = controller # Make text area occupy all available space and resize with parent # window self.setLayout(BorderLayout()) # Create console-looking area self.edit_area = JEditorPane() # Although most of the styling is done using css, we need to set these # properties to ensure the html is rendered properly in the console self.edit_area.border = BorderFactory.createEmptyBorder(6, 6, 6, 6) self.edit_area.setContentType("text/html") # Disable writing in the console - required to render hyperlinks self.edit_area.setEditable(False) # Map CSS color strings to Java Color objects self.colors = {'Gray': Color(238, 238, 238), 'Black': Color(0, 0, 0), 'Yellow': Color(255, 255, 0)} # Initial call to refresh console to set the console style properties self.refreshConsole() # Set up a hyperlink listener listener = addEventListener(self.edit_area, HyperlinkListener, 'hyperlinkUpdate', self.handleEvent) # Will need scrolling controls scrollingText = JScrollPane(self.edit_area) scrollingText.setPreferredSize(Dimension(1, 150)) # Make text area auto scroll down to last printed line caret = self.edit_area.getCaret() caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE) # Add to parent panel self.add(scrollingText, BorderLayout.CENTER)
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 friendsList(self, username): self.window = swing.JFrame(username) self.window.layout = awt.BorderLayout() statusPanel = swing.JPanel() statusPanel.layout = awt.GridLayout(4,1) # Set status placeholder UI statusPanel.border = swing.BorderFactory.createTitledBorder("Status") buttonGroup = swing.ButtonGroup() radioButton = swing.JRadioButton("Away", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) statusPanel.add(radioButton) radioButton = swing.JRadioButton("Here", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) statusPanel.add(radioButton) #Wizard of Oz incoming chat request radioButton = swing.JButton("Page Boss", actionPerformed=self.callBoss) buttonGroup.add(radioButton) statusPanel.add(radioButton) statusPanel.add(self.status) #statusPanel.add(swing.JButton("Update Status", actionPerformed=self.updateStatus)) #Buddy list panel = swing.JPanel() panel.layout = awt.BorderLayout() panel.border = swing.BorderFactory.createTitledBorder("Friends Online") ##TODO: fix threading so that friends load before the window print self.friendsData self.friendsData.append('guest') print '2' self.list = swing.JList(self.friendsData) panel.add("Center", swing.JScrollPane(self.list)) launchChatButton = swing.JButton("Launch chat?", actionPerformed=self.launchChatOut) panel.add("South", launchChatButton) self.window.windowClosing = self.goodbye pane = JScrollPane() pane.getViewport().add(self.list) panel.add(pane) self.window.add("North", statusPanel) self.window.add("South", panel) self.window.pack() self.window.visible = True return self.window
def friendsList(self, username): self.window = swing.JFrame(username) self.window.layout = awt.BorderLayout() statusPanel = swing.JPanel() statusPanel.layout = awt.GridLayout(4, 1) # Set status placeholder UI statusPanel.border = swing.BorderFactory.createTitledBorder("Status") buttonGroup = swing.ButtonGroup() radioButton = swing.JRadioButton("Away", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) statusPanel.add(radioButton) radioButton = swing.JRadioButton("Here", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) statusPanel.add(radioButton) #Wizard of Oz incoming chat request radioButton = swing.JButton("Page Boss", actionPerformed=self.callBoss) buttonGroup.add(radioButton) statusPanel.add(radioButton) statusPanel.add(self.status) #statusPanel.add(swing.JButton("Update Status", actionPerformed=self.updateStatus)) #Buddy list panel = swing.JPanel() panel.layout = awt.BorderLayout() panel.border = swing.BorderFactory.createTitledBorder("Friends Online") ##TODO: fix threading so that friends load before the window print self.friendsData self.friendsData.append('guest') print '2' self.list = swing.JList(self.friendsData) panel.add("Center", swing.JScrollPane(self.list)) launchChatButton = swing.JButton("Launch chat?", actionPerformed=self.launchChatOut) panel.add("South", launchChatButton) self.window.windowClosing = self.goodbye pane = JScrollPane() pane.getViewport().add(self.list) panel.add(pane) self.window.add("North", statusPanel) self.window.add("South", panel) self.window.pack() self.window.visible = True return self.window
def make_tree(self): print('make_tree') root = DefaultMutableTreeNode(self.exper.name) sb = br.SimilarityBuilder() for hseg in self.exper.hsegs(): all_file_dict = hseg.file_dict() all_file_dict.update(hseg.cell_file_dict()) all_file_dict.update(hseg.bin_file_dict()) sb.add_group(hseg.name, all_file_dict) simprofile, comparisons = sb.simprofile_comparison() sim_str = '' for val in simprofile: sim_str += str(val) + '\n' tp = JTextArea(sim_str) stp = JScrollPane() stp.getViewport().setView(tp) # # stp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); # stp.setPreferredSize(Dimension(250, 250)); # tp.setPreferredSize(Dimension(250, 250)) stp_panel = JPanel(BorderLayout()) stp_panel.add(tp, BorderLayout.CENTER) # self.add(stp_panel, 'grow') for hseg in self.exper.hsegs(): hseg_node = DefaultMutableTreeNode(hseg.name) root.add(hseg_node) if len(comparisons[hseg.name]) > 0: for definer, file_names in comparisons[hseg.name].items(): for file_name in file_names: node_str = definer + ': ' + file_name hseg_node.add(DefaultMutableTreeNode(node_str)) # for file_suf in hseg.file_dict() : # hseg_node.add(DefaultMutableTreeNode(file_suf)) self.tree = JTree(root) scrollPane = JScrollPane() scrollPane.getViewport().setView((self.tree)) # scrollPan # scrollPane.setPreferredSize(Dimension(300,250)) tree_panel = JPanel(BorderLayout()) tree_panel.add(scrollPane, BorderLayout.CENTER) combo_panel = JPanel(GridLayout(0, 2, 10, 10)) # combo_panel.setLayout(BoxLayout(combo_panel, BoxLayout.X_AXIS)) combo_panel.add(stp_panel) #, BorderLayout.LINE_START) combo_panel.add(tree_panel) #, BorderLayout.LINE_END) self.panel.add(combo_panel) # self.add(scrollPane, 'grow') self.revalidate()
def __init__(self, parent, title, modal, app): border = BorderFactory.createEmptyBorder(5, 7, 5, 7) self.getContentPane().setBorder(border) self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS)) #Intro falsePositivePng = File.separator.join( [app.SCRIPTDIR, "images", "icons", "not_error36.png"]) introLbl = JMultilineLabel( app.strings.getString("manual_false_positives_info")) introLbl.setMaxWidth(600) #Table table = JTable() columns = [ app.strings.getString("Tool"), app.strings.getString("Check"), app.strings.getString("Error_id"), app.strings.getString("OSM_id") ] self.tableModel = MyTableModel([], columns) table.setModel(self.tableModel) scrollPane = JScrollPane(table) scrollPane.setAlignmentX(0.0) #OK button btnPanel = JPanel(FlowLayout(FlowLayout.CENTER)) okBtn = JButton("OK", ImageProvider.get("ok"), actionPerformed=self.on_okBtn_clicked) btnPanel.add(okBtn) btnPanel.setAlignmentX(0.0) #Layout headerPnl = JPanel() headerPnl.setLayout(BoxLayout(headerPnl, BoxLayout.X_AXIS)) headerPnl.add(JLabel(ImageIcon(falsePositivePng))) headerPnl.add(Box.createRigidArea(Dimension(10, 0))) headerPnl.add(introLbl) headerPnl.setAlignmentX(0.0) self.add(headerPnl) self.add(Box.createRigidArea(Dimension(0, 10))) self.add(scrollPane) self.add(Box.createRigidArea(Dimension(0, 10))) self.add(btnPanel) self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE) self.pack()
class PerceptualHashSettingsPanel(IngestModuleIngestJobSettingsPanel): # TODO: Update this for your UI def __init__(self, settings): self.local_settings = settings self.initComponents() self.customizeComponents() # TODO: Update this for your UI def checkBoxEvent(self, event): if self.checkbox.isSelected(): self.local_settings.setSetting('Flag', 'true') self.local_settings.setSetting('pHash', self.area.getText()) else: self.local_settings.setSetting('Flag', 'false') # TODO: Update this for your UI def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Check to activate/deactivate pHashToCheck", actionPerformed=self.checkBoxEvent) self.label0 = JLabel(" ") self.label1 = JLabel("Input your phash value for checking: ") self.label2 = JLabel(" ") self.panel1.add(self.checkbox) self.panel1.add(self.label0) self.panel1.add(self.label1) self.panel1.add(self.label2) self.add(self.panel1) self.area = JTextArea(5, 25) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) self.add(self.pane) # TODO: Update this for your UI def customizeComponents(self): self.checkbox.setSelected( self.local_settings.getSetting('Flag') == 'true') self.area.setText(self.local_settings.getSetting('pHash')) # Return the settings used def getSettings(self): return self.local_settings
def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Check to activate/deactivate TextArea", actionPerformed=self.checkBoxEvent) self.label0 = JLabel(" ") self.label1 = JLabel("Input in SQLite DB's in area below,") self.label2 = JLabel("seperate values by commas.") self.label3 = JLabel("then check the box above.") self.label4 = JLabel(" ") self.panel1.add(self.checkbox) self.panel1.add(self.label0) self.panel1.add(self.label1) self.panel1.add(self.label2) self.panel1.add(self.label3) self.panel1.add(self.label4) self.add(self.panel1) self.area = JTextArea(5,25) #self.area.getDocument().addDocumentListener(self.area) #self.area.addKeyListener(listener) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self.area) #self.add(self.area) self.add(self.pane)
def __init__(self, controller): ''' Creates a new window displaying a schematic view of an ATF file, following the guidelines and mockup agreed with project owners. ''' # Give reference to controller to delegate action response self.controller = controller # Get list of projects, languages and protocols from config settings self.languages = self.controller.config['languages'] self.protocols = self.controller.config['protocols'] self.projects = self.controller.config['projects'] # Make text area occupy all available space and resize with parent # window self.setLayout(BorderLayout()) self.mainPanel = JTabbedPane() self.mainPanel.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT) self.add(self.mainPanel, BorderLayout.CENTER) # Set empty dictionary of tab panels self.objectTabs = {} # Will need scrolling controls scrollingArea = JScrollPane(self.mainPanel) # Add notice panel self.add(self.addNotice(), BorderLayout.NORTH) # Add to parent panel self.add(scrollingArea, BorderLayout.CENTER)
def run( self ) : frame = JFrame( 'SecConfigReport_02', size = ( 300, 300 ), locationRelativeTo = None, defaultCloseOperation = JFrame.EXIT_ON_CLOSE ) data = [] text = AdminTask.generateSecConfigReport() for line in text.splitlines()[ 2: ] : data.append( [ info.strip() for info in line[ :-2 ].split( ';' ) ] ) frame.add( JScrollPane( JTable( data, ';;;'.split( ';' ) ) ) ) frame.pack() frame.setVisible( 1 )
def registerExtenderCallbacks(self, callbacks): # keep a reference to our callbacks object self._callbacks = callbacks # obtain an extension helpers object self._helpers = callbacks.getHelpers() # set our extension name callbacks.setExtensionName("sensitive") # create the log and a lock on which to synchronize when adding log entries self._log = ArrayList() self._lock = Lock() self._urls = [] # main split pane self._splitpane = JSplitPane(JSplitPane.VERTICAL_SPLIT) # table of log entries logTable = Table(self) scrollPane = JScrollPane(logTable) self._splitpane.setLeftComponent(scrollPane) # tabs with request/response viewers tabs = JTabbedPane() self._requestViewer = callbacks.createMessageEditor(self, False) self._responseViewer = callbacks.createMessageEditor(self, False) tabs.addTab("Request", self._requestViewer.getComponent()) tabs.addTab("Response", self._responseViewer.getComponent()) self._splitpane.setRightComponent(tabs) # customize our UI components callbacks.customizeUiComponent(self._splitpane) callbacks.customizeUiComponent(logTable) callbacks.customizeUiComponent(scrollPane) callbacks.customizeUiComponent(tabs) # add the custom tab to Burp's UI callbacks.addSuiteTab(self) # register ourselves as an HTTP listener callbacks.registerHttpListener(self) return
def run(self): frame = JFrame('Table7', size=(300, 150), locationRelativeTo=None, defaultCloseOperation=JFrame.EXIT_ON_CLOSE) headings = 'T/F,Date,Integer,Float,Double'.split(',') model = myTM(self.data, headings) table = JTable(model, selectionMode=ListSelectionModel.SINGLE_SELECTION) table.getColumnModel().getColumn(model.getColumnCount() - 1 # i.e., last column ).setCellRenderer(myRenderer()) #---------------------------------------------------------- # Adjust the width of the columns using only header text #---------------------------------------------------------- hRenderer = table.getTableHeader().getDefaultRenderer() for col in range(model.getColumnCount()): column = table.getColumnModel().getColumn(col) comp = hRenderer.getTableCellRendererComponent( None, # Table column.getHeaderValue(), # value 0, # isSelected = false 0, # hasFocus = false -1, # row # col # col # ) width = comp.getPreferredSize().width # print 'col: %d previous: %d current: %d' % ( col, column.getPreferredWidth(), width ) column.setPreferredWidth(width) frame.add(JScrollPane(table)) frame.setVisible(1)
def run(self): frame = JFrame('Available Fonts', defaultCloseOperation=JFrame.EXIT_ON_CLOSE) #----------------------------------------------------------------------- # First, we a local graphics environment (LGE) instance. Then, we call # its getAvailableFontFamilyNames() method to obtain the list of all # available font names. #----------------------------------------------------------------------- lge = GraphicsEnvironment.getLocalGraphicsEnvironment() fontNames = lge.getAvailableFontFamilyNames() #----------------------------------------------------------------------- # The JTextArea will be used to hold the names of the available fonts. # Unfortunately, we don't know, for certain, how many font names are # present. So, we need to have the JTextArea be within a JScrollPane, # "just in case" too many names exist for us to display at one time. ;-) #----------------------------------------------------------------------- frame.add( JScrollPane( JTextArea('\n'.join(fontNames), editable=0, rows=8, columns=32))) frame.pack() frame.setVisible(1)
def run( self ) : frame = JFrame( 'SecConfigReport_08', size = ( 500, 300 ), locationRelativeTo = None, componentResized = self.frameResized, defaultCloseOperation = JFrame.EXIT_ON_CLOSE ) data = [] text = AdminTask.generateSecConfigReport() #----------------------------------------------------------------------- # The RegExp was added to replace multiple blanks with a single one #----------------------------------------------------------------------- for line in text.splitlines()[ 2: ] : data.append( [ re.sub( ' +', ' ', info.strip() ) for info in line[ :-2 ].split( ';' ) ] ) self.table = table = JTable( reportTableModel( data, ';;;'.split( ';' ), ), selectionMode = ListSelectionModel.SINGLE_SELECTION ) table.setDefaultRenderer( String, reportRenderer() ) self.setColumnWidths( table ) frame.add( JScrollPane( table ) ) frame.pack() frame.setVisible( 1 ) frame.setMinimumSize( frame.getSize() )
def __init__(self): #super(GridLayout(0,1)) # 1 column, as many rows as necessary super(RoiGroupTable, self).__init__(GridLayout( 0, 1)) # 1 column, as many rows as necessary #super() #self.setLayout(GridLayout(0,1)) ### Table Panel ### # Prepare table data headers = ["Group number", "Name"] listNames = Roi.getGroupNames().split(",") # groupNames is a list then dataRows = [[item[0] + 1, item[1]] for item in enumerate(listNames) ] # +1 since the group actually start at 1 #print dataRows # Make the table pane table = JTable(dataRows, headers) #table.setPreferredScrollableViewportSize( Dimension(500, 70) ) #table.setFillsViewportHeight(true) # Create the scroll pane and add the table to it. tablePane = JScrollPane(table) #tablePane = ScrollPane() #tablePane.add(table) # Add the scrollpane to the main panel. self.add(tablePane)
def makeUI(model): table = JTable(model) jsp = JScrollPane(table) regex_label = JLabel("Search: ") regex_field = JTextField(20) top = JPanel() top.add(regex_label) top.add(regex_field) top.setLayout(BoxLayout(top, BoxLayout.X_AXIS)) base_path_label = JLabel("Base path:") base_path_field = JTextField(50) bottom = JPanel() bottom.add(base_path_label) bottom.add(base_path_field) bottom.setLayout(BoxLayout(bottom, BoxLayout.X_AXIS)) all = JPanel() all.add(top) all.add(jsp) all.add(bottom) all.setLayout(BoxLayout(all, BoxLayout.Y_AXIS)) frame = JFrame("File paths") frame.getContentPane().add(all) frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE) frame.addWindowListener(Closing()) frame.pack() frame.setVisible(True) # Listeners regex_field.addKeyListener(EnterListener(table, model, frame)) table.addMouseListener(RowClickListener(base_path_field)) # return model, table, regex_field, frame
def __init__(self): self.setBorder( BorderFactory.createTitledBorder( "Registered session handling actions" ) ) self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) self._rowpanel1 = JPanel() self._rowpanel1.setLayout(BoxLayout(self._rowpanel1, BoxLayout.X_AXIS)) self.listModel = DefaultListModel() self.List = JList(self.listModel) self.List.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ) self.List.setSelectedIndex(0) self.List.setVisibleRowCount(5) self.ScrollPane = JScrollPane(self.List) self.remove_button = JButton( "De-register selected", actionPerformed=self.button_remove_pressed ) self._rowpanel1.add(self.ScrollPane) self._rowpanel1.add(self.remove_button) self.add(self._rowpanel1)
def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("All Logs", actionPerformed=self.checkBoxEvent) self.checkbox1 = JCheckBox("Application.Evtx", actionPerformed=self.checkBoxEvent) self.checkbox2 = JCheckBox("Security.EVTX", actionPerformed=self.checkBoxEvent) self.checkbox3 = JCheckBox("System.EVTX", actionPerformed=self.checkBoxEvent) self.checkbox4 = JCheckBox("Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent) self.panel1.add(self.checkbox) self.panel1.add(self.checkbox1) self.panel1.add(self.checkbox2) self.panel1.add(self.checkbox3) self.panel1.add(self.checkbox4) self.add(self.panel1) self.area = JTextArea(5,25) #self.area.addKeyListener(self) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self) #self.add(self.area) self.add(self.pane)
def set_pane(self): status = JTextArea() status.setLineWrap(True) status.setText("Nothing selected") self.status = status request_list_pane = JScrollPane() scanner_pane = JSplitPane(JSplitPane.VERTICAL_SPLIT, request_list_pane, self.tabbed_pane) self.pane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT, JScrollPane(self.tree), scanner_pane) self.pane.setDividerLocation(310) self.pane.getLeftComponent().setMinimumSize(Dimension(310, 300))
def init(self): w, h, aa, threads = (512, 512, 1, 2) canvas = RayTracePanel(w, h, aa, threads) self.getContentPane().add(JScrollPane(canvas)) #Save FileChooser #fcS = JFileChooser() #fcS.addChoosableFileFilter(FileNameExtensionFilter('Windows Bitmap (*.bmp)', ['bmp'])) #fcS.addChoosableFileFilter(FileNameExtensionFilter('JPEG / JFIF (*.jpg)', ['jpg'])) #fcS.addChoosableFileFilter(FileNameExtensionFilter('Portable Network Graphics (*.png)', ['png'])) #def saveFile(event): # '''Performed when the save button is pressed''' # result = fcS.showSaveDialog(frame) # if result == JFileChooser.APPROVE_OPTION: # file = fcS.getSelectedFile() # fname = file.getPath() # ext = fcS.getFileFilter().getExtensions()[0] # if not fname.endswith('.' + ext): # file = File(fname + '.' + ext) # canvas.saveToFile(file, ext) #Open FileChooser #fcO = JFileChooser() #fcO.addChoosableFileFilter(FileNameExtensionFilter('RayTrace Scene File (*.rts)', ['rts'])) #def openFile(event): # '''Performed when the open button is pressed''' # result = fcO.showOpenDialog(frame) # if result == JFileChooser.APPROVE_OPTION: # fname = fcO.getSelectedFile().getPath() # if fname.endswith('.rts'): # f = open(fname, 'rb') # newScene = SceneFactory().buildScene(f) # f.close() # Painter(canvas, newScene, openButton, saveButton, stopButton).start() def stop(event): '''Peformed when the stop button is pressed''' canvas.stopRendering() #Setup Menu menuBar = JMenuBar() menu = JMenu("File") menuBar.add(menu) #openButton = JMenuItem("Open...", actionPerformed=openFile) #openButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK)) #menu.add(openButton) #saveButton = JMenuItem("Save as...", actionPerformed=saveFile) #saveButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)) #menu.add(saveButton) menu.addSeparator() stopButton = JMenuItem('Stop Render', actionPerformed=stop) stopButton.setAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_ESCAPE, 0)) stopButton.setEnabled(False) menu.add(stopButton) menu.addSeparator() #closeButton = JMenuItem('Close', actionPerformed=exit) #closeButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK)) #menu.add(closeButton) self.setJMenuBar(menuBar)
def getMainComponent(self): self._mainPanel = JPanel(BorderLayout()) # input self._consolePwd = JTextField() self._consolePwd.setEditable(False) self._consolePwd.setText("Not initialized") self._consoleInput = JTextField() #Remove 'tab' low-level tab-function of jumping to other component, so I can use it self._consoleInput.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET) self._consoleInput.addActionListener(self.EnterPress()) self._consoleInput.addKeyListener(self.KeyPress()) self._inputPanel = JPanel(BorderLayout()) self._inputPanel.add(self._consolePwd, BorderLayout.WEST) self._inputPanel.add(self._consoleInput, BorderLayout.CENTER) # output self._consoleOutput = JTextArea() self._consoleOutput.setEditable(False) self._consoleOutput.setForeground(Color.WHITE) self._consoleOutput.setBackground(Color.BLACK) self._consoleOutput.setFont(self._consoleOutput.getFont().deriveFont(12.0)) self._scrollPaneConsoleOutput = JScrollPane(self._consoleOutput) # Add to main panel and return the main panel self._mainPanel.add(self._scrollPaneConsoleOutput, BorderLayout.CENTER) self._mainPanel.add(self._inputPanel, BorderLayout.SOUTH) return self._mainPanel
def config(): self.barra = JScrollPane() self.Tab_Caracteres_Especiales = JTable() nombre = ["nombre", "apeM", "apeP"] datos = ["victor", "esau", "cholo"] self.Tab_Caracteres_Especiales = JTable(datos, nombre) self.Tab_Caracteres_Especiales.addRow(datos) # self.Tab_Caracteres_Especiales.setFont(Font("Tahoma", 0, 14)); # NOI18N self.barra.setViewportView(self.Tab_Caracteres_Especiales) #TODO: imcompleto se nesita una array y python maneja listas :( self.getContentPane().add(self.barra) self.barra.setBounds(0, 0, 929, 574) self.setBounds(0, 0, 939, 604)
def initResultados(self): diag = JFrame() self.lineas = list() self.areaResultados = JTextArea() numLineas = self.readResultados() panelResultados = JPanel() #panelResultados.setAutoscrolls(True) panelResultados.setBorder(BorderFactory.createEtchedBorder()) panelResultados.setLayout(GridLayout(0, 1)) pane = JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) pane.viewport.view = self.areaResultados #pane.getViewport().add(panelResultados) diag.setTitle("RESULTADOS OBTENIDOS") diag.setSize(1000, 450) diag.setLayout(BorderLayout()) diag.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) diag.setLocationRelativeTo(None) diag.setVisible(True) panelResultados.add(pane) diag.add(panelResultados, BorderLayout.CENTER)
def getUiComponent(self): """Burp uses this method to obtain the component that should be used as the contents of the custom tab when it is displayed. Returns a awt.Component. """ # GUI happens here from javax.swing import (JPanel, JSplitPane, JLabel, JList, JScrollPane, ListSelectionModel) from java.awt import BorderLayout panel = JPanel(BorderLayout()) # create a list and then JList out of it. colors = [ "red", "orange", "yellow", "green", "cyan", "blue", "pink", "magenta", "gray", "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" ] list1 = JList(colors) # set the selection mode to single items # ListSelectionModel.SINGLE_SELECTION = 0 # https://docs.oracle.com/javase/8/docs/api/constant-values.html list1.selectionMode = ListSelectionModel.SINGLE_SELECTION # create splitpane - horizontal split spl = JSplitPane(JSplitPane.HORIZONTAL_SPLIT, JScrollPane(list1), JLabel("right pane")) panel.add(spl) return panel
def main(namespace=None): frame = JythonFrame() console = Console(namespace) frame.getContentPane().add(JScrollPane(console.text_pane)) frame.visible = True frame.windowClosing = lambda x: console.locals["plugin"].consoleQuit( console.locals["event"])
def __init__(self): self.setName('Jython Properties') self.setLayout(BorderLayout()) self.add(JScrollPane(JTable([['x', 42], ['y', 'Bibo']], ['Name', 'Value'])), BorderLayout.CENTER)
def initTabs(self): # ## init autorize tabs # self.logTable = Table(self) self.logTable.setAutoCreateRowSorter(True) tableWidth = self.logTable.getPreferredSize().width self.logTable.getColumn("ID").setPreferredWidth(Math.round(tableWidth / 50 * 2)) self.logTable.getColumn("URL").setPreferredWidth(Math.round(tableWidth / 50 * 24)) self.logTable.getColumn("Orig. Length").setPreferredWidth(Math.round(tableWidth / 50 * 4)) self.logTable.getColumn("Modif. Length").setPreferredWidth(Math.round(tableWidth / 50 * 4)) self.logTable.getColumn("Unauth. Length").setPreferredWidth(Math.round(tableWidth / 50 * 4)) self.logTable.getColumn("Authorization Enforcement Status").setPreferredWidth(Math.round(tableWidth / 50 * 4)) self.logTable.getColumn("Authorization Unauth. Status").setPreferredWidth(Math.round(tableWidth / 50 * 4)) self._splitpane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT) self._splitpane.setResizeWeight(1) self.scrollPane = JScrollPane(self.logTable) self._splitpane.setLeftComponent(self.scrollPane) self.scrollPane.getVerticalScrollBar().addAdjustmentListener(autoScrollListener(self)) self.menuES0 = JCheckBoxMenuItem(self._enfocementStatuses[0],True) self.menuES1 = JCheckBoxMenuItem(self._enfocementStatuses[1],True) self.menuES2 = JCheckBoxMenuItem(self._enfocementStatuses[2],True) self.menuES0.addItemListener(menuTableFilter(self)) self.menuES1.addItemListener(menuTableFilter(self)) self.menuES2.addItemListener(menuTableFilter(self)) copyURLitem = JMenuItem("Copy URL"); copyURLitem.addActionListener(copySelectedURL(self)) self.menu = JPopupMenu("Popup") self.menu.add(copyURLitem) self.menu.add(self.menuES0) self.menu.add(self.menuES1) self.menu.add(self.menuES2) self.tabs = JTabbedPane() self._requestViewer = self._callbacks.createMessageEditor(self, False) self._responseViewer = self._callbacks.createMessageEditor(self, False) self._originalrequestViewer = self._callbacks.createMessageEditor(self, False) self._originalresponseViewer = self._callbacks.createMessageEditor(self, False) self._unauthorizedrequestViewer = self._callbacks.createMessageEditor(self, False) self._unauthorizedresponseViewer = self._callbacks.createMessageEditor(self, False) self.tabs.addTab("Modified Request", self._requestViewer.getComponent()) self.tabs.addTab("Modified Response", self._responseViewer.getComponent()) self.tabs.addTab("Original Request", self._originalrequestViewer.getComponent()) self.tabs.addTab("Original Response", self._originalresponseViewer.getComponent()) self.tabs.addTab("Unauthenticated Request", self._unauthorizedrequestViewer.getComponent()) self.tabs.addTab("Unauthenticated Response", self._unauthorizedresponseViewer.getComponent()) self.tabs.addTab("Configuration", self.pnl) self.tabs.setSelectedIndex(6) self._splitpane.setRightComponent(self.tabs)
def run(self): frame = JFrame('List6', size=(200, 220), layout=GridLayout(1, 2), defaultCloseOperation=JFrame.EXIT_ON_CLOSE) panel = JPanel(layout=GridLayout(0, 1)) self.buttons = {} for name in 'First,Last,Before,After,Remove'.split(','): self.buttons[name] = panel.add(self.button(name)) self.text = panel.add(JTextField(10)) self.addInputMethodListener(self) # self.addTextListener( self ) frame.add(panel) data = ('Now is the time for all good spam ' + 'to come to the aid of their eggs').split(' ') model = DefaultListModel() for word in data: model.addElement(word) self.info = JList(model, valueChanged=self.selection, selectionMode=ListSelectionModel.SINGLE_SELECTION) frame.add(JScrollPane(self.info, preferredSize=(200, 100))) frame.setVisible(1)
def __init__(self, out_of_scope): ColumnPanel.__init__(self) out_of_scope_list = JList(tuple(out_of_scope)) self.add(JScrollPane(out_of_scope_list)) self.setBorder(make_title_border("Out of scope")) self.setMaximumSize(Dimension(9999999, self.getPreferredSize().height))
def getUiComponent(self): """Burp uses this method to obtain the component that should be used as the contents of the custom tab when it is displayed. Returns a awt.Component. """ # GUI happens here from javax.swing import (JPanel, JSplitPane, JLabel, JList, JScrollPane, ListSelectionModel) from java.awt import BorderLayout panel = JPanel(BorderLayout()) # create a list and then JList out of it. colors = [ "red", "orange", "yellow", "green", "cyan", "blue", "pink", "magenta", "gray", "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" ] def listSelect(event): """Add the selected index to the label.""" label1.text += "-" + colors[list1.selectedIndex] # create a list and assign the valueChanged list1 = JList(colors, valueChanged=listSelect) list1.selectionMode = ListSelectionModel.SINGLE_SELECTION # create splitpane - horizontal split label1 = JLabel("right pane") spl = JSplitPane(JSplitPane.HORIZONTAL_SPLIT, JScrollPane(list1), label1) panel.add(spl) return panel
def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Create Content View of Unique Event Id's", actionPerformed=self.checkBoxEvent) self.checkbox4 = JCheckBox("Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent) self.text1 = JLabel("*** Only run this once otherwise it adds it to the data again.") self.text2 = JLabel(" ") self.text3 = JLabel("*** Format is a comma delimited text ie: 8001, 8002") self.panel1.add(self.checkbox) self.panel1.add(self.text1) self.panel1.add(self.text2) self.panel1.add(self.checkbox4) self.panel1.add(self.text3) self.add(self.panel1) self.area = JTextArea(5,25) #self.area.addKeyListener(self) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self) #self.add(self.area) self.add(self.pane)
def make_game_selector(): self.gameChanger = False def dbChange(evt): if evt.source.text: self.gamedb = GameDB(evt.source.text) self.gameChanger = True def idChange(evt): if evt.source.text: self.gameid = evt.source.text self.gameChanger = True def turnChange(evt): if evt.source.text: self.turnid = evt.source.text self.gameChanger = True selector = JPanel() selector.add(JLabel("DB:")) selector.add(textfield(self.gamedb.dbfile, dbChange)) selector.add(JLabel("Game ID:")) selector.add(textfield(self.gameid, idChange)) selector.add(JLabel("Turn ID:")) selector.add(textfield(self.turnid, turnChange)) return JScrollPane(selector)
def run( self ) : frame = JFrame( 'WSAShelp_01', locationRelativeTo = None, defaultCloseOperation = JFrame.EXIT_ON_CLOSE ) # text = Help.help() # tabs = text.count( '\t' ) # text = Help.help().expandtabs() # rows = text.count( '\n' ) + 1 # cols = max( [ len( x ) for x in text.splitlines() ] ) # cols = max( [ len( x.expandtabs() ) for x in text.splitlines() ] ) # print '\nrows: %d cols: %d tabs: %d' % ( rows, cols, tabs ) frame.add( JScrollPane( JTextArea( # text, Help.help().expandtabs(), 20, 80, font = Font( 'Courier' , Font.PLAIN, 12 ) ) ) ) frame.pack() size = frame.getSize() # print 'frame.getSize():', size loc = frame.getLocation() # print 'frame.getLocation():', loc loc.x -= ( size.width >> 1 ) loc.y -= ( size.height >> 1 ) frame.setLocation( loc ) frame.setVisible( 1 )
def run(self): frame = JFrame('MethodTable2', defaultCloseOperation=JFrame.EXIT_ON_CLOSE) #----------------------------------------------------------------------- # Get the text to be processed #----------------------------------------------------------------------- helpText = Help.help().expandtabs() #----------------------------------------------------------------------- # Verify our help text parsing routine #----------------------------------------------------------------------- headings = ['Method', 'Description / Abstract'] #----------------------------------------------------------------------- # Let's try to highlight every instance of "help" in the table #----------------------------------------------------------------------- data = self.parseMethodHelp(helpText) for r in range(len(data)): for c in range(len(data[r])): data[r][c] = self.hiliteText(data[r][c], 'help') #----------------------------------------------------------------------- # Create the JTable using the massaged data and column headings #----------------------------------------------------------------------- table = JTable(data, headings, font=Font('Courier', Font.PLAIN, 12)) frame.add(JScrollPane(table), 'Center') frame.pack() self.center(frame) frame.setVisible(1)
def __init__(self, parent, title, modal, app): border = BorderFactory.createEmptyBorder(5, 7, 5, 7) self.getContentPane().setBorder(border) self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS)) #Intro falsePositivePng = File.separator.join([app.SCRIPTDIR, "images", "icons", "not_error36.png"]) introLbl = JMultilineLabel(app.strings.getString("manual_false_positives_info")) introLbl.setMaxWidth(600) #Table table = JTable() columns = [app.strings.getString("Tool"), app.strings.getString("Check"), app.strings.getString("Error_id"), app.strings.getString("OSM_id")] self.tableModel = MyTableModel([], columns) table.setModel(self.tableModel) scrollPane = JScrollPane(table) scrollPane.setAlignmentX(0.0) #OK button btnPanel = JPanel(FlowLayout(FlowLayout.CENTER)) okBtn = JButton("OK", ImageProvider.get("ok"), actionPerformed=self.on_okBtn_clicked) btnPanel.add(okBtn) btnPanel.setAlignmentX(0.0) #Layout headerPnl = JPanel() headerPnl.setLayout(BoxLayout(headerPnl, BoxLayout.X_AXIS)) headerPnl.add(JLabel(ImageIcon(falsePositivePng))) headerPnl.add(Box.createRigidArea(Dimension(10, 0))) headerPnl.add(introLbl) headerPnl.setAlignmentX(0.0) self.add(headerPnl) self.add(Box.createRigidArea(Dimension(0, 10))) self.add(scrollPane) self.add(Box.createRigidArea(Dimension(0, 10))) self.add(btnPanel) self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE) self.pack()
def getContentPane(): global contentPane global devicesList global devicesPanel if not contentPane: global devicesListLabel devicesListLabel = JLabel("Devices") global devicesList devicesList = JList([]) devicesList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) listScroller = JScrollPane(devicesList) listScroller.setPreferredSize(Dimension(600, 400)) global connectButton global focusButton allDevsButton = JButton(ALL_DEVICES, actionPerformed=handleAllDevsBtn) connectedDevsButton = JButton(CONNECTED_DEVICES, actionPerformed=handleConnectedDevBtn) connectButton = JButton(CONNECT, actionPerformed=handleConnectBtn) focusButton = JButton(FOCUS, actionPerformed=handleFocusBtn) focusButton.setVisible(False) goInButton = JButton("Go in device", actionPerformed=handleGoInBtn) deviceListButtons = JPanel() deviceListButtons.add(allDevsButton) deviceListButtons.add(connectedDevsButton) deviceListButtons.add(connectButton) deviceListButtons.add(focusButton) deviceListButtons.add(goInButton) devicesPanel = JPanel() devicesPanel.setLayout(BoxLayout(devicesPanel, BoxLayout.Y_AXIS)) devicesPanel.add(devicesListLabel) devicesPanel.add(listScroller) devicesPanel.add(deviceListButtons) contentPane = JPanel() contentPane.setLayout(BorderLayout()) contentPane.add(devicesPanel, BorderLayout.WEST) contentPane.add(getControlPanel(), BorderLayout.EAST) contentPane.add(getScreenPanel(), BorderLayout.CENTER) getScreenPanel().setVisible(False) return contentPane
def __fillQuestions(self): panel = JPanel() panel.setLayout(GridBagLayout()) panel.setBorder(None) c = GridBagConstraints() c.gridx = 0 c.gridy = 0 c.weightx = 1.0 c.fill = GridBagConstraints.HORIZONTAL c.anchor = GridBagConstraints.PAGE_START line = 0 for question in self.test.getQuestions(): c.gridy = line panel.add(question.getPanel().asJComponent(),c) line += 1 scrollPanel = JScrollPane(panel) scrollPanel.setBorder(None) self.questionsContainer.setLayout(BorderLayout()) self.questionsContainer.add(scrollPanel, BorderLayout.CENTER)
def initUI(self): global outputTextField self.panel = JPanel() self.panel.setLayout(BorderLayout()) toolbar = JToolBar() openb = JButton("Choose input file", actionPerformed=self.onClick) outputLabel = JLabel(" Enter output file name: ") outputTextField = JTextField("hl7OutputReport.txt", 5) print outputTextField.getText() toolbar.add(openb) toolbar.add(outputLabel) toolbar.add(outputTextField) self.area = JTextArea() self.area.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) self.area.setText("Select your HL7 ORU messages text file to be converted to tab-delimited flat \nfile with select HL7 fields.\n") self.area.append("You can enter the path + file name for your output file or it will default to the current \nfile name in the text field above in your current working directory.") pane = JScrollPane() pane.getViewport().add(self.area) self.panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) self.panel.add(pane) self.add(self.panel) self.add(toolbar, BorderLayout.NORTH) self.setTitle("HL7 ORU Results Reporter") self.setSize(600, 300) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True) return outputTextField.getText()
def initComponents(self): self.panel = JPanel() self.panel.setLayout(BorderLayout()) toolbar = JToolBar() openb = JButton("Select", actionPerformed=self.onClick) toolbar.add(openb) self.area = JTextArea() self.area.setBorder(BorderFactory.createEmptyBorder(10, 100, 10, 100)) pane = JScrollPane() pane.getViewport().add(self.area) self.panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) self.panel.add(pane) self.add(self.panel) self.add(toolbar)
class BurpExtender(IBurpExtender, IContextMenuFactory, ITab): def registerExtenderCallbacks(self, callbacks): self.callbacks = callbacks self.helpers = callbacks.helpers self.console = Console(self, namespace={ 'callbacks': callbacks, 'helpers': callbacks.helpers, }) self.scrollpane = JScrollPane() self.scrollpane.setViewportView(self.console.textpane) callbacks.setExtensionName("Jython Console") callbacks.addSuiteTab(self) callbacks.registerContextMenuFactory(self) callbacks.customizeUiComponent(self.getUiComponent()) def getUiComponent(self): return self.scrollpane def getTabCaption(self): return "Console" def createMenuItems(self, invocation): menus = [] messages = invocation.getSelectedMessages() if messages: items = self.interpreter.getLocals().get('items', []) context = 'Assign' if not items else 'Append' menu = JMenuItem("%s to local variable items in Console" % (context, )) menu.addActionListener(AssignLocalsActionListener(self, 'items', messages)) menus.append(menu) return menus @property def interpreter(self): return self.console.interp
def setup_edit_area(self, split_orientation=None): ''' Check if the ATF text area is being displayed in a split editor. If so, resets to normal JScrollPane. If not, splits the screen. ''' if isinstance(self.container, JSplitPane): # If Nammu is already displaying a split pane, reset to original # setup self.container = JScrollPane(self.edit_area) self.container.setRowHeaderView(self.line_numbers_area) self.container.setVisible(True) self.add(self.container, BorderLayout.CENTER) else: # If there is not a split pane, create both panels and setup view main_editor = JScrollPane(self.edit_area) main_editor.setRowHeaderView(self.line_numbers_area) secondary_editor = JScrollPane(self.secondary_area) secondary_editor.setRowHeaderView(self.secondary_line_numbers) self.container = JSplitPane(split_orientation, main_editor, secondary_editor) self.container.setDividerSize(5) self.container.setVisible(True) self.container.setDividerLocation(0.5) self.container.setResizeWeight(0.5) self.add(self.container, BorderLayout.CENTER)
def __init__(self): self.frame = JFrame('Hello, Jython!', defaultCloseOperation=JFrame.EXIT_ON_CLOSE, size=(400, 600)) bag_layout = GridBagLayout() self.frame.layout = bag_layout grid_constraints = GridBagConstraints() format_1_string_label = JLabel("Format 1 string:") grid_constraints.weightx = 0.1 grid_constraints.weighty = 0.1 grid_constraints.gridy = 0 grid_constraints.fill = GridBagConstraints.NONE self._add_component(format_1_string_label, bag_layout, grid_constraints) self.input_textbox = JTextArea() grid_constraints.weightx = 1 grid_constraints.weighty = 1 grid_constraints.gridy = 1 grid_constraints.fill = GridBagConstraints.BOTH input_scroll_pane = JScrollPane(self.input_textbox) input_scroll_pane.verticalScrollBarPolicy = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS self._add_component(input_scroll_pane, bag_layout, grid_constraints) output_string_label = JLabel("Output:") grid_constraints.weightx = 0.1 grid_constraints.weighty = 0.1 grid_constraints.gridy = 2 grid_constraints.fill = GridBagConstraints.NONE self._add_component(output_string_label, bag_layout, grid_constraints) self.output_textbox = JTextArea() grid_constraints.weightx = 1 grid_constraints.weighty = 1 grid_constraints.gridy = 3 grid_constraints.fill = GridBagConstraints.BOTH self.output_textbox.editable = False output_scroll_pane = JScrollPane(self.output_textbox) output_scroll_pane.verticalScrollBarPolicy = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS self._add_component(output_scroll_pane, bag_layout, grid_constraints)
def __init__(self, interface): self.interface = interface self.frame = JFrame("Python Window") tabs = JTabbedPane() # Create Interactive Pane interactive_pane = JPanel(BorderLayout()) scrollpane = JScrollPane() inputPanel = JPanel() inputPanel.layout = GridLayout(1, 1) self.check_disabled = LockManager() self.input = InteractiveInput(self.check_disabled, self.runcode) self.input.component.document.addDocumentListener(self) inputPanel.add(self.input.component) self.outputpane = OutputPane() scrollpane.viewport.view = self.outputpane.textpane interactive_pane.add(scrollpane, BorderLayout.CENTER) interactive_pane.add(inputPanel, BorderLayout.PAGE_END) # Create Script Pane script_pane = JPanel(BorderLayout()) scrollpane = JScrollPane() self.script_area = script_area = InputPane() line_numbers = LineNumbering(self.script_area.component) scrollpane.viewport.view = self.script_area.component scrollpane.rowHeaderView = line_numbers.component script_pane.add(scrollpane, BorderLayout.CENTER) tabs.addTab("Interactive", interactive_pane) tabs.addTab("Script", script_pane) self.frame.add(tabs) self.frame.size = 500, 600 self.frame.visible = False self.component = None self.make_menubar() self.history = InputHistory()
def __init__(self): super(IntroDialog, self).__init__() # Open the text file and make a text pane textPane = JTextPane() textPane.editable = False scrollPane = JScrollPane(textPane) scrollPane.preferredSize = (32767, 32767) # just a large number with open(self.INFO_FILE, 'r') as fd: infoText = fd.read().decode('utf8').replace( "@version@", JESVersion.VERSION ) textPane.text = infoText # Load the scroll pane into the layout self.add(scrollPane, BorderLayout.CENTER) # Make an OK button self.okButton = JButton(self.ok) self.buttonPanel.add(self.okButton)