def initUI(self): basic = JPanel() basic.setLayout(BoxLayout(basic, BoxLayout.Y_AXIS)) self.add(basic) basic.add(Box.createVerticalGlue()) bottom = JPanel() bottom.setAlignmentX(1.0) bottom.setLayout(BoxLayout(bottom, BoxLayout.X_AXIS)) #okButton = JButton("OK", actionPerformed=self.onQuit) self.text_area = JTextArea(editable = False, wrapStyleWord = True, lineWrap = True,) basic.add(self.text_area) self.text_area.text=str(config.DHOSTS) closeButton = JButton(u"Close 关闭", actionPerformed=self.onQuit) #bottom.add(okButton) bottom.add(Box.createRigidArea(Dimension(5, 0))) bottom.add(closeButton) bottom.add(Box.createRigidArea(Dimension(15, 0))) basic.add(bottom) basic.add(Box.createRigidArea(Dimension(0, 15))) self.setTitle(u"A DNS Proxy using TCP...一个使用TCP协议的DNS代理") self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setSize(500, 300) self.setLocationRelativeTo(None) self.setVisible(True)
def mplab_configure_Kconfig(confName): global app global project_dir if os.getcwd() != project_dir: os.chdir(project_dir) # log.info("mplab_configure_Kconfig: " + confName) dot_config_file = os.path.join(project_dir, confName + ".config") if not os.path.isfile(dot_config_file): # Create empty default.config file if it does not exist open(dot_config_file, 'a').close() kconfig_file = os.path.join(os.getcwd(), "Kconfig") # Set up GUI mpconfigPanel = JPanel() if os.path.isfile(kconfig_file): app = MPConfig(kconfig_file, dot_config_file, log) mpconfigPanel = app.getPane() rootPanel = JPanel() rootPanel.setLayout(BorderLayout()) rootPanel.add(mpconfigPanel, BorderLayout.CENTER) return rootPanel
def tree(): """ tree(xmlfile="dsm2.xml") creates a tree view on a given xml file of dsm2 input data """ tv = TreeViewer() mp2 = JPanel() mp2.setLayout(BorderLayout()) tf = JTextField("dsm2.inp") pb = JButton("parse") mp2.add(tf,BorderLayout.CENTER) mp2.add(pb,BorderLayout.EAST) class ParseListener(ActionListener): def __init__(self,tf,tv,fr): self.tf = tf self.tv = tv self.fr = fr def actionPerformed(self,evt): dsm2file = self.tf.getText() parser = DSM2Parser(dsm2file) self.tv.xdoc = parser.dsm2_data.toXml() self.fr.getContentPane().add(self.tv.gui(),BorderLayout.CENTER) self.fr.pack() self.fr.setVisible(1) fr = JFrame() fr.setTitle("DSM2Tree") fr.setLocation(100,100) fr.setSize(600,60) fr.getContentPane().setLayout(BorderLayout()) fr.getContentPane().add(mp2,BorderLayout.NORTH) al = ParseListener(tf,tv,fr) pb.addActionListener(al) fr.pack() fr.setVisible(1)
def addMetadata(self, objectID, project, language): """ Add a JTable at the top of the object tab containing the metadata of the object presented in that tab. """ metadataPanel = JPanel() # TODO: Need to count protocols to set up Grid dimension metadataPanel.setLayout(GridLayout(3, 2)) projectLabel = JLabel("Project: ") projectValue = JLabel(project) languageLabel = JLabel("Language: ") languageValue = JLabel(language) # If language code is in the settings, then display name instead # of code for lang, code in self.languages.iteritems(): if code == language: languageValue.setText(lang) # TODO Protocols not yet in parsed object protocolsLabel = JLabel("ATF Protocols: ") protocolsBox = JComboBox(self.protocols) metadataPanel.add(projectLabel) metadataPanel.add(projectValue) metadataPanel.add(languageLabel) metadataPanel.add(languageValue) metadataPanel.add(protocolsLabel) metadataPanel.add(protocolsBox) # Add metadataPanel to object tab in main panel self.objectTabs[objectID].add(metadataPanel)
def __init__(self, parent, title, modal, app): JDialog.__init__(self, parent, title, modal) #Download and Read Dialog border = BorderFactory.createEmptyBorder(5, 7, 5, 7) self.getContentPane().setBorder(border) self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS)) panel = JPanel() panel.setAlignmentX(0.5) panel.setLayout(BoxLayout(panel, BoxLayout.Y_AXIS)) panel.add(Box.createRigidArea(Dimension(0, 10))) self.progressLbl = JLabel( app.strings.getString("downloading_and_reading_errors")) panel.add(self.progressLbl) panel.add(Box.createRigidArea(Dimension(0, 10))) self.progressBar = JProgressBar(0, 100, value=0) panel.add(self.progressBar) self.add(panel) self.add(Box.createRigidArea(Dimension(0, 20))) cancelBtn = JButton(app.strings.getString("cancel"), ImageProvider.get("cancel"), actionPerformed=app.on_cancelBtn_clicked) cancelBtn.setAlignmentX(0.5) self.add(cancelBtn) self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE) self.pack()
def startGui(self): # self.gridPanel = JPanel(GridLayout(self.numRows, self.numCols)) # self.cellButtons = self._doForAllCells(self._createCellButton) # self.grid = self._doForAllCells(lambda r,c: False) # frame.add(self.gridPanel) # buttonPanel = JPanel(FlowLayout()) # stepButton = JButton("Step", actionPerformed=self._step) # runButton = JToggleButton("Run", actionPerformed=self._run) # buttonPanel.add(stepButton) # buttonPanel.add(runButton) # frame.add(buttonPanel, SOUTH) # frame.pack() # frame.locationRelativeTo = None self.setMenuBar() image_path = "D:\\wamp\\www\\holdem\\src\\poker\\th\\images\\As.png" myPicture = ImageIcon(image_path) myPictureLabel = JLabel("Pocket: ", myPicture, JLabel.LEFT) cardPanel = JPanel() cardPanel.setLayout(None) cardPanel.add(myPictureLabel) myPictureLabel.setBounds(10,10,36,52); self._frame.getContentPane().add(cardPanel) self.msg=JLabel("Hello") self._frame.add(self.msg, NORTH) self._frame.locationRelativeTo = None self._frame.visible = True
def __init__(self, channels): JFrame.__init__(self, "Informa Example News Client") self.setSize(400, 400) self.addWindowListener(BasicWindowMonitor()) self.channels = channels self.channel_dict = None self.channelTree = None self.channelPanel = None self.itemTable = None self.mediator = MainMediator(self) # items (in table) itemScrollPane = JScrollPane(self.getItemTable()) # channels (as tree) channelScrollPane = JScrollPane(self.getChannelTree()) # put together channel info with item table ch_and_items = JPanel() ch_and_items.setLayout(BorderLayout()) ch_and_items.add(self.getChannelPanel(), BorderLayout.NORTH) ch_and_items.add(itemScrollPane, BorderLayout.CENTER) # final step sp = JSplitPane(JSplitPane.HORIZONTAL_SPLIT, channelScrollPane, ch_and_items) # print "dividerLocation", sp.getDividerLocation() # sp.setDividerLocation(0.5) self.getContentPane().add(sp, BorderLayout.CENTER)
def addMetadata(self, objectID, project, language): """ Add a JTable at the top of the object tab containing the metadata of the object presented in that tab. """ metadataPanel = JPanel() # TODO: Need to count protocols to set up Grid dimension metadataPanel.setLayout(GridLayout(3,2)) projectLabel = JLabel("Project: ") projectValue = JLabel(project) # TODO Check language not found languageLabel = JLabel("Language: ") languageValue = JLabel(self.languages[language]) # TODO Protocols not yet in parsed object protocolsLabel = JLabel("ATF Protocols: ") protocolsBox = JComboBox() # for protocol in protocols: # protocolBox.add(protocol) metadataPanel.add(projectLabel) metadataPanel.add(projectValue) metadataPanel.add(languageLabel) metadataPanel.add(languageValue) metadataPanel.add(protocolsLabel) metadataPanel.add(protocolsBox) # Add metadataPanel to object tab in main panel self.objectTabs[objectID].add(metadataPanel) # TODO: def addSide(self, sideType, content):
class YourPhoneWithUISettingsPanel( IngestModuleIngestJobSettingsPanel ): # These are just in case we end up needing an UI # Note, we can't use a self.settings instance variable. # Rather, self.local_settings is used. # https://wiki.python.org/jython/UserGuide#javabean-properties # Jython Introspector generates a property - 'settings' on the basis # of getSettings() defined in this class. Since only getter function # is present, it creates a read-only 'settings' property. This auto- # generated read-only property overshadows the instance-variable - # 'settings' # We get passed in a previous version of the settings so that we can # prepopulate the UI def __init__(self, settings): self.local_settings = settings self.initComponents() 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.add(self.panel1) # Return the settings used def getSettings(self): return self.local_settings
def getScreenPanel(): global mainScreen global scrPanel if not scrPanel: mainScreen = JButton() cursorImg = BufferedImage(16,16,BufferedImage.TYPE_INT_ARGB) blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, Point(0,0), "blank cursor") mainScreen.setCursor(blankCursor) mainScreen.setPreferredSize( Dimension(700, 700)) image = BufferedImage(700, 700, BufferedImage.TYPE_INT_ARGB) g = image.createGraphics() g.setColor(Color.BLACK) g.fillRect(0, 0, 700, 700) g.setColor(Color.WHITE) g.setFont(Font("Serif", Font.BOLD, 20)) g.drawString("Move your mouse here to controlfocused device.", 50, 30) mainScreenImg = image mainScreen.setIcon(swing.ImageIcon(image)) mouseListener = ScrMouseListener() mainScreen.addMouseListener(mouseListener) mainScreen.addMouseMotionListener(mouseListener) mainScreen.addMouseWheelListener(mouseListener) mainScreen.setFocusable(True) keyListener = ScrKeyListener() mainScreen.addKeyListener(keyListener) scrPanel = JPanel() scrPanel.setLayout(BoxLayout(scrPanel, BoxLayout.Y_AXIS)) scrPanel.add(mainScreen) scrPanel.setFocusable(True) return scrPanel
def helpMenu(self,event): self._helpPopup = JFrame('JWT Fuzzer', size=(550, 450) ); self._helpPopup.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE) helpPanel = JPanel() helpPanel.setPreferredSize(Dimension(550, 450)) helpPanel.setBorder(EmptyBorder(10, 10, 10, 10)) helpPanel.setLayout(BoxLayout(helpPanel, BoxLayout.Y_AXIS)) self._helpPopup.setContentPane(helpPanel) helpHeadingText = JLabel("<html><h2>JWT Fuzzer</h2></html>") authorText = JLabel("<html><p>@author: <pinnace></p></html>") aboutText = JLabel("<html><br /> <p>This extension adds an Intruder payload processor for JWTs.</p><br /></html>") repositoryText = JLabel("<html>Documentation and source code:</html>") repositoryLink = JLabel("<html>- <a href=\"https://github.com/pinnace/burp-jwt-fuzzhelper-extension\">https://github.com/pinnace/burp-jwt-fuzzhelper-extension</a></html>") licenseText = JLabel("<html><br/><p>JWT Fuzzer uses a GPL 3 license. This license does not apply to the dependency below:<p></html>") dependencyLink = JLabel("<html>- <a href=\"https://github.com/jpadilla/pyjwt/blob/master/LICENSE\">pyjwt</a></html>") dependencyLink.addMouseListener(ClickListener()) dependencyLink.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)) repositoryLink.addMouseListener(ClickListener()) repositoryLink.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)) helpPanel.add(helpHeadingText) helpPanel.add(authorText) helpPanel.add(aboutText) helpPanel.add(repositoryText) helpPanel.add(repositoryLink) helpPanel.add(licenseText) helpPanel.add(dependencyLink) self._helpPopup.setSize(Dimension(550, 450)) self._helpPopup.pack() self._helpPopup.setLocationRelativeTo(None) self._helpPopup.setVisible(True) return
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 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 initUI(self): panel = JPanel() panel.setLayout(None) panel.setBackground(Color(66, 66, 66)) self.getContentPane().add(panel) rot = ImageIcon("input.png") rotLabel = JLabel(rot) rotLabel.setBounds(20, 20, rot.getIconWidth(), rot.getIconHeight()) min = ImageIcon("cpuoutput.png") minLabel = JLabel(min) minLabel.setBounds(40, 160, min.getIconWidth(), min.getIconHeight()) bar = ImageIcon("inputdata.png") barLabel = JLabel(bar) barLabel.setBounds(170, 50, bar.getIconWidth(), bar.getIconHeight()) panel.add(rotLabel) panel.add(minLabel) panel.add(barLabel) self.setTitle("Absolute") self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setSize(350, 300) self.setLocationRelativeTo(None) self.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 gui(self): xnode = self.xdoc.getDocumentElement() tnode = self.createTree(xnode) # create tree and display jt = JTree(tnode) jsp = JScrollPane(jt) tree_box = Box(BoxLayout.Y_AXIS) tree_box.add(jsp) tree_box.add(Box.createHorizontalStrut(10)) headerSorter = TableSorter(DefaultTableModel()) jtb = JTable(headerSorter) headerSorter.addMouseListenerToHeaderInTable(jtb) jtb.setAutoResizeMode(JTable.AUTO_RESIZE_OFF) jsp2 = JScrollPane(jtb) table_box = Box(BoxLayout.Y_AXIS) table_box.add(jsp2) table_box.add(Box.createHorizontalStrut(500)) mp = JPanel() mp.setLayout(BoxLayout(mp,BoxLayout.X_AXIS)) mp.add(tree_box) mp.add(table_box) # add listeners nsl = NodeSelectionListener(jtb,xnode) jt.addTreeSelectionListener(nsl) # return mp
def build_buttons_row(self): ''' Add OK/Cancel/Blank buttons. ''' # Build own panel with SpringLayout. panel = JPanel() layout = SpringLayout() panel.setLayout(layout) # Create necessary components and add them to panel. create_button = JButton('Create template', actionPerformed=self.create_template) leave_button = JButton('Leave blank', actionPerformed=self.blank) cancel_button = JButton('Cancel', actionPerformed=self.cancel) panel.add(create_button) panel.add(leave_button) panel.add(cancel_button) # Set up constraints to tell panel how to position components. layout.putConstraint(SpringLayout.WEST, create_button, 15, SpringLayout.WEST, panel) layout.putConstraint(SpringLayout.NORTH, create_button, 15, SpringLayout.NORTH, panel) layout.putConstraint(SpringLayout.WEST, leave_button, 5, SpringLayout.EAST, create_button) layout.putConstraint(SpringLayout.NORTH, leave_button, 15, SpringLayout.NORTH, panel) layout.putConstraint(SpringLayout.WEST, cancel_button, 5, SpringLayout.EAST, leave_button) layout.putConstraint(SpringLayout.NORTH, cancel_button, 15, SpringLayout.NORTH, panel) layout.putConstraint(SpringLayout.EAST, panel, 15, SpringLayout.EAST, cancel_button) layout.putConstraint(SpringLayout.SOUTH, panel, 10, SpringLayout.SOUTH, cancel_button) # Add this to NewAtf JFrame return panel
def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) # self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) panel1 = JPanel() panel1.setLayout(BoxLayout(panel1, BoxLayout.Y_AXIS)) panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.labelPythonPathText = JLabel("Python path: ") self.textFieldPythonPath = JTextField(1) self.buttonSavePythonPath = JButton("Save", actionPerformed=self.textFieldEventPythonPath) self.labelCheckText = JLabel("Run recoveries: ") self.checkboxUndark = JCheckBox("Undark", actionPerformed=self.checkBoxEventUndark) self.checkboxMdg = JCheckBox("MGD Delete Parser", actionPerformed=self.checkBoxEventMdg) self.checkboxCrawler = JCheckBox("WAL Crawler", actionPerformed=self.checkBoxEventCrawler) self.checkboxB2l = JCheckBox("bring2lite", actionPerformed=self.checkBoxEventB2l) self.checkboxUndark.setSelected(True) self.checkboxMdg.setSelected(True) self.add(self.labelPythonPathText) panel1.add(self.textFieldPythonPath) panel1.add(self.buttonSavePythonPath) panel1.add(self.labelCheckText) panel1.add(self.checkboxUndark) panel1.add(self.checkboxMdg) panel1.add(self.checkboxCrawler) panel1.add(self.checkboxB2l) self.add(panel1)
def __init__(self, parent, title, modal, app): JDialog.__init__(self, parent, title, modal) #Download and Read Dialog border = BorderFactory.createEmptyBorder(5, 7, 5, 7) self.getContentPane().setBorder(border) self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS)) panel = JPanel() panel.setAlignmentX(0.5) panel.setLayout(BoxLayout(panel, BoxLayout.Y_AXIS)) panel.add(Box.createRigidArea(Dimension(0, 10))) self.progressLbl = JLabel(app.strings.getString("downloading_and_reading_errors")) panel.add(self.progressLbl) panel.add(Box.createRigidArea(Dimension(0, 10))) self.progressBar = JProgressBar(0, 100, value=0) panel.add(self.progressBar) self.add(panel) self.add(Box.createRigidArea(Dimension(0, 20))) cancelBtn = JButton(app.strings.getString("cancel"), ImageProvider.get("cancel"), actionPerformed=app.on_cancelBtn_clicked) cancelBtn.setAlignmentX(0.5) self.add(cancelBtn) self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE) self.pack()
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)
class DirChooser(JFrame): def __init__(self): super(DirChooser, self).__init__() self.initUI() def initUI(self): self.panel = JPanel() self.panel.setLayout(BorderLayout()) chooseFile = JFileChooser() chooseFile.setDialogTitle("Select Export Location") chooseFile.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY) ret = chooseFile.showSaveDialog(self.panel) if ret == JFileChooser.APPROVE_OPTION: self.file_name = str(chooseFile.getSelectedFile()) if not chooseFile.getSelectedFile().isDirectory(): mkdirp(self.file_name) def get_file_name(self): return self.file_name
def buildScope(self, state, callbacks): """ Builds the scope pane in the configuration page """ scope = JPanel() scope.setLayout(None) scope.setMaximumSize(Dimension(self.CONFIG_PAGE_WIDTH, 300)) title = self.getTitle("Scope Selection", 20, 10) refresh = self.getButton("Refresh", 20, 50) refresh.addActionListener(self.callbacks.refreshButtonClicked) textarea = self.getTextArea() state.scopeTextArea = textarea.viewport.view scopeText = callbacks.loadExtensionSetting("scopes") state.scopeTextArea.setText(scopeText) scope.add(title) scope.add(refresh) scope.add(textarea) if scopeText: refresh.doClick() # refresh automatically to save users one click. return scope
def buildSessionCheck(self, state, callbacks): """ Builds the session check portion of the config page """ rules = JPanel() rules.setLayout(None) rules.setMaximumSize(Dimension(self.CONFIG_PAGE_WIDTH, 300)) title = self.getTitle("Session Check", 20, 10) check = self.getButton("Check", 20, 50) check.addActionListener(self.callbacks.checkButtonClicked) resendAll = self.getButton("Resend ALL", 20, 90) resendAll.addActionListener(self.callbacks.resendAllButtonClicked) fuzz = self.getButton("FUZZ", 20, 130) fuzz.addActionListener(self.callbacks.fuzzButtonClicked) textarea = self.getTextArea() state.sessionCheckTextarea = textarea.viewport.view state.sessionCheckTextarea.setText( callbacks.loadExtensionSetting("scopeCheckRequest")) rules.add(title) rules.add(check) rules.add(resendAll) rules.add(fuzz) rules.add(textarea) return rules
def initUI(self): """ Finished Dialog box Simple dialog box that says "Finished", to bw displayed when all image analysis has finished. When OK button is pressed all ImageJ windows are closed. """ panel = JPanel() self.getContentPane().add(panel) panel.setBackground(Color.WHITE) panel.setLayout(None) self.setTitle("Analysis has finished") self.setSize(300, 150) OKbutton = JButton("OK", actionPerformed=self.onOK) OKbutton.setBackground(Color.BLACK) OKbutton.setBounds(80, 50, 100, 30) panel.add(OKbutton) Title = JTextArea("Analysis has finised!! :-)") Title.setBounds(15, 10, 250, 20) panel.add(Title) self.setLocationRelativeTo(None) self.setLocation(int(IJ.getScreenSize().width * 0.01), int(IJ.getScreenSize().height * 3 / 10)) self.setVisible(True)
def __init__(self,hostname): self.hostname=hostname JPanel.__init__(self,BorderLayout()) self.cbActionListener=foo2(self) #imglist=os.listdir('./img') #try:imglist.remove('.svn') #except:pass imglist=['01-CircleOfFifths.gif','Fifths.png','circle-o-fifths.jpg','Circle_Of_Fifths.gif','Keywheel.gif','circle-of-fifths.gif','ColorFifths.jpg','cof.gif'] self.cb=JComboBox(imglist,actionListener=self.cbActionListener)# #self.cb.addItemListener(self.cbCB) tb=JPanel() tb.setLayout(FlowLayout(FlowLayout.CENTER)) tb.add(self.cb) self.add(tb,'Center') self.img=None if hostname[0:7]=='http://': self.img=ImageIO.read(URL(self.hostname+'/static/sightreadingtrainer/img/'+imglist[0])) else: self.img=ImageIO.read(File(self.hostname+'img/'+imglist[0])) icon=ImageIcon(self.img) self.label=JLabel(icon) self.add(self.label,'North')
def __init__(self, cattrs): #JDialog.__init__(self,"Curve Attribute Editor") #("Curve Attribute Editor") if cattrs == None or len(cattrs) == 0: raise "No curve attributes specified" self.attrs = cattrs self.cpanel = EditCurveAttr(cattrs[0]) pane = self.getContentPane() pane.setLayout(BorderLayout()) x = map(lambda x: x+1,range(len(self.attrs))) self.curveBox = JComboBox(x) self.curveBox.setBorder(BorderFactory.createTitledBorder("Curve #")) self.curveBox.setSelectedItem(0) class CListener(ItemListener): def __init__(self,cbox,cpanel,cattrs): self.cbox = cbox self.cpanel = cpanel self.attrs = cattrs def itemStateChanged(self, evt): crvNo = self.cbox.getSelectedItem() self.cpanel.update() self.cpanel.setAttribute(self.attrs[crvNo-1]) self.curveBox.addItemListener(CListener(self.curveBox, self.cpanel,self.attrs)) okBtn = JButton("OK",actionPerformed=self.ok_action) cancelBtn = JButton("Cancel",actionPerformed=self.cancel_action) btnPanel = JPanel() btnPanel.setLayout(GridLayout(1,3)) btnPanel.add(self.curveBox) btnPanel.add(okBtn) btnPanel.add(cancelBtn) pane.add(self.cpanel,BorderLayout.CENTER) pane.add(btnPanel, BorderLayout.SOUTH) self.setLocation(100,100) self.pack() self.setVisible(1)
def initUI(self): panel = JPanel(size=(50, 50)) panel.setLayout(BorderLayout()) panel.setToolTipText("A Panel container") joclButton = JButton("JOCL") joclButton.setBounds(100, 500, 100, 30) joclButton.setToolTipText("JOCL Button") panel.add(joclButton) qButton = JButton("Quit", actionPerformed=self.onQuit) qButton.setBounds(200, 500, 80, 30) qButton.setToolTipText("Quit Button") panel.add(qButton) inputImage = ImageIcon("input.png") #JLabel imageLabel = inputImage label1 = JLabel(inputImage) label1.setBounds(1, 1, inputImage.getIconWidth(), inputImage.getIconHeight()) #label1.setVerticalTextPosition(JLabel.BOTTOM) #label1.setHorizontalTextPosition(JLabel.CENTER) #label1.setSize(1,1) panel.add(label1) self.getContentPane().add(panel) self.setTitle("GPU Demo") self.setSize(1200, 600) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True)
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) 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)
class FileSelector(JFrame): """ Opens a file selector dialog """ def __init__(self, hidden=False, dir_only=False, title='', defaultFile=''): super(FileSelector, self).__init__() self.file_name = None self.initUI(hidden, dir_only, title, defaultFile) def initUI(self, hidden, dir_only, title, defaultFile): self.panel = JPanel() self.panel.setLayout(BorderLayout()) chosenFile = JFileChooser() chosenFile.setSelectedFile(File(defaultFile)) chosenFile.setDialogTitle(title) if dir_only: chosenFile.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY) chosenFile.setFileHidingEnabled(hidden) ret = chosenFile.showOpenDialog(self.panel) if ret == JFileChooser.APPROVE_OPTION: if dir_only: if chosenFile.getSelectedFile().isDirectory(): self.file_name = str(chosenFile.getSelectedFile()) else: self.file_name = str(chosenFile.getSelectedFile()) def get_file_name(self): return self.file_name
class Panel_Remove_Cookies(JPanel): def _button_update_pressed(self, msg): listElements = self._rowpanel1.getAllElements() if len(listElements) > 0: self.SHA_Remove_Cookies = SHA_Remove_Cookies(listElements) def __init__(self): self.setBorder(BorderFactory.createTitledBorder( "Setup a session handling action to" + " remove named cookies from Burp's" + " cookie jar")) self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) self._rowpanel1 = PTListPanel("Cookies to remove", []) self._rowpanel2 = JPanel() self._rowpanel2.setLayout(BoxLayout(self._rowpanel2, BoxLayout.X_AXIS)) self._button_update = JButton( "Add a new \"Remove cookies\" session handler" " for these cookies", actionPerformed=self._button_update_pressed ) self._rowpanel2.add(Box.createHorizontalGlue()) self._rowpanel2.add(self._button_update) self.add(self._rowpanel1) self.add(self._rowpanel2)
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 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 _create_panel(self, message, widget): panel = JPanel() panel.setLayout(BoxLayout(panel, BoxLayout.Y_AXIS)) label = self._create_label(message) label.setAlignmentX(Component.LEFT_ALIGNMENT) panel.add(label) widget.setAlignmentX(Component.LEFT_ALIGNMENT) panel.add(widget) return panel
def addObject(self, objectID): """ Creates new empty JPanel that'll contain the model for one object in the ATF file. """ objectPanel = JPanel() objectPanel.setLayout(BoxLayout(objectPanel, BoxLayout.PAGE_AXIS)) self.objectTabs[objectID] = objectPanel
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
class PayloadView: """ PayloadView is a TextView viewer and editor. """ def __init__(self, payload=None, label=None): if not label: label = "PayloadView" self.this = JPanel() self.this.setLayout(BorderLayout()) # Add a label self.this.add(BorderLayout.PAGE_START, JLabel(label)) # Create textarea here and add to the JPanel scrollPane = JScrollPane() self._textarea = JTextArea() self._textarea.setColumns(20) self._textarea.setRows(5) self._textarea.setLineWrap(True) self._textarea.setWrapStyleWord(True) self._textarea.setEditable(True) self._textarea.setName("TextArea") self._textarea.setSelectionColor(Color(255, 153, 51)) self._textarea.requestFocus() scrollPane.setViewportView(self._textarea) self.this.add(BorderLayout.CENTER, scrollPane) self.refresh(payload) def set_editable(self, editable): """ Enable or Disable the editable textview :param editable: boolean parameter representing the editability :return: None """ self._textarea.setEditable(editable) def refresh(self, payload): """ Refresh the textarea content with a new payload, if present :param payload: :return: None """ if payload: self._textarea.setText(payload) def add_listener(self, listener): """ add a new listener to the textarea :param listener: this parameter should be a lambda or a method :return: None """ self._textarea.getDocument().addDocumentListener( _PayloadListener(listener))
class BurpExtender(IBurpExtender, IScannerCheck, ITab): def registerExtenderCallbacks(self, this_callbacks): global callbacks, helpers, checkbox_perHost, checkbox_common, checkbox_ssh, checkbox_key, checkbox_php, checkbox_sql callbacks = this_callbacks ui_label = JLabel('Scans to perform:') checkbox_perHost = self.defineCheckBox( 'Scan once per domain (web root only, not every subdirectory)') checkbox_common = self.defineCheckBox('Interesting files') checkbox_ssh = self.defineCheckBox('SSH private keys') checkbox_key = self.defineCheckBox('.key files') checkbox_php = self.defineCheckBox('PHP file scans') checkbox_sql = self.defineCheckBox('SQL file scans') self.tab = JPanel() layout = GroupLayout(self.tab) self.tab.setLayout(layout) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) layout.setHorizontalGroup( layout.createSequentialGroup().addComponent(ui_label).addGroup( layout.createParallelGroup( GroupLayout.Alignment.LEADING).addComponent( checkbox_common).addComponent(checkbox_ssh). addComponent(checkbox_key).addComponent(checkbox_php). addComponent(checkbox_sql)).addComponent(checkbox_perHost)) layout.setVerticalGroup(layout.createSequentialGroup().addGroup( layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent(ui_label). addComponent(checkbox_common).addComponent(checkbox_perHost) ).addComponent(checkbox_ssh).addComponent(checkbox_key).addComponent( checkbox_php).addComponent(checkbox_sql)) helpers = callbacks.getHelpers() callbacks.setExtensionName("Interesting Files Scanner") callbacks.registerScannerCheck(FileScanner()) callbacks.addSuiteTab(self) print 'Interesting Files Scanner' print 'Created by Sven Fassbender (@mezdanak, @modzero) v' + VERSION print 'https://github.com/modzero/interestingFileScanner' return def defineCheckBox(self, caption, selected=True, enabled=True): checkBox = JCheckBox(caption) checkBox.setSelected(selected) checkBox.setEnabled(enabled) return checkBox def getTabCaption(self): return "Interesting Files Scanner" def getUiComponent(self): return self.tab
def studentLogined(stObj): global panel global table global heading global frame frame = JFrame("Student Page ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500, 600) frame.setLocation(200, 200) frame.setLayout(None) panel = JPanel() panel.setSize(500, 580) panel.setLocation(0, 20) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.WHITE) heading = JLabel() heading.setBounds(210, 10, 200, 30) table = JTable() table.setBounds(0, 50, 500, 470) sp = JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) bar = JMenuBar() profile = JMenu("Profile") showProfile = JMenuItem("Show Profile", actionPerformed=clickShowStudentProfile) changePassword = JMenuItem("Change Password", actionPerformed=changeStudentPassword) profile.add(showProfile) profile.add(changePassword) bar.add(profile) attendence = JMenu("Attendence") showAllAttendence = JMenuItem("Show All Attendence", actionPerformed=clickAllAttendence) showAttendenceInMonth = JMenuItem("show attendence in month", actionPerformed=clickAttendenceInMonth) attendence.add(showAllAttendence) attendence.add(showAttendenceInMonth) bar.add(attendence) logout = JMenuItem("logout", actionPerformed=clickLogout) bar.add(logout) panel.add(table) frame.setJMenuBar(bar) frame.add(panel) frame.setVisible(True)
class SHA_panel(JPanel): def button_remove_pressed(self, msg): selected_indices = self.List.getSelectedIndices() selected_elements = [] for selected_index in selected_indices: selected_elements.append( self.listModel.getElementAt(selected_index) ) for sha in cb.callbacks.getSessionHandlingActions(): actionname = sha.getActionName() if actionname in selected_elements: cb.callbacks.removeSessionHandlingAction(sha) self.listModel.removeElement(actionname) def getAllElements(self): listElements = [] for x in range(self.listModel.getSize()): listElements.append(self.listModel.getElementAt(x)) return listElements 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 initGui(self): #~ if DEBUG: #~ import pdb; #~ pdb.set_trace() tabPane = JTabbedPane(JTabbedPane.TOP) CreditsText = "<html># Burp Custom Deserializer<br/># Copyright (c) 2016, Marco Tinari<br/>#<br/># This program is free software: you can redistribute it and/or modify<br/># it under the terms of the GNU General Public License as published by<br/># the Free Software Foundation, either version 3 of the License, or<br/># (at your option) any later version.<br/>#<br/># This program is distributed in the hope that it will be useful,<br/># but WITHOUT ANY WARRANTY; without even the implied warranty of<br/># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br/># GNU General Public License for more details.<br/>#<br/># You should have received a copy of the GNU General Public License<br/># along with this program. If not, see <http://www.gnu.org/licenses/>.)<br/></html>" label1 = JLabel("<html>Usage:<br>1 - Select the desired encoding functions<br>2 - Enter the name of the parameter in the input field below and press the Apply button!</html>") label2 = JLabel(CreditsText) panel1 = JPanel() #set layout panel1.setLayout(GridLayout(11,1)) panel2 = JPanel() panel1.add(label1) panel2.add(label2) tabPane.addTab("Configuration", panel1) tabPane.addTab("Credits", panel2) applyButton = JButton('Apply',actionPerformed=self.reloadConf) panel1.add(applyButton, BorderLayout.SOUTH) #define GET/POST/COOKIE radio button self.GETparameterTypeRadioButton = JRadioButton('GET parameter') self.POSTparameterTypeRadioButton = JRadioButton('POST parameter') self.COOKIEparameterTypeRadioButton = JRadioButton('COOKIE parameter') self.POSTparameterTypeRadioButton.setSelected(True) group = ButtonGroup() group.add(self.GETparameterTypeRadioButton) group.add(self.POSTparameterTypeRadioButton) group.add(self.COOKIEparameterTypeRadioButton) self.base64Enabled = JCheckBox("Base64 encode") self.URLEnabled = JCheckBox("URL encode") self.ASCII2HexEnabled = JCheckBox("ASCII to Hex") self.ScannerEnabled = JCheckBox("<html>Enable serialization in Burp Scanner<br>Usage:<br>1.Place unencoded values inside intruder request and define the placeholder positions<br>2.rightclick->Actively scan defined insertion points)</html>") self.IntruderEnabled = JCheckBox("<html>Enable serialization in Burp Intruder<br>Usage:<br>1.Place unencoded values inside intruder request and define the placeholder positions<br>2.Start the attack</html>") self.parameterName = JTextField("Parameter name goes here...",60) #set the tooltips self.parameterName.setToolTipText("Fill in the parameter name and apply") self.base64Enabled.setToolTipText("Enable base64 encoding/decoding") self.ASCII2HexEnabled.setToolTipText("Enable ASCII 2 Hex encoding/decoding") self.URLEnabled.setToolTipText("Enable URL encoding/decoding") self.IntruderEnabled.setToolTipText("Check this if You want the extension to intercept and modify every request made by the Burp Intruder containing the selected paramter") self.ScannerEnabled.setToolTipText("Check this if You want the extension to intercept and modify every request made by the Burp Scanner containing the selected paramter") #add checkboxes to the panel panel1.add(self.parameterName) panel1.add(self.POSTparameterTypeRadioButton) panel1.add(self.GETparameterTypeRadioButton) panel1.add(self.COOKIEparameterTypeRadioButton) panel1.add(self.base64Enabled) panel1.add(self.URLEnabled) panel1.add(self.ASCII2HexEnabled) panel1.add(self.IntruderEnabled) panel1.add(self.ScannerEnabled) #assign tabPane self.tab = tabPane
def hhwindow(): #creates a function called hhwindow, this is a function we will call whenever we want to create a new window global win,mytext #the global statement creates variables “win” and “mytext” that can be referenced outside of just this function win = swing.JFrame("Inside the Haunted House") #creates a window as a variable we named “win”, the title of the window is inside the quotes panel = JPanel() #creates a panel inside the window for text as a variable we named “panel” panel.setLayout(None) #controls layout of panel panel.setBackground(Color(0, 0, 0)) #sets background color of window win.setSize(600,400) #sets window size win.setVisible(True) #makes window visible mytextLabel = JLabel(mytext) #adds text to the window in the form of a variable, yet to be defined, called “mytext” mytextLabel.setBounds(20, 20, 500, 400) #sets boundaries for the text, text will be centered by default within these boundaries panel.add(mytextLabel) #add the label to the panel win.add(panel) #add the panel to the window win.show() #show the window
def makeScriptComboBox(list): from javax.swing import JComboBox, JButton, JPanel from java.awt.event import ActionListener jcb = JComboBox(list) jcb.setSelectedIndex(0) plot_btn = JButton("Plot station") # create a Python class class PlotButtonAction(ActionListener): # defines a constructor def __init__(self, combo_box): self.cb = combo_box def actionPerformed(self, event): plotStation(self.cb.getSelectedIndex(), None) # registers an instance of the action object with the button plot_btn.addActionListener(PlotButtonAction(jcb)) # alltw_btn = JButton("All Data") class AllButtonAction(ActionListener): # defines a constructor def __init__(self, combo_box): self.cb = combo_box def actionPerformed(self, event): plotStation(self.cb.getSelectedIndex(), 1) alltw_btn.addActionListener(AllButtonAction(jcb)) # quit_btn = JButton("Quit") class QuitButtonAction(ActionListener): # defines a constructor def __init__(self, combo_box): self.cb = combo_box def actionPerformed(self, event): fr.dispose() quit_btn.addActionListener(QuitButtonAction(jcb)) # add both button and combo box to a panel panel = JPanel() panel.setLayout(GridLayout(2, 2)) panel.add(alltw_btn) panel.add(jcb) panel.add(plot_btn) panel.add(quit_btn) return panel
def initUI(self): panel = JPanel() panel.setLayout(None) panel.setBackground(Color(66,66,66)) self.getContentPane().add(panel) #rot = ImageIcon() #rotLabel = JLabel(rot) #rotLabel.setBounds(40, 160, min.getIconWidth(), rot.getIconHeight()) self.setTitle("Layout Absoluto") self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setSize(350, 300) self.setLocationRelativeTo(None) self.setVisible(True)
def initUI(self): panel = JPanel() self.getContentPane().add(panel) panel.setLayout(None) qbutton = JButton("Quit", actionPerformed=self.onQuit) qbutton.setBounds(50, 60, 80, 30) panel.add(qbutton) self.setTitle("Quit Button") self.setSize(300, 200) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True)
def getContentPane(): global contentPane global REMAP_WIDTH global REMAP_HEIGHT global MARGIN if not contentPane: global mainScreen global mainScreenImg mainScreen = JLabel() cursorImg = BufferedImage(16,16,BufferedImage.TYPE_INT_ARGB) blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, Point(0,0), "blank cursor") mainScreen.setCursor(blankCursor) mainScreen.setPreferredSize( Dimension(REMAP_WIDTH + MARGIN, REMAP_HEIGHT + MARGIN)) mainScreen.setText("main screen!") image = BufferedImage(REMAP_WIDTH + MARGIN, REMAP_HEIGHT + MARGIN , BufferedImage.TYPE_INT_ARGB) g = image.createGraphics() g.setColor(Color.BLACK) g.fillRect(0, 0, REMAP_WIDTH + MARGIN, REMAP_HEIGHT + MARGIN) g.setColor(Color.WHITE) g.setFont(Font("Serif", Font.BOLD, 20)) g.drawString("Cursor will display on your device.", 50, 30) mainScreenImg = image mainScreen.setIcon(swing.ImageIcon(image)) mouseListener = ScrMouseListener() mainScreen.addMouseListener(mouseListener) mainScreen.addMouseMotionListener(mouseListener) mainScreen.addMouseWheelListener(mouseListener) keyListener = ScrKeyListener() mainScreen.addKeyListener(keyListener) mainScreen.setFocusable(True) scrPanel = JPanel() scrPanel.setLayout(BoxLayout(scrPanel, BoxLayout.Y_AXIS)) scrPanel.add(mainScreen) contentPane = JPanel() contentPane.setLayout(BorderLayout()) contentPane.add(scrPanel, BorderLayout.WEST) # contentPAne.add(controlPanel(). BorderLayout.EAST) return contentPane
class LowHangingFruitUISettingsPanel(IngestModuleIngestJobSettingsPanel): def __init__(self, settings): self.local_settings = settings self.initComponents() 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) def onClick(self, e): chooseFile = JFileChooser() filter = FileNameExtensionFilter("SQLite", ["sqlite"]) chooseFile.addChoosableFileFilter(filter) ret = chooseFile.showDialog(self.panel, "Select SQLite") if ret == JFileChooser.APPROVE_OPTION: file = chooseFile.getSelectedFile() text = self.readPath(file) self.area.setText(text) def readPath(self, file): global filename filename = file.getCanonicalPath() return filename def getSettings(self): return self.local_settings
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 __init__(self): # Panel for Measurements self.setLayout(BorderLayout()) # LINE_START p3= JPanel() p3.setLayout(GridLayout(3,1)) button1= JButton('Mode Estimation', actionPerformed= self.modeComputation) button2= JButton('button2', actionPerformed= self.modeComputation) button3= JButton('button3', actionPerformed= self.modeComputation) p3.add(button1) p3.add(button2) p3.add(button3) self.add(p3, BorderLayout.LINE_START) # LINE_END reportMeas= JPanel() reportMeas.setSize(Dimension(800,640)) self.add(reportMeas, BorderLayout.CENTER)
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 loadPanel(self): panel = JPanel() panel.setLayout(BoxLayout(panel, BoxLayout.Y_AXIS)) bottomButtonBarPanel = JPanel() bottomButtonBarPanel.setLayout(BoxLayout(bottomButtonBarPanel, BoxLayout.X_AXIS)) bottomButtonBarPanel.setAlignmentX(1.0) self.runButton = JButton("Run", actionPerformed=self.start) self.cancelButton = JButton("Close", actionPerformed=self.cancel) bottomButtonBarPanel.add(Box.createHorizontalGlue()); bottomButtonBarPanel.add(self.runButton) bottomButtonBarPanel.add(self.cancelButton) # Dimension(width,height) bottom = JPanel() bottom.setLayout(BoxLayout(bottom, BoxLayout.X_AXIS)) bottom.setAlignmentX(1.0) self.progressBar = JProgressBar() self.progressBar.setIndeterminate(False) self.progressBar.setMaximum(100) self.progressBar.setValue(0) bottom.add(self.progressBar) self.statusTextArea = JTextArea() self.statusTextArea.setEditable(False) scrollPane = JScrollPane(self.statusTextArea) scrollPanel = JPanel() scrollPanel.setLayout(BoxLayout(scrollPanel, BoxLayout.X_AXIS)) scrollPanel.setAlignmentX(1.0) scrollPanel.add(scrollPane) panel.add(scrollPanel) panel.add(bottomButtonBarPanel) panel.add(bottom) self.add(panel) self.setTitle("Determine Session Cookie(s)") self.setSize(450, 300) self.setLocationRelativeTo(None) self.setVisible(True) original_request_bytes = self.selected_message.getRequest() http_service = self.selected_message.getHttpService() helpers = self.callbacks.getHelpers() request_info = helpers.analyzeRequest(http_service, original_request_bytes) parameters = request_info.getParameters(); cookie_parameters = [parameter for parameter in parameters if parameter.getType() == IParameter.PARAM_COOKIE] num_requests_needed = len(cookie_parameters) + 2 self.statusTextArea.append("This may require up to " + str(num_requests_needed) + " requests to be made. Hit 'Run' to begin.\n")
def initUI(self): panel = JPanel() self.getContentPane().add(panel) panel.setLayout(None) panel.setToolTipText("A panel container") button = JButton("Button") button.setBounds(100, 60, 100, 30) button.setToolTipText("A button component") panel.add(button) self.setTitle("Tooltips") self.setSize(300, 200) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True)