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
Esempio n. 2
0
 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
Esempio n. 3
0
    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))))
Esempio n. 4
0
    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()
Esempio n. 5
0
    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)
Esempio n. 6
0
    def test_java_bean_properties(self):

        b1 = swing.JButton()
        b1.label = 'foo'
        b2 = swing.JButton(label='foo')
        self.assertEquals(b1.label, b2.label)
        self.assertEquals(b1.label, 'foo')

        # Test bean event properties - single and multiple
        def testAction(event):
            JythonBasicTests.flag += 1

        doit = ActionEvent(b1, ActionEvent.ACTION_PERFORMED, "")

        b1.actionPerformed = testAction
        JythonBasicTests.flag = 0
        b1.doClick()
        self.assertEquals(
            JythonBasicTests.flag, 1,
            'expected one action per event but got %s' % JythonBasicTests.flag)

        b1.actionPerformed.append(testAction)
        JythonBasicTests.flag = 0
        b1.doClick()
        self.assertEquals(JythonBasicTests.flag, 2, 'two actions per event')

        b1.actionPerformed = testAction
        JythonBasicTests.flag = 0
        b1.doClick()
        self.assertEquals(JythonBasicTests.flag, 1,
                          'one actions per event - again')
Esempio n. 7
0
    def registerExtenderCallbacks(self, callbacks):
        print "SAML BurpSuite Extension"
        print "Ben Campbell <eat_meatballs[at]hotmail.co.uk>"
        print "http://rewtdance.blogspot.co.uk"
        print "http://github.com/Meatballs1/burp_saml"

        # 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("SAML Decoder")

        # Create Tab
        self._jPanel = swing.JPanel()
        self._jPanel.setLayout(
            swing.BoxLayout(self._jPanel, swing.BoxLayout.Y_AXIS))

        # SAML Binding Format
        self._jTextIn = swing.JTextArea("SAML Binding In", 20, 120)
        self._jTextIn.setLineWrap(True)
        self._jTextOut = swing.JTextArea("SAML Binding Out", 20, 120)
        self._jTextOut.setLineWrap(True)
        self._jButtonPanel = swing.JPanel()
        self._jButtonEncode = swing.JButton('Encode',
                                            actionPerformed=self.encode)
        self._jButtonDecode = swing.JButton('Decode',
                                            actionPerformed=self.decode)
        self._jButtonPanel.add(self._jButtonEncode)
        self._jButtonPanel.add(self._jButtonDecode)
        self._jPanel.add(self._jTextIn)
        self._jPanel.add(self._jButtonPanel)
        self._jPanel.add(self._jTextOut)

        # SAML Artifact Format
        self._jTextArtIn = swing.JTextArea("SAML Artifact In", 20, 120)
        self._jTextArtIn.setLineWrap(True)
        self._jTextArtOut = swing.JTextArea("SAML Artifact Out", 20, 120)
        self._jTextArtOut.setLineWrap(True)
        self._jButtonArtPanel = swing.JPanel()
        self._jButtonArtEncode = swing.JButton('Encode',
                                               actionPerformed=self.art_encode)
        self._jButtonArtDecode = swing.JButton('Decode',
                                               actionPerformed=self.art_decode)
        self._jButtonArtPanel.add(self._jButtonArtEncode)
        self._jButtonArtPanel.add(self._jButtonArtDecode)
        self._jPanel.add(self._jTextArtIn)
        self._jPanel.add(self._jButtonArtPanel)
        self._jPanel.add(self._jTextArtOut)

        callbacks.customizeUiComponent(self._jPanel)

        # register ourselves as a message editor tab factory
        callbacks.addSuiteTab(self)
        return
Esempio n. 8
0
    def __init__(self):
        self.myFrame = swing.JFrame.__init__(self, 'Fragments')

        self.mydlg = EditFragment(self)
        self.mySession = ActiveSession(_session)

        self.myListModel = swing.DefaultListModel()
        self.myList = swing.JList(self.myListModel)
        myMidPanel = swing.JScrollPane(self.myList)

        myTopPanel = swing.JPanel()
        self.myEntry = swing.JTextField(40)
        myTopPanel.add(self.myEntry)
        myTopPanel.add(swing.JButton('Add', actionPerformed=self.AddValue))
        myTopPanel.add(swing.JButton('Trim', actionPerformed=self.TrimValue))
        myTopPanel.add(
            swing.JButton('[Enter]', actionPerformed=self.EnterValue))

        myPanel = swing.JPanel()
        myPanel.add(swing.JButton('Edit', actionPerformed=self.EditValue))
        myPanel.add(swing.JButton('Remove', actionPerformed=self.RemoveValue))
        myPanel.add(swing.JButton('Use', actionPerformed=self.UseValue))
        myPanel.add(
            swing.JButton('Refresh', actionPerformed=self.RefreshSessions))
        myPanel.add(swing.JButton('Save', actionPerformed=self.SaveValue))
        myPanel.add(swing.JButton('Restore', actionPerformed=self.RstValue))

        self.contentPane.add(myTopPanel, awt.BorderLayout.NORTH)
        self.contentPane.add(myMidPanel, awt.BorderLayout.CENTER)
        self.contentPane.add(myPanel, awt.BorderLayout.SOUTH)

        self.pack()
Esempio n. 9
0
 def __init__(self, dialogparent):
     swing.JDialog.__init__(self,
                            dialogparent,
                            'Edit the fragment',
                            modal=1)
     myPanel = swing.JPanel()
     self.myText = swing.JTextField(20)
     myPanel.add(self.myText)
     myPanel.add(swing.JButton('OK', actionPerformed=self.__ok))
     myPanel.add(swing.JButton('Cancel', actionPerformed=self.__cancel))
     self.contentPane.add(myPanel)
     self.pack()
    def registerExtenderCallbacks(self, callbacks):
        print "Install Successful...."
        # 测试文本
        testtext = u'''
admin u'\u8fd9\u662f\u4e00\u4e2a\u6d4b\u8bd5\u9875\u9762'
root u'\u4f60\u4ee5\u4e3a\u6709\u91cd\u8981\u4fe1\u606f\u4e48\uff1f'
\u6211\u662F\u4E00\u4E2A\u7C89\u5237\u5320\uFF0C\u7C89\u5237\u672C\u9886\u5F3A\uFF0C
\u6211\u8981\u628A\u90A3\u5C0F\u623F\u5B50\uFF0C\u5237\u7684\u5F88\u6F02\u4EAE\u3002
%u6211%u662F%u4E00%u4E2A%u7C89%u5237%u5320%uFF0C%u7C89%u5237%u672C%u9886%u5F3A%uFF0C
%u6211%u8981%u628A%u90A3%u5C0F%u623F%u5B50%uFF0C%u5237%u7684%u5F88%u6F02%u4EAE%u3002
\x31\x2C\x31\x29\x3B\x75\x70\x64\x61\x74\x65\x20\x5B\x64\x76\x5F\x75\x73\x65\x72\x5D\x20\x73\x65\x74\x20\x75\x73\x65\x72\x67\x72\x6F\x75\x70\x69\x64\x3D\x31\x20\x77\x68\x65\x72\x65\x20\x75\x73\x65\x72\x69\x64\x3D\x32\x3B\x2D\x2D\x20
\x75\x73\x65\x72\x69\x64\x3D\x32\x3B\x2D\x2D\x20
0x310x2C0x310x290x3B0x750x700x640x610x740x650x200x5B0x640x760x5F0x750x730x650x720x5D0x200x730x650x740x200x750x730x650x720x670x720x6F0x750x700x690x640x3D0x310x200x770x680x650x720x650x200x750x730x650x720x690x640x3D0x320x3B0x2D0x2D0x20
0x312C31293B757064617465205B64765F757365725D20736574207573657267726F757069643D31207768657265207573657269643D323B2D2D20
 闲话不说了,base64模块真正用的上的方法只有8个,分别是encode, decode,
 ZW5jb2Rlc3RyaW5n, ZGVjb2Rlc3RyaW5n, YjY0ZW5jb2Rl,b64decode,
  dXJsc2FmZV9iNjRkZWNvZGUsdXJsc2FmZV9iNjRlbmNvZGXjgII=他们8个可以两两分为4组,
  ZW5jb2RlLGRlY29kZQ==一组,专门用来编码和 解码文件的,也可以对StringIO里的数据做编解码;
 ZW5jb2Rlc3RyaW5nLGRlY29kZXN0cmluZw==一组,专门用来编码和解码字符串;
'''
        # 保持对象的引用
        self._callbacks = callbacks
        # 获得扩展辅助对象
        self._helpers = callbacks.getHelpers()
        # 设置Extender里面显示的插件名
        callbacks.setExtensionName("DecodeAssistantDev0.2")
        # 用java的swing库创建一个标签
        self._jPanel = swing.JPanel()
        self._jPanel.setLayout(
            swing.BoxLayout(self._jPanel, swing.BoxLayout.Y_AXIS))
        # 文本框
        self._jTextIn = swing.JTextArea(testtext, 20, 120)
        self._jTextIn.setLineWrap(True)
        self._jScrollPaneIn = swing.JScrollPane(self._jTextIn)
        self._jScrollPaneIn.setVerticalScrollBarPolicy(
            swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS)
        self._jScrollPaneIn.setPreferredSize(awt.Dimension(20, 120))
        # 定义2个按钮,编码和解码
        self._jButtonPanel = swing.JPanel()
        self._jButtonEncode = swing.JButton('Encode',
                                            actionPerformed=self.encode)
        self._jButtonDecode = swing.JButton('Decode',
                                            actionPerformed=self.decode)
        self._jButtonPanel.add(self._jButtonEncode)
        self._jButtonPanel.add(self._jButtonDecode)
        self._jPanel.add(self._jScrollPaneIn)
        self._jPanel.add(self._jButtonPanel)

        callbacks.customizeUiComponent(self._jPanel)

        # register ourselves as a message editor tab factory
        callbacks.addSuiteTab(self)
        return
    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
Esempio n. 12
0
    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)
Esempio n. 13
0
    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
Esempio n. 14
0
    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
Esempio n. 15
0
    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()
Esempio n. 16
0
 def create_button(self, table_name, opt, panel, mode=''):
     ContentData.file_path = '/'
     button = swing.JButton(table_name)
     button.setMargin(Insets(0, 0, 0, 0))
     button.addActionListener(
         AddAction(self, opt['type'], opt['funcopt'], mode))
     return button
Esempio n. 17
0
 def __getRepositoryView( self ):
     
     panel = swing.JPanel( java.awt.BorderLayout())
     # jtree = swing.JTree()
     #rmodel = RepositoryModel( self.repository , self.revision) 
     #jtree.setModel( rmodel )
     #jsp = swing.JScrollPane( jtree)
     #panel.add( jsp )
     browser = SVNBrowser( self.repository)
     panel.add( browser )
     
     def setTarget( event ):
         sp = browser.jtree.getSelectionPath() 
         if sp != None:
             path = sp.getPath()
             nwpath = []
             for z in path:
                 nwpath.append( z.toString())
             self.svn = '/'.join( nwpath)
             self.revision = browser.getRevision() 
             self.next() 
         
     jb = swing.JButton( "Select Node To Check Out")
     jb.actionPerformed = setTarget
     buttonpanel = swing.JPanel()
     buttonpanel.add( jb)
     panel.add( buttonpanel, java.awt.BorderLayout.SOUTH)
     return panel
Esempio n. 18
0
    def __init__(self, localVars, globalVars, windowNumber, varsToFilter):
        import time
        self.varsToFilter = varsToFilter

        now = time.localtime(time.time())
        self.title = time.strftime(DEBUG_WINDOW_TITLE, now)
        self.title = self.title % windowNumber
        self.size = DEBUG_WINDOW_SIZE
        self.contentPane.setLayout(
            swing.BoxLayout(self.contentPane, swing.BoxLayout.Y_AXIS))

        #Load the variables from varsToDisplay into an array for the JTable

        #Create panels and button, and place them on the frame
        closeButton = swing.JButton(CLOSE_BUTTON_CAPTION, actionListener=self)

        bottomPanel = swing.JPanel()
        bottomPanel.add(closeButton)

        (topPane, bottomPane) = self.buildContentPane(localVars, globalVars)
        self.contentPane.add(topPane)
        self.contentPane.add(bottomPane)
        self.contentPane.add(bottomPanel)

        self.setDefaultCloseOperation(1)
        self.setVisible(1)
Esempio n. 19
0
    def __init__(self, localVars, globalVars, windowNumber, varsToFilter):
        """
        Creates the layout of the window.
        """
        self.varsToFilter = set(varsToFilter)

        now = time.localtime(time.time())
        self.title = time.strftime(DEBUG_WINDOW_TITLE, now)
        self.title = self.title % windowNumber
        self.size = DEBUG_WINDOW_SIZE
        self.contentPane.setLayout(
            swing.BoxLayout(self.contentPane, swing.BoxLayout.Y_AXIS))

        # Create panels and button, and place them on the frame
        closeButton = swing.JButton(CLOSE_BUTTON_CAPTION, actionListener=self)

        bottomPanel = swing.JPanel()
        bottomPanel.add(closeButton)

        localPane = self.buildTablePane(VAR_L_NAME_COL_CAPTION, localVars)
        globalPane = self.buildTablePane(VAR_G_NAME_COL_CAPTION, globalVars)

        self.contentPane.add(localPane)
        self.contentPane.add(globalPane)
        self.contentPane.add(bottomPanel)

        self.setDefaultCloseOperation(1)
        self.setVisible(1)
Esempio n. 20
0
 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)
Esempio n. 21
0
    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 
Esempio n. 22
0
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
Esempio n. 23
0
 def registerExtenderCallbacks(self, callbacks):
     self._callbacks = callbacks
     self._helpers = callbacks.getHelpers()
     self.context = None
     callbacks.setExtensionName("quoted-printable Parser")
     self._jPanel = swing.JPanel()
     self._jPanel.setLayout(
         swing.BoxLayout(self._jPanel, swing.BoxLayout.Y_AXIS))
     self._jTextIn = swing.JTextArea("Input", 20, 10)
     self._jTextIn.setLineWrap(True)
     self._jScrollPaneIn = swing.JScrollPane(self._jTextIn)
     self._jScrollPaneIn.setVerticalScrollBarPolicy(
         swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS)
     self._jScrollPaneIn.setPreferredSize(awt.Dimension(20, 10))
     self._jTextOut = swing.JTextArea("Output", 20, 10)
     self._jTextOut.setLineWrap(True)
     self._jScrollPaneOut = swing.JScrollPane(self._jTextOut)
     self._jScrollPaneOut.setVerticalScrollBarPolicy(
         swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS)
     self._jScrollPaneOut.setPreferredSize(awt.Dimension(20, 10))
     self._jButtonPanel = swing.JPanel()
     self._jButtonDecode = swing.JButton('Decode',
                                         actionPerformed=self.decode)
     self._jButtonPanel.add(self._jButtonDecode)
     self._jPanel.add(self._jScrollPaneIn)
     self._jPanel.add(self._jButtonPanel)
     self._jPanel.add(self._jScrollPaneOut)
     callbacks.customizeUiComponent(self._jPanel)
     callbacks.addSuiteTab(self)
     return
Esempio n. 24
0
    def runAboutLeoDialog(self, version, theCopyright, url, email):
        """Create and run Leo's About Leo dialog."""
        dialog = self._getDialog("About Leo")
        cpane = dialog.getContentPane()
        data = "%s\n%s\n\n%s\n\n%s" % (version, theCopyright, url, email)
        jtc = swing.JTextArea()
        jtc.setText(data)
        jtc.setEditable(False)
        dialog.add(jtc)

        class cl_act(swing.AbstractAction):
            def __init__(self, dialog):
                swing.AbstractAction.__init__(self, "Close")
                self.dialog = dialog

            def actionPerformed(self, aE):
                self.dialog.dispose()

        button = swing.JButton(cl_act(dialog))
        jbp = swing.JPanel()
        jbp.add(button)
        dialog.add(jbp, awt.BorderLayout.SOUTH)
        dialog.pack()
        w, h = self._calculateCenteredPosition(dialog)
        dialog.setLocation(w, h)
        dialog.setAlwaysOnTop(1)
        dialog.visible = 1
Esempio n. 25
0
    def __init__(self):
        self.size = ABOUT_WINDOW_SIZE
        self.title = ABOUT_TITLE
        self.setLocationRelativeTo(None)
        self.contentPane.setLayout(
            swing.BoxLayout(self.contentPane, swing.BoxLayout.Y_AXIS))

        copyrightInfoArea = swing.JTextPane()
        copyrightInfoArea.setEditable(0)

        #Load copyright information from the JES copyright file
        copyrightFile = open(COPYRIGHT_FILE, 'r')
        copyrightInfoArea.text = copyrightFile.read()
        copyrightInfoArea.setCaretPosition(0)
        copyrightFile.close()

        okButton = swing.JButton(OK_BUTTON_CAPTION, actionListener=self)

        topPane = swing.JScrollPane(copyrightInfoArea)
        topPane.setPreferredSize(
            awt.Dimension(lang.Short.MAX_VALUE, lang.Short.MAX_VALUE))
        bottomPanel = swing.JPanel()
        bottomPanel.add(okButton)
        self.contentPane.add(topPane)
        self.contentPane.add(bottomPanel)
Esempio n. 26
0
 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
Esempio n. 27
0
    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()
Esempio n. 28
0
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
Esempio n. 29
0
    def runAskYesNoCancelDialog(self,
                                title,
                                message=None,
                                yesMessage="Yes",
                                noMessage="No",
                                defaultButton="Yes"):
        """Create and run an askYesNoCancel dialog ."""

        dialog = self._getDialog(title)

        class yno(swing.AbstractAction):

            source = None

            def __init__(self, dialog, name):
                swing.AbstractAction.__init__(self, name)
                self.dialog = dialog

            def actionPerformed(self, aE):
                yno.source = aE.getSource()
                self.dialog.dispose()

        cpane = dialog.getContentPane()
        cpane.add(swing.JLabel(message), awt.BorderLayout.NORTH)
        jp = swing.JPanel()
        cpane.add(jp, awt.BorderLayout.SOUTH)

        yes = swing.JButton(yno(dialog, yesMessage))
        no = swing.JButton(yno(dialog, noMessage))
        cancel = swing.JButton(yno(dialog, "Cancel"))
        jp.add(yes)
        jp.add(no)
        jp.add(cancel)
        dialog.pack()
        w, h = self._calculateCenteredPosition(dialog)
        dialog.setLocation(w, h)
        dialog.setAlwaysOnTop(1)
        dialog.setVisible(True)
        if yno.source is yes:
            return 'yes'
        elif yno.source is no:
            return 'no'
        elif yno.source is cancel:
            return "cancel"
        else:
            if defaultButton == 'Yes': return 'yes'
            else: return 'cancel'
Esempio n. 30
0
    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)