def __init__(self, reaclabel=REACTINV, scalelabel=SCALEFAC): WriterPanel.__init__(self) self.reacpanel = swing.Box(swing.BoxLayout.LINE_AXIS) self.reacpanel.add(swing.JLabel(reaclabel)) self.reacfield = swing.JTextField() self.reacpanel.add(self.reacfield) self.reacpanel.add( swing.Box.createRigidArea(awt.Dimension(BORDERWIDTH, 0))) self.add(self.reacpanel, awt.BorderLayout.CENTER) self.numscalepanel = swing.Box(swing.BoxLayout.LINE_AXIS) self.add(self.numscalepanel, awt.BorderLayout.EAST) self.numpanel = swing.Box(swing.BoxLayout.LINE_AXIS) self.numpanel.add(swing.JLabel(NUMBER)) self.numfield = swing.JFormattedTextField(value=lang.Float(1.0)) self.numfield.setPreferredSize( awt.Dimension(FIELDWIDTH, self.numfield.getHeight())) self.numpanel.add(self.numfield) self.scalepanel = swing.Box(swing.BoxLayout.LINE_AXIS) self.scalepanel.add(swing.JLabel(scalelabel)) self.scalefield = swing.JFormattedTextField( value=lang.Float(Data.Problem.VMAX)) self.scalefield.setPreferredSize( awt.Dimension(FIELDWIDTH, self.scalefield.getHeight())) self.scalepanel.add(self.scalefield) self.optLayout()
def __init__(self): WriterPanel.__init__(self) self.add(swing.Box.createRigidArea(awt.Dimension(BORDERWIDTH, 0))) self.explabel = swing.JLabel(EXPRESSION) self.add(self.explabel) self.expfield = swing.JTextField() self.expfield.setMinimumSize(awt.Dimension(1, 0)) self.expfield.setPreferredSize(awt.Dimension(120, 0)) self.expfield.setMaximumSize(awt.Dimension(120, 50)) self.add(self.expfield) self.add(swing.Box.createRigidArea(awt.Dimension(BORDERWIDTH, 0))) self.thrlabel = swing.JLabel(THRESHOLD) self.add(self.thrlabel) self.thrfield = swing.JTextField('1.0') # self.thrfield = swing.JFormattedTextField('1.0') self.thrfield.setMinimumSize(awt.Dimension(1, 0)) self.thrfield.setPreferredSize(awt.Dimension(50, 0)) self.thrfield.setMaximumSize(awt.Dimension(50, 50)) self.add(self.thrfield) self.add(swing.Box.createRigidArea(awt.Dimension(BORDERWIDTH, 0))) self.argwriter = ArgWriterPanel('Reactions/Genes: ') self.add(self.argwriter)
def initGui(self): self.sigv4ConfigurationTab = swing.JPanel() layout = swing.GroupLayout(self.sigv4ConfigurationTab) self.sigv4ConfigurationTab.setLayout(layout) self.addDomainInfo = swing.JLabel("Domain to test:") self.addDomainInfo.setFont(Font("Tahoma", 1, 12)) self.configurationLoadedInfo = swing.JLabel("") self.configurationLoadedInfo.setFont(Font("Tahoma", 1, 12)) self.isJsonCheck = swing.JCheckBox("JSON") self.isJsonCheck.setFont(Font("Tahoma", 1, 12)) self.parseCredsBtn = swing.JButton('Load configuration', actionPerformed=self.parseCreds) self.credsPanel = swing.JScrollPane() self.credsText = swing.JTextArea("Paste Creds Here.") self.credsText.setLineWrap(True) self.credsPanel.setViewportView(self.credsText) self.scopeUrlField = swing.JTextField("api.example.io") layout.setHorizontalGroup( layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(15) .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING) .addComponent(self.isJsonCheck) .addComponent(self.credsPanel, swing.GroupLayout.PREFERRED_SIZE, 525, swing.GroupLayout.PREFERRED_SIZE) .addComponent(self.addDomainInfo) .addComponent(self.scopeUrlField, swing.GroupLayout.PREFERRED_SIZE, 350, swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.TRAILING) .addComponent(self.parseCredsBtn)) .addComponent(self.configurationLoadedInfo) .addPreferredGap(swing.LayoutStyle.ComponentPlacement.UNRELATED)) .addComponent(self.addDomainInfo)) .addContainerGap(26, lang.Short.MAX_VALUE))) layout.setVerticalGroup( layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(10) .addComponent(self.isJsonCheck) .addGap(10) .addComponent(self.credsPanel, swing.GroupLayout.PREFERRED_SIZE, 125, swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(10) .addComponent(self.addDomainInfo) .addGap(10) .addComponent(self.scopeUrlField, swing.GroupLayout.PREFERRED_SIZE, swing.GroupLayout.DEFAULT_SIZE, swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(10) .addComponent(self.parseCredsBtn) .addGap(10) .addComponent(self.configurationLoadedInfo) .addPreferredGap(swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(swing.LayoutStyle.ComponentPlacement.RELATED) .addContainerGap(swing.GroupLayout.DEFAULT_SIZE, lang.Short.MAX_VALUE))))))) return
def showInstructionPage(self): self.mainPanel.add(swing.JLabel('You are going to be clicking on targets. When you are done, recenter the mouse.')) continueButton = swing.JButton() continueButton.add(swing.JLabel('I understand- start the experiment.')) ### this is like adding a listener- it just associated the button with a method continueButton.actionPerformed(self.callback_startExperiment) self.mainPanel.add(continueButton)
def classify_image(image): """Displays a window that allows the user to view and classify an image.""" frame = swing.JFrame() frame.defaultCloseOperation = swing.JFrame.DO_NOTHING_ON_CLOSE frame.add(swing.JLabel(swing.ImageIcon(image))) frame.add(swing.JLabel("Enter one of " + ", ".join(CLASS_NAMES))) frame.layout = swing.BoxLayout(frame.contentPane, swing.BoxLayout.Y_AXIS) class_field = swing.JTextField() classify_button = swing.JButton("Classify") condition = threading.Condition() def listener(_event): if class_field.text in CLASS_NAMES: with condition: condition.notifyAll() else: swing.JOptionPane.showMessageDialog( frame, "Image type is not one of the recognized types", "Input error", swing.JOptionPane.ERROR_MESSAGE) class_field.addActionListener(listener) classify_button.addActionListener(listener) frame.add(class_field) frame.add(classify_button) frame.pack() frame.visible = True with condition: condition.wait() frame.dispose() return class_field.text
def getParams(self): # GUI to get future % of subbasin redeveloped, curve number, and release rate # Initialize window for UI frame = swing.JFrame("Set conditions of redeveloped portion of subbasin", layout=awt.BorderLayout()) frame.setDefaultCloseOperation(swing.JFrame.EXIT_ON_CLOSE) # Create panel that includes three text entry fields for % redeveloped, curve number, and release rate futureparams = swing.JPanel(layout=awt.GridLayout(3,2)) inbutton = swing.JPanel() futureparams.add(swing.JLabel('Percent Redevelopment ')) rd = swing.JTextField('', 5) futureparams.add(rd) futureparams.add(swing.JLabel('Future Curve Number ')) cn = swing.JTextField('', 5) futureparams.add(cn) futureparams.add(swing.JLabel('Release Rate ')) rr = swing.JTextField('', 5) futureparams.add(rr) # Create panel for button that stores the values entered setButton = swing.JButton('Set parameters', actionPerformed=(lambda x: self.setParams(rd, cn, rr, frame))) self.setParams(rd, cn, rr, frame) # Add panels to the window and make the window visible frame.add(futureparams, awt.BorderLayout.NORTH) inbutton.add(setButton) frame.add(inbutton, awt.BorderLayout.SOUTH) # setButton.addMouseListener(awt.event.MouseListener.mouseClicked(self, self.setParams(rd, cn, rr, frame))) frame.pack()
def run(self): self.splash = splash = swing.JWindow() splash.setAlwaysOnTop(1) cpane = splash.getContentPane() rp = splash.getRootPane() tb = sborder.TitledBorder("Leo") tb.setTitleJustification(tb.CENTER) rp.setBorder(tb) splash.setBackground(awt.Color.ORANGE) dimension = awt.Dimension(400, 400) splash.setPreferredSize(dimension) splash.setSize(400, 400) sicon = g.os_path_join(g.app.loadDir, "..", "Icons", "Leosplash.GIF") #ii = swing.ImageIcon( "../Icons/Leosplash.GIF" ) ii = swing.ImageIcon(sicon) image = swing.JLabel(ii) image.setBackground(awt.Color.ORANGE) cpane.add(image) self.splashlabel = splashlabel = swing.JLabel("Leo Starting....") splashlabel.setBackground(awt.Color.ORANGE) splashlabel.setForeground(awt.Color.BLUE) cpane.add(splashlabel, awt.BorderLayout.SOUTH) w, h = self._calculateCenteredPosition(splash) splash.setLocation(w, h) splash.visible = True
def whatsSelectedCallback(self, event): dialog = swing.JFrame("Here's what's selected") dialog.contentPane.layout = awt.GridLayout(2, 1) dialog.contentPane.add( swing.JLabel("Selected value = " + str(self.list.selectedValue), swing.JLabel.CENTER)) dialog.contentPane.add( swing.JLabel("Selected index = " + str(self.list.selectedIndex), swing.JLabel.CENTER)) dialog.size = (400, 200) dialog.show() print "Selected value =", self.list.selectedValue, ", selected index =", self.list.selectedIndex
def __init__(self): WriterPanel.__init__(self) self.dirlabel = swing.JLabel(DIRECTION) self.add(self.dirlabel) self.dirbox = swing.JComboBox(DIRORDER) self.add(self.dirbox) self.add(swing.Box.createRigidArea(awt.Dimension(BORDERWIDTH, 0))) self.objlabel = swing.JLabel(OBJECTIVE) self.add(self.objlabel) self.objfield = swing.JTextField() self.add(self.objfield)
def __init__(self, debugger): self.lastValue = None self.debugger = debugger MAX_SPEED = debugger.MAX_SPEED self.slider = swing.JSlider(swing.JSlider.HORIZONTAL, 0, MAX_SPEED, self.debugger.speed, stateChanged=self.stateChanged) self.last_speed = self.debugger.speed labels = Hashtable() labels.put(0, swing.JLabel('slow')) labels.put(MAX_SPEED, swing.JLabel('fast')) self.slider.labelTable = labels self.slider.paintLabels = 1 self.addButton = swing.JButton(swing.ImageIcon('images/plus.jpg'), actionPerformed=self.actionPerformed, toolTipText='add Variable', preferredSize=BUTTON_SIZE) self.deleteButton = swing.JButton(swing.ImageIcon('images/minus.jpg'), actionPerformed=self.actionPerformed, toolTipText='remove Variable', preferredSize=BUTTON_SIZE) self.stepButton = swing.JButton(swing.ImageIcon('images/boot.jpg'), actionPerformed=self.actionPerformed, toolTipText='step', preferredSize=BUTTON_SIZE) self.pauseIcon = swing.ImageIcon('images/pause.jpg') self.runIcon = swing.ImageIcon('images/run.jpg') self.runButton = swing.JButton(self.runIcon, actionPerformed=self.actionPerformed, toolTipText='run', preferredSize=BUTTON_SIZE) self.fullspeedButton = swing.JButton( swing.ImageIcon('images/fullspeed.jpg'), actionPerformed=self.actionPerformed, toolTipText='full speed', preferredSize=BUTTON_SIZE) self.stopButton = swing.JButton(swing.ImageIcon('images/stop.jpg'), actionPerformed=self.actionPerformed, toolTipText='stop', preferredSize=BUTTON_SIZE) self.setLayout(swing.BoxLayout(self, swing.BoxLayout.X_AXIS)) self.add(self.slider) self.add(self.addButton) self.add(self.deleteButton) #self.add(self.stepButton) # These two lines commented out by Brian O because of removed Pause functionality -- 23 June 2008 #self.add(self.runButton) self.add(self.fullspeedButton) self.add(self.stopButton) self.initialButtonState()
def __init__(self, name, version, about): """# Create and run a modal dialog giving the name, version and description of a plugin. """ root = g.app.root self.top = top = swing.JDialog() #self.top = top = Tk.Toplevel(root) #g.app.gui.attachLeoIcon(self.top) #top.title("About " + name) top.title = "About " + name #top.resizable(0,0) # neither height or width is resizable. #frame = Tk.Frame(top) #frame.pack(side="top") frame = swing.JPanel() top.add(frame) #@ << Create the contents of the about box >> #@+node:EKR.20040517080555.21:<< Create the contents of the about box >> #Tk.Label(frame, text="Version " + version).pack() #Tk.Label(frame, text=about, borderwidth=10,justify="left").pack() l1 = swing.JLabel("Version " + version) frame.add(l1) l2 = swing.JLabel(about) frame.add(l2) #@nonl #@-node:EKR.20040517080555.21:<< Create the contents of the about box >> #@nl #@ << Create the close button >> #@+node:EKR.20040517080555.22:<< Create the close button >> #buttonbox = Tk.Frame(top, borderwidth=5) #buttonbox.pack(side="bottom") buttonbox = swing.JPanel() top.add(buttonbox, java.awt.BorderLayout.SOUTH) #self.button = Tk.Button(buttonbox, text="Close", command=top.destroy) #self.button.pack(side="bottom") self.button = swing.JButton("Close") self.button.actionPerformed = lambda event: top.dispose() buttonbox.add(self.button) #@nonl #@-node:EKR.20040517080555.22:<< Create the close button >> #@nl g.app.gui.center_dialog(top) # Do this after packing.
def registerExtenderCallbacks(self, callbacks): # keep a reference to our callbacks object self._callbacks = callbacks # obtain an extension helpers object self._helpers = callbacks.getHelpers() # set out extension name self._callbacks.setExtensionName("Polito Inc. :: Request Analytics") # create out GUI self._jPanel = swing.JPanel() mainVerticalBox = swing.Box.createVerticalBox() descriptionHorizontalBox = swing.Box.createHorizontalBox() descriptionHorizontalBox.add( swing.JLabel( "<html><br /><br />Request Analytics will track every request made through Burp and track how many times each 'file' appears in only uniqe URIs.<br />Only URIs included in scope will be analyzed.<br /><br /><br /></html>" )) mainVerticalBox.add(descriptionHorizontalBox) controlsHorizontalBox = swing.Box.createHorizontalBox() displayAnalyticDataButton = swing.JButton( 'Display Analytic Data', actionPerformed=self.displayAnalyticData) controlsHorizontalBox.add(displayAnalyticDataButton) resetAnalyticDataButton = swing.JButton( 'Reset Analytic Data', actionPerformed=self.resetAnalyticData) controlsHorizontalBox.add(resetAnalyticDataButton) mainVerticalBox.add(controlsHorizontalBox) spacer1HorizontalBox = swing.Box.createHorizontalBox() spacer1HorizontalBox.add( swing.JLabel("<html><br /><br /><br /></html>")) mainVerticalBox.add(spacer1HorizontalBox) outputHorizontalBox = swing.Box.createHorizontalBox() self._outputTextArea = swing.JTextArea() self._outputTextArea.setEditable(False) outputTextArea = swing.JScrollPane(self._outputTextArea) outputTextArea.setPreferredSize(Dimension(250, 300)) outputHorizontalBox.add(outputTextArea) mainVerticalBox.add(outputHorizontalBox) self._jPanel.add(mainVerticalBox) # register ourselves as an HTTP listener self._callbacks.registerHttpListener(self) # add the custom tab to Burp's UI self._callbacks.addSuiteTab(self) return
def createGui (self): # build the GUI self.layout = awt.BorderLayout() progB = self.__progressBar = \ swing.JProgressBar(0, 100, stringPainted=1); inf = self.__inputField = swing.JTextField(5) inl = swing.JLabel("Calculate value of:", swing.JLabel.RIGHT) inl.labelFor = inf outf = self.__outputArea = swing.JTextArea() outl = swing.JLabel("Result:", swing.JLabel.RIGHT) outl.labelFor = outf calcb = self.__calcButton = \ swing.JButton("Calculate", actionPerformed=self.doCalc, enabled=1, mnemonic=awtevent.KeyEvent.VK_C) cancelb = self.__cancelButton = \ swing.JButton("Cancel", actionPerformed=self.doCancel, enabled=0, mnemonic=awtevent.KeyEvent.VK_L) vl = ValueLayout(5, 5) inp = swing.JPanel(vl) vl.setLayoutAlignmentX(inp, 0.2) inp.add(inl); inp.add(inf, inl) self.add(inp, awt.BorderLayout.NORTH) vl = ValueLayout(5, 5) outp = swing.JPanel(vl) vl.setLayoutAlignmentX(outp, 0.2) outp.add(outl); outp.add(swing.JScrollPane(outf), outl) xoutp = swing.JPanel(awt.BorderLayout()) xoutp.add(progB, awt.BorderLayout.NORTH) xoutp.add(outp, awt.BorderLayout.CENTER) self.add(xoutp, awt.BorderLayout.CENTER) sp = swing.JPanel(awt.BorderLayout()) bp = swing.JPanel() bp.add(calcb) bp.add(cancelb) sp.add(bp, awt.BorderLayout.NORTH) sl = self.__statusLabel = swing.JLabel(" ") sp.add(sl, awt.BorderLayout.SOUTH) self.add(sp, awt.BorderLayout.SOUTH)
def __init__(self, gui): self.gui = gui self.server = gui.client.server self.boardFrame = swing.JInternalFrame( 'Chinese Chess', 1, 1, 1, 1, internalFrameClosing=self.onClosing, defaultCloseOperation=swing.JInternalFrame.DO_NOTHING_ON_CLOSE) setColours(game_cchess_boardgui, gui.config.state) self.board = game_cchess_boardgui.Canvas() self.board.setDoMove(self.server.doMove) self.board.setBoard(cchess.Board()) self.boardFrame.contentPane.layout = awt.BorderLayout() self.boardFrame.contentPane.add(self.board) self.statusBar = swing.JLabel('temp') self.boardFrame.contentPane.add(self.statusBar, 'South') gui.main.add(self.boardFrame) self.boardFrame.show() self.boardFrame.pack() self.boardFrame.size = 300, 300 self.boardFrame.invalidate() self.suggestFrame = games.SuggestionFrame(AI(), self.server, self.gui.main) print 'made gui'
def __getSVNConnection( self ) : panel = swing.JPanel( java.awt.BorderLayout()) connector = SVNConnector() cpanel = swing.JPanel( java.awt.BorderLayout()) cpanel.add( connector) mlabel = swing.JLabel( "Status:") cpanel.add( mlabel, java.awt.BorderLayout.SOUTH) panel.add( cpanel) #jtf = swing.JTextField( 15 ) #border = jtf.getBorder() #tborder = swing.border.TitledBorder( border) #tborder.setTitle( "SVN Repository Location") #jtf.setBorder( tborder) #panel.add( jtf ) def checkRepository( event ): #location = jtf.getText() if not connector.canConnect(): mlabel.setText( "Can't Reach %s" % connector.getUrl()) return location = connector.getUrl() self.repository = getRepository( location) if self.repository: self.svn = location self.next() jb = swing.JButton( "Connect to Repository") jb.actionPerformed = checkRepository buttonpanel = swing.JPanel() buttonpanel.add( jb ) panel.add( buttonpanel, java.awt.BorderLayout.SOUTH) return panel
def browse( c ): svnc = SVNConnector() center = swing.JPanel( java.awt.BorderLayout()) center.add( svnc) label = swing.JLabel( "Status:") center.add( label, java.awt.BorderLayout.SOUTH) d = swing.JDialog() d.title = "Browse A Repository" cp = d.getContentPane() cp.setLayout( java.awt.BorderLayout()) cp.add( center ) jb = swing.JButton( "Browse") def view( event ): url = svnc.getUrl() can_connect = svnc.canConnect() if can_connect: repository = getRepository( url) browseRepository( d, repository) else: label.setText( "Status: Cant Connect" ) jb.actionPerformed = view cp.add( jb, java.awt.BorderLayout.SOUTH) d.pack() g.app.gui.center_dialog( d ) d.visible = 1
def registerExtenderCallbacks(self, callbacks): self.hashes = {} #self._stdout = PrintWriter(callbacks.getStdout(), True) self._callbacks = callbacks self._helpers = callbacks.getHelpers() self._callbacks.setExtensionName("Password Hash Scanner") self._callbacks.registerScannerCheck(self) self._fileLocation = None self._jPanel = swing.JPanel() boxVertical = swing.Box.createVerticalBox() boxHorizontal = swing.Box.createHorizontalBox() getFileButton = swing.JButton('Open hashout.txt', actionPerformed=self.getFile) self._fileText = swing.JTextArea("", 1, 50) boxHorizontal.add(getFileButton) boxHorizontal.add(self._fileText) boxVertical.add(boxHorizontal) boxHorizontal = swing.Box.createHorizontalBox() submitQueryButton = swing.JButton('Parse hash file', actionPerformed=self.hashParse) boxHorizontal.add(submitQueryButton) boxVertical.add(boxHorizontal) boxHorizontal = swing.Box.createHorizontalBox() boxHorizontal.add(swing.JLabel("Output")) boxVertical.add(boxHorizontal) boxHorizontal = swing.Box.createHorizontalBox() self._resultsTextArea = swing.JTextArea() resultsOutput = swing.JScrollPane(self._resultsTextArea) resultsOutput.setPreferredSize(Dimension(500, 200)) boxHorizontal.add(resultsOutput) boxVertical.add(boxHorizontal) self._jPanel.add(boxVertical) # add the custom tab to Burp's UI self._callbacks.addSuiteTab(self) return
def create_ui(self): cpanel = CreatePanle(self._burpColor) self.content_ui = swing.JPanel() content_panel = swing.JPanel() content_panel.setLayout(BorderLayout()) text = swing.JLabel(self.option['text']) if self.option['type'] == 'file_chooser': #fileSelecter button = cpanel.create_button(self.option['funcopt']['FNfilter'], self.option, content_panel) button.setPreferredSize(Dimension(40, 40)) elif self.option['type'] == 'param_list': ui = cpanel.create_table_panel(self.option) content_panel.add(ui) elif self.option['type'] == 'file_loader': button = cpanel.create_button(self.option['funcopt']['FNfilter'], self.option, content_panel) button.setPreferredSize(Dimension(40, 40)) text.setFont(Font("Arial", Font.PLAIN, 12)) content_panel.add(text, BorderLayout.PAGE_START) self.content_ui.setLayout(BorderLayout()) self.content_ui.add(content_panel) if self.option['type'] == 'file_chooser' or self.option[ 'type'] == 'file_loader': self.content_ui.add(button, BorderLayout.SOUTH)
def addElement(self, ID, label, style): stylestr = ";".join([key + '=' + val for key, val in style.items()]) wlabel = swing.JLabel(label) d = wlabel.getPreferredSize() width, height = d.getWidth() + BORDERWIDTH, d.getHeight() + BORDERWIDTH return self.graph.insertVertex(self.graph.getDefaultParent(), ID, label, 0, 0, width, height, stylestr)
def showMismatchTable(self): jf = swing.JFrame() jf.setDefaultCloseOperation(jf.DISPOSE_ON_CLOSE) cp = jf.getContentPane() cp.setLayout(awt.BorderLayout()) jt = swing.JTable(self._dtm) jt.setAutoResizeMode(jt.AUTO_RESIZE_ALL_COLUMNS) drend = self._dftcr() jt.setDefaultRenderer(java.lang.Object, drend) count = self._dtm.getRowCount() tmp_label = swing.JLabel(java.lang.String.valueOf(count)) psize = tmp_label.getPreferredSize() column = jt.getColumn("") column.setPreferredWidth(psize.width + 10) column.setMaxWidth(psize.width + 10) sp = swing.JScrollPane(jt) sp.addComponentListener(drend) cp.add(sp, awt.BorderLayout.CENTER) jb = swing.JButton("Close") jb.actionPerformed = lambda event: jf.dispose() cp.add(jb, awt.BorderLayout.SOUTH) jf.pack() g.app.gui.center_dialog(jf) jf.visible = 1
def addOptions(self): self.optpanel = swing.JPanel(layout=awt.BorderLayout()) self.add(self.optpanel, awt.BorderLayout.EAST) self.commentcheck = swing.JCheckBox( COMMENTS, horizontalTextPosition=swing.SwingConstants.LEFT) self.commentcheck.setSelected(SHOWCOMMENTS) self.optpanel.add(self.commentcheck, awt.BorderLayout.EAST) # self.grbcheck = swing.JCheckBox('Gurobi:', horizontalTextPosition = swing.SwingConstants.LEFT)#w# # self.grbcheck.setSelected(False)#w# self.LPbox = swing.Box(swing.BoxLayout.LINE_AXIS) self.LPbox.add( swing.Box.createRigidArea(awt.Dimension(2 * BORDERWIDTH, 0))) self.LPbox.add(swing.JLabel(SOLVER)) self.solverbox = swing.JComboBox(Data.Problem.SOLVERS) self.solverbox.addActionListener(self.SolverSwitcher(self)) self.LPbox.add(self.solverbox) self.LPbox.add(swing.Box.createRigidArea(awt.Dimension(BORDERWIDTH, 0))) self.trimcheck = swing.JCheckBox( REDUCE, horizontalTextPosition=swing.SwingConstants.LEFT) self.LPbox.add(self.trimcheck) self.LPbox.add(swing.Box.createRigidArea(awt.Dimension(BORDERWIDTH, 0))) self.optpanel.add(self.LPbox, awt.BorderLayout.WEST) #CENTER->WEST
def __init__(self): self.frame=swing.JFrame(title="My Frame", size=(300,300)) self.frame.defaultCloseOperation=swing.JFrame.EXIT_ON_CLOSE; self.frame.layout=awt.BorderLayout() self.panel1=swing.JPanel(awt.BorderLayout()) self.panel2=swing.JPanel(awt.GridLayout(4,1)) self.panel2.preferredSize = awt.Dimension(10,100) self.panel3=swing.JPanel(awt.BorderLayout()) self.title=swing.JLabel("Text Rendering") self.button1=swing.JButton("Print Text", actionPerformed=self.printMessage) self.button2=swing.JButton("Clear Text", actionPerformed=self.clearMessage) self.textField=swing.JTextField(30) self.outputText=swing.JTextArea(4,15) self.panel1.add(self.title) self.panel2.add(self.textField) self.panel2.add(self.button1) self.panel2.add(self.button2) self.panel3.add(self.outputText) self.frame.contentPane.add(self.panel1, awt.BorderLayout.PAGE_START) self.frame.contentPane.add(self.panel2, awt.BorderLayout.CENTER) self.frame.contentPane.add(self.panel3, awt.BorderLayout.PAGE_END)
def __init__(self): self.contentPane.layout = swing.BoxLayout(self.contentPane, swing.BoxLayout.Y_AXIS) message = swing.JLabel(BUGREPORTMESSAGE) message.setAlignmentX(awt.Component.CENTER_ALIGNMENT) self.add(message) self.add(swing.Box.createVerticalStrut(10)) buttonbox = swing.Box(swing.BoxLayout.X_AXIS) self.sendbutton = swing.JButton(COMMAND_SEND, actionPerformed=self.actionPerformed) self.cancelbutton = swing.JButton(COMMAND_CANCEL, actionPerformed=self.actionPerformed) buttonbox.add(self.sendbutton) buttonbox.add(self.cancelbutton) #self.add(swing.Box.createVerticalStrut(10)) self.add(buttonbox) buttonbox.setAlignmentX(awt.Component.CENTER_ALIGNMENT) self.pack() self.size = (300, 175) self.setLocationRelativeTo(None) self.show()
def createGui( self ): jp = swing.JPanel( java.awt.BorderLayout() ) self.jtp = jtp = swing.JEditorPane( "text/html", "" , editable = 0 ) self.jsp = jsp = swing.JScrollPane( jtp ) jb = self.jsp.getBorder() self.tb = tb = swing.border.TitledBorder( jb ) self.tb2 = tb2 = swing.border.TitledBorder( tb, "", tb.CENTER, tb.BOTTOM ) self.jsp.setBorder( self.tb2 ) jp.add( jsp ) jp2 = swing.JPanel() self.label = swing.JLabel() self._question = question = swing.JButton( "Question" ) question.actionPerformed = self.question self._answer = answer = swing.JButton( "Answer" ) answer.actionPerformed = self.answer self._back = back = swing.JButton( "Back" ) back.actionPerformed = self.back self._next = next = swing.JButton( "Next" ) next.actionPerformed = self.next for z in ( question, answer, back, next ): jp2.add( z ) jp.add( jp2, java.awt.BorderLayout.SOUTH ) return jp
def initUI(self): self.tab = swing.JPanel() # UI for Output self.outputLabel = swing.JLabel("pMDetector Log:") self.outputLabel.setFont(Font("Tahoma", Font.BOLD, 14)) self.outputLabel.setForeground(Color(255, 102, 52)) self.logPane = swing.JScrollPane() self.outputTxtArea = swing.JTextArea() self.outputTxtArea.setFont(Font("Consolas", Font.PLAIN, 12)) self.outputTxtArea.setLineWrap(True) self.logPane.setViewportView(self.outputTxtArea) self.clearBtn = swing.JButton("Clear Log", actionPerformed=self.clear) self.exportBtn = swing.JButton("Export Log", actionPerformed=self.export) self.parentFrm = swing.JFileChooser() # Layout layout = swing.GroupLayout(self.tab) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) self.tab.setLayout(layout) layout.setHorizontalGroup(layout.createParallelGroup().addGroup( layout.createSequentialGroup().addGroup( layout.createParallelGroup().addComponent( self.outputLabel).addComponent(self.logPane).addComponent( self.clearBtn).addComponent(self.exportBtn)))) layout.setVerticalGroup(layout.createParallelGroup().addGroup( layout.createParallelGroup().addGroup( layout.createSequentialGroup().addComponent( self.outputLabel).addComponent(self.logPane).addComponent( self.clearBtn).addComponent(self.exportBtn))))
def draw(self): #Create a JFrame and add a label, button and a menu bar self.frame = swing.JFrame("Hello Swing from Python", visible=1 ) # a JLabel self.label = swing.JLabel("This is a Swing app in Jython") # a JButton self.button = swing.JButton("Click me!") # Adding a action self.button.actionPerformed = self.ClickBtn self.frame.contentPane.add(self.label, BorderLayout.CENTER) self.frame.contentPane.add(self.button, BorderLayout.SOUTH) self.frame.defaultCloseOperation = swing.JFrame.EXIT_ON_CLOSE; self.frame.pack()
def registerExtenderCallbacks(self, callbacks): # keep a reference to our callbacks object self._callbacks = callbacks # set our extension name self._callbacks.setExtensionName("Payload Parser") # build UI self._jPanel = swing.JPanel() self._jPanel.layout = awt.BorderLayout() self._jPanel.border = swing.BorderFactory.createTitledBorder( "Input characters to display payload strings with characters included or excluded" ) inputPanel = swing.JPanel() inputPanel.layout = awt.BorderLayout() radioPanel = swing.JPanel() self.text1 = swing.JTextField(actionPerformed=self.radioCallback) inputPanel.add(self.text1, inputPanel.layout.CENTER) buttonGroup = swing.ButtonGroup() self._radioButtonInclude = swing.JRadioButton("Include") buttonGroup.add(self._radioButtonInclude) radioPanel.add(self._radioButtonInclude) self._radioButtonExclude = swing.JRadioButton("Exclude") buttonGroup.add(self._radioButtonExclude) radioPanel.add(self._radioButtonExclude) self._radioButtonInclude.setSelected(True) inputPanel.add(radioPanel, inputPanel.layout.LINE_END) self._jPanel.add(inputPanel, self._jPanel.layout.PAGE_START) self.textArea = swing.JTextArea() scrollPane = swing.JScrollPane(self.textArea) self._jPanel.add(scrollPane, self._jPanel.layout.CENTER) boxVertical = swing.Box.createVerticalBox() saveLabel = swing.JLabel( "Save Payloads (In Burp Root Dir): Can be Imported into Intruder") boxVertical.add(saveLabel) boxHorizontal = swing.Box.createHorizontalBox() saveLabel2 = swing.JLabel("Save As:") boxHorizontal.add(saveLabel2) self._saveTextField = swing.JTextField('', 30) boxHorizontal.add(self._saveTextField) submitSaveButton = swing.JButton('Save', actionPerformed=self.savePayload) boxHorizontal.add(submitSaveButton) boxVertical.add(boxHorizontal) self._jPanel.add(boxVertical, self._jPanel.layout.PAGE_END) # add the custom tab to Burp's UI self._callbacks.addSuiteTab(self) return
def top_panel(self): title = swing.JLabel(self._info['title'][0],swing.JLabel.LEFT) title.setFont(Font("Arial", Font.BOLD, 24)) title.setForeground(self._burpColor) self.compartment = swing.JPanel() self.compartment.add(title) self.compartment.setLayout(FlowLayout(FlowLayout.LEFT)) self.compartment.setMaximumSize(Dimension(Short.MAX_VALUE, 40))
def __init__(self): self.frame=swing.JFrame(title="Simple Jython Interpreter", size=(600,500)) self.frame.defaultCloseOperation=swing.JFrame.EXIT_ON_CLOSE; self.frame.layout=awt.BorderLayout() self.panel1=swing.JPanel(awt.BorderLayout()) self.panel2=swing.JPanel(awt.BorderLayout()) self.title=swing.JLabel("Jython Code") self.title2 = swing.JLabel("Interpreter Output") self.button1=swing.JButton("Run", actionPerformed=self.printMessage) self.button2=swing.JButton("Clear Output", actionPerformed=self.clearMessage) self.buttonPane = swing.JPanel() self.buttonPane.layout = swing.BoxLayout(self.buttonPane, swing.BoxLayout.LINE_AXIS) self.buttonPane.border = swing.BorderFactory.createEmptyBorder(0, 10, 10, 10) self.buttonPane.add(swing.Box.createHorizontalGlue()) self.buttonPane.add(self.button1) self.buttonPane.add(swing.Box.createRigidArea(awt.Dimension(10, 0))) self.buttonPane.add(self.button2) self.textField=swing.JTextArea(4,15) self.textField.lineWrap = True self.scrollPaneOne = swing.JScrollPane(self.textField) self.scrollPaneOne.verticalScrollBarPolicy = swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS self.outputText=swing.JTextArea(4,15) self.outputText.lineWrap = True self.outputText.editable = False self.scrollPane2 = swing.JScrollPane(self.outputText) self.scrollPane2.verticalScrollBarPolicy = swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS self.panel1.add(self.title, awt.BorderLayout.PAGE_START) self.panel1.add(self.scrollPaneOne, awt.BorderLayout.CENTER) self.panel2.add(self.title2, awt.BorderLayout.PAGE_START) self.panel2.add(self.scrollPane2, awt.BorderLayout.CENTER) self.splitPane = swing.JSplitPane(swing.JSplitPane.VERTICAL_SPLIT, self.panel1, self.panel2) self.splitPane.oneTouchExpandable = True self.minimumSize = awt.Dimension(50, 100) self.panel1.minimumSize = self.minimumSize self.panel2.minimumSize = self.minimumSize self.frame.contentPane.add(self.splitPane, awt.BorderLayout.CENTER) self.frame.contentPane.add(self.buttonPane, awt.BorderLayout.PAGE_END)
def clickMeCallback(self, event): dialog = swing.JFrame("You clicked the button!") dialog.contentPane.layout = awt.BorderLayout() dialog.contentPane.add(swing.JLabel("Text was: " + self.field.text)) dialog.size = (400, 200) dialog.show() print "Text is ", self.field.text self.field.text = ""