Example #1
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()
Example #2
0
 def createGui( self ):
     
     
     self.jd = jd = swing.JDialog()
     self.jd.setName( "Leodialog" )
     jd.setTitle( "Libraries" )
     jdc = jd.getContentPane()
     self.libs = lib = swing.JList()
     self.libs.setName( "Autolist" )
     lib.setVisibleRowCount( 5 )
     view = swing.JScrollPane( lib )
     jdc.add( view, awt.BorderLayout.NORTH )
     create = swing.JButton( "Create" )
     create.actionPerformed = self.create
     add = swing.JButton( "Add" )
     add.actionPerformed = self.add 
     move = swing.JButton( "Move" )
     move.actionPerformed = self.move
     remove = swing.JButton( "Remove" )
     remove.actionPerformed = self.remove
     _open = swing.JButton( "Open" )
     _open.actionPerformed = self.open 
     close = swing.JButton( "Close" )
     close.actionPerformed = self.close
     
     topjp = swing.JPanel()
     topjp.setLayout( awt.GridLayout( 2, 1 ) )
     jdc.add( topjp, awt.BorderLayout.SOUTH )
     
     self.message = swing.JTextField()
     mp = swing.JPanel()
     gbl = awt.GridBagLayout()
     mp.setLayout( gbl )
     gbc = awt.GridBagConstraints()
     gbc.weightx = 1.0
     gbc.weighty = 1.0
     gbc.fill = 1
     gbl.setConstraints( self.message, gbc )
     mp.add( self.message )
     
     topjp.add( mp )# , awt.BorderLayout.NORTH )
     
     jp = swing.JPanel()
     jp.setLayout( awt.GridLayout( 1, 6 ) )
     jp.add( create )
     jp.add( add )
     jp.add( move )
     jp.add( remove )
     jp.add( _open )
     jp.add( close )
     topjp.add( jp )#, awt.BorderLayout.SOUTH ) 
Example #3
0
 def __init__(self, directory):
     swing.JFrame.__init__(self,
                           title="File Contents Viewer",
                           size=(210, 250))
     self.contentPane.layout = java.awt.BorderLayout()
     self.currentDirectory = directory
     self.files = swing.JList(os.listdir(self.currentDirectory))
     pane = swing.JScrollPane(self.files)
     self.contentPane.add(pane, java.awt.BorderLayout.CENTER)
     fileView = swing.JButton("View Contents",
                              size=(65, 30),
                              actionPerformed=self.fileView)
     self.contentPane.add(fileView, java.awt.BorderLayout.SOUTH)
     self.pack()
     self.visible = 1
Example #4
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
Example #5
0
 def addList( self, frame ):
     
     self.lbox = swing.JList()
     self.lbox.setName( "Autolist" )
     view = swing.JScrollPane( self.lbox )
     self.lbox.setVisibleRowCount( 5 )
     frame.add( view )
     self.setListContents()
     jp = swing.JPanel()
     jp.setLayout( awt.GridLayout( 3, 1 ) )
     frame.add( jp, awt.BorderLayout.EAST )
     
     for z in (  ( "Insert into outline", self.insert ),
                 ( "Remove from list" , self.delete ),
                 ( "Add Current Node to list", self.addCurrentNode ), ):
         jb = swing.JButton( z[ 0 ] )
         jb.actionPerformed = z[ 1 ]
         jp.add( jb )
Example #6
0
    def __init__(self):
        swing.JFrame.__init__(self)
        self.title='Network Application Organizer'
        self.windowClosing=lambda x: sys.exit()

        self.namePane=swing.JPanel(layout=java.awt.BorderLayout())
        self.namePane.add(swing.JLabel('Name:'),'West')
        self.nameText=swing.JTextField(actionPerformed=self.onTrySetName)
        self.namePane.add(self.nameText)
        self.contentPane.add(self.namePane,'North')

        self.tab=swing.JTabbedPane()
        
        self.runningAppData=RunningAppTableModel()
        self.table=swing.JTable(self.runningAppData)
        self.table.selectionMode=swing.ListSelectionModel.SINGLE_SELECTION
        self.table.preferredScrollableViewportSize=300,50
        self.table.mouseClicked=self.onTableClicked

        self.appTypeList=swing.JList(mouseClicked=self.onTypeListClicked,valueChanged=self.onTypeListSelectionChanged)
        createPane=swing.JPanel(layout=java.awt.BorderLayout())
        createPane.add(swing.JScrollPane(self.appTypeList),'West')
        self.startAppButton=swing.JButton('Start',actionPerformed=self.onStartApp)
        createPane.add(self.startAppButton,'East')

        self.optionPanelLayout=java.awt.CardLayout()
        self.optionPanel=swing.JPanel(layout=self.optionPanelLayout)
        self.optionEditor=swing.JComboBox(font=swing.JTable().font)
        createPane.add(self.optionPanel)

        self.tab.addTab('Start New App',createPane)
        self.tab.addTab('Running Apps',swing.JScrollPane(self.table))

        self.contentPane.add(self.tab)
        
        self.pack()
        self.show()
Example #7
0
    def __init__(self):
        #########################################################
        #
        # set up the overall frame (the window itself)
        #
        self.window = swing.JFrame("Swing Sampler!")
        self.window.windowClosing = self.goodbye
        self.window.contentPane.layout = awt.BorderLayout()

        #########################################################
        #
        # under this will be a tabbed pane; each tab is named
        # and contains a panel with other stuff in it.
        #
        tabbedPane = swing.JTabbedPane()
        self.window.contentPane.add("Center", tabbedPane)

        #########################################################
        #
        # The first tabbed panel will be named "Some Basic
        # Widgets", and is referenced by variable 'firstTab'
        #
        firstTab = swing.JPanel()
        firstTab.layout = awt.BorderLayout()
        tabbedPane.addTab("Some Basic Widgets", firstTab)

        #
        # slap in some labels, a list, a text field, etc... Some
        # of these are contained in their own panels for
        # layout purposes.
        #
        tmpPanel = swing.JPanel()
        tmpPanel.layout = awt.GridLayout(3, 1)
        tmpPanel.border = swing.BorderFactory.createTitledBorder(
            "Labels are simple")
        tmpPanel.add(swing.JLabel("I am a label. I am quite boring."))
        tmpPanel.add(
            swing.JLabel(
                "<HTML><FONT COLOR='blue'>HTML <B>labels</B></FONT> are <I>somewhat</I> <U>less boring</U>.</HTML>"
            ))
        tmpPanel.add(
            swing.JLabel("Labels can also be aligned", swing.JLabel.RIGHT))
        firstTab.add(tmpPanel, "North")

        #
        # Notice that the variable "tmpPanel" gets reused here.
        # This next line creates a new panel, but we reuse the
        # "tmpPanel" name to refer to it.  The panel that
        # tmpPanel used to refer to still exists, but we no
        # longer have a way to name it (but that's ok, since
        # we don't need to refer to it any more).

        #
        tmpPanel = swing.JPanel()
        tmpPanel.layout = awt.BorderLayout()
        tmpPanel.border = swing.BorderFactory.createTitledBorder(
            "Tasty tasty lists")

        #
        # Note that here we stash a reference to the list in
        # "self.list".  This puts it in the scope of the object,
        # rather than this function.  This is because we'll be
        # referring to it later from outside this function, so
        # it needs to be "bumped up a level."
        #

        listData = [
            "January", "February", "March", "April", "May", "June", "July",
            "August", "September", "October", "November", "December"
        ]
        self.list = swing.JList(listData)
        tmpPanel.add("Center", swing.JScrollPane(self.list))
        button = swing.JButton("What's Selected?")
        button.actionPerformed = self.whatsSelectedCallback
        tmpPanel.add("East", button)
        firstTab.add("Center", tmpPanel)

        tmpPanel = swing.JPanel()
        tmpPanel.layout = awt.BorderLayout()

        #
        # The text field also goes in self, since the callback
        # that displays the contents will need to get at it.
        #
        # Also note that because the callback is a function inside
        # the SwingSampler object, you refer to it through self.
        # (The callback could potentially be outside the object,
        # as a top-level function. In that case you wouldn't
        # use the 'self' selector; any variables that it uses
        # would have to be in the global scope.
        #
        self.field = swing.JTextField()
        tmpPanel.add(self.field)
        tmpPanel.add(
            swing.JButton("Click Me", actionPerformed=self.clickMeCallback),
            "East")
        firstTab.add(tmpPanel, "South")

        #########################################################
        #
        # The second tabbed panel is next...  This shows
        # how to build a basic web browser in about 20 lines.
        #
        secondTab = swing.JPanel()
        secondTab.layout = awt.BorderLayout()
        tabbedPane.addTab("HTML Fanciness", secondTab)

        tmpPanel = swing.JPanel()
        tmpPanel.add(swing.JLabel("Go to:"))
        self.urlField = swing.JTextField(40, actionPerformed=self.goToCallback)
        tmpPanel.add(self.urlField)
        tmpPanel.add(swing.JButton("Go!", actionPerformed=self.goToCallback))
        secondTab.add(tmpPanel, "North")

        self.htmlPane = swing.JEditorPane("http://www.google.com",
                                          editable=0,
                                          hyperlinkUpdate=self.followHyperlink,
                                          preferredSize=(400, 400))
        secondTab.add(swing.JScrollPane(self.htmlPane), "Center")

        self.statusLine = swing.JLabel("(status line)")
        secondTab.add(self.statusLine, "South")

        #########################################################
        #
        # The third tabbed panel is next...
        #
        thirdTab = swing.JPanel()
        tabbedPane.addTab("Other Widgets", thirdTab)

        imageLabel = swing.JLabel(
            swing.ImageIcon(
                net.URL("http://www.gatech.edu/images/logo-gatech.gif")))
        imageLabel.toolTipText = "Labels can have images! Every widget can have a tooltip!"
        thirdTab.add(imageLabel)

        tmpPanel = swing.JPanel()
        tmpPanel.layout = awt.GridLayout(3, 2)
        tmpPanel.border = swing.BorderFactory.createTitledBorder(
            "Travel Checklist")
        tmpPanel.add(
            swing.JCheckBox("Umbrella", actionPerformed=self.checkCallback))
        tmpPanel.add(
            swing.JCheckBox("Rain coat", actionPerformed=self.checkCallback))
        tmpPanel.add(
            swing.JCheckBox("Passport", actionPerformed=self.checkCallback))
        tmpPanel.add(
            swing.JCheckBox("Airline tickets",
                            actionPerformed=self.checkCallback))
        tmpPanel.add(
            swing.JCheckBox("iPod", actionPerformed=self.checkCallback))
        tmpPanel.add(
            swing.JCheckBox("Laptop", actionPerformed=self.checkCallback))
        thirdTab.add(tmpPanel)

        tmpPanel = swing.JPanel()
        tmpPanel.layout = awt.GridLayout(4, 1)
        tmpPanel.border = swing.BorderFactory.createTitledBorder("My Pets")
        #
        # A ButtonGroup is used to indicate which radio buttons
        # go together.
        #
        buttonGroup = swing.ButtonGroup()

        radioButton = swing.JRadioButton("Dog",
                                         actionPerformed=self.radioCallback)
        buttonGroup.add(radioButton)
        tmpPanel.add(radioButton)

        radioButton = swing.JRadioButton("Cat",
                                         actionPerformed=self.radioCallback)
        buttonGroup.add(radioButton)
        tmpPanel.add(radioButton)

        radioButton = swing.JRadioButton("Pig",
                                         actionPerformed=self.radioCallback)
        buttonGroup.add(radioButton)
        tmpPanel.add(radioButton)

        radioButton = swing.JRadioButton("Capybara",
                                         actionPerformed=self.radioCallback)
        buttonGroup.add(radioButton)
        tmpPanel.add(radioButton)

        thirdTab.add(tmpPanel)

        self.window.pack()
        self.window.show()
Example #8
0
    def createGui(self):

        mpanel = swing.JPanel(java.awt.BorderLayout())
        self.available = jlist = swing.JList()
        jlist.setVisibleRowCount(5)
        jlsp = swing.JScrollPane(jlist)
        self.addTitledBorder(jlsp, "Members")

        #jlist.setListData( ("catssssssssss", "rats" ))
        mpanel.add(jlsp, java.awt.BorderLayout.WEST)
        jtp = swing.JTabbedPane()
        mpanel.add(jtp, java.awt.BorderLayout.CENTER)

        tpanel = swing.JPanel()
        slayout = swing.SpringLayout()
        tpanel.setLayout(slayout)
        jtp.addTab("Messages", tpanel)
        self.jta = jta = swing.JTextArea()
        jsp = swing.JScrollPane(jta)
        self.addTitledBorder(jsp, "Instant Messages")
        jsp.setPreferredSize(java.awt.Dimension(500, 200))
        tpanel.add(jsp)
        slayout.putConstraint(slayout.NORTH, jsp, 5, slayout.NORTH, tpanel)
        slayout.putConstraint(slayout.EAST, tpanel, 5, slayout.EAST, jsp)
        self.sendmessage = jta2 = swing.JTextArea()
        jsp2 = swing.JScrollPane(jta2)
        self.addTitledBorder(jsp2, "Compose Message")
        jsp2.setPreferredSize(java.awt.Dimension(250, 200))
        tpanel.add(jsp2)
        slayout.putConstraint(slayout.NORTH, jsp2, 5, slayout.SOUTH, jsp)
        jb = swing.JButton("Send Message")
        jb.actionPerformed = lambda event: self.sendMessage()
        tpanel.add(jb)
        slayout.putConstraint(slayout.NORTH, jb, 0, slayout.NORTH, jsp2)
        slayout.putConstraint(slayout.WEST, jb, 5, slayout.EAST, jsp2)
        jb2 = swing.JButton("Clear")
        jb2.actionPerformed = lambda event: self.sendmessage.setText("")
        tpanel.add(jb2)
        slayout.putConstraint(slayout.NORTH, jb2, 5, slayout.SOUTH, jb)
        slayout.putConstraint(slayout.WEST, jb2, 5, slayout.EAST, jsp2)
        slayout.putConstraint(slayout.SOUTH, tpanel, 5, slayout.SOUTH, jsp2)

        npanel = swing.JPanel()
        slayout = swing.SpringLayout()
        npanel.setLayout(slayout)
        jtp.addTab("Nodes", npanel)
        self.table = jtable = swing.JTable()

        self.dtm = dtm = swing.table.DefaultTableModel()
        dtm.addColumn("From")
        dtm.addColumn("Node Name")
        jtable.setModel(dtm)
        jsp3 = swing.JScrollPane(jtable)
        jsp3.setPreferredSize(java.awt.Dimension(500, 200))
        npanel.add(jsp3)
        slayout.putConstraint(slayout.NORTH, jsp3, 5, slayout.NORTH, npanel)
        slayout.putConstraint(slayout.EAST, npanel, 5, slayout.EAST, jsp3)
        jb3 = swing.JButton("Send Current Node To")
        jb3.actionPerformed = lambda event: self.sendNode()
        npanel.add(jb3)
        slayout.putConstraint(slayout.NORTH, jb3, 5, slayout.SOUTH, jsp3)
        slayout.putConstraint(slayout.SOUTH, npanel, 5, slayout.SOUTH, jb3)
        jb4 = swing.JButton("Insert Selected Row")
        jb4.actionPerformed = lambda event: self.insertNode()
        npanel.add(jb4)
        slayout.putConstraint(slayout.NORTH, jb4, 0, slayout.NORTH, jb3)
        slayout.putConstraint(slayout.EAST, jb4, 0, slayout.EAST, jsp3)
        jf = swing.JFrame()
        jf.add(mpanel)
        jf.pack()
        jf.visible = 1
    def initGui(self):
        self.tab = swing.JPanel()
        self.titleLabel = swing.JLabel("Burp Importer")
        self.titleLabel.setFont(Font("Tahoma", 1, 16))
        self.titleLabel.setForeground(Color(235, 136, 0))
        self.infoLabel = swing.JLabel(
            "Burp Importer loads a list of URLs or parses output from various automated scanners and populates the sitemap with each successful connection."
        )
        self.infoLabel.setFont(Font("Tahoma", 0, 12))
        self.fileOptionLabel = swing.JLabel("File Load Option")
        self.fileOptionLabel.setFont(Font("Tahoma", 1, 12))
        self.fileDescLabel = swing.JLabel(
            "This option is only used when loading a file to be parsed for http(s) connections.  You can disregard this option and paste a list of URLs in the box below."
        )
        self.fileDescLabel.setFont(Font("Tahoma", 0, 12))
        self.fileDescLabel2 = swing.JLabel(
            "Supported files: .gnamp, .nessus, .txt")
        self.fileDescLabel2.setFont(Font("Tahoma", 0, 12))
        self.parseFileButton = swing.JButton("Load File to Parse",
                                             actionPerformed=self.loadFile)
        self.urlLabel = swing.JLabel("URL List")
        self.urlLabel.setFont(Font("Tahoma", 1, 12))
        self.urlDescLabel = swing.JLabel(
            "URLs in this list should be in the format: protocol://host:port/optional-path"
        )
        self.urlDescLabel.setFont(Font("Tahoma", 0, 12))
        self.urlDescLabel2 = swing.JLabel(
            "Example: https://127.0.0.1:443/index. Port is optional, 80 or 443 will be assumed."
        )
        self.urlDescLabel2.setFont(Font("Tahoma", 0, 12))
        self.pasteButton = swing.JButton("Paste", actionPerformed=self.paste)
        self.loadButton = swing.JButton("Copy List",
                                        actionPerformed=self.setClipboardText)
        self.removeButton = swing.JButton("Remove",
                                          actionPerformed=self.remove)
        self.clearButton = swing.JButton("Clear", actionPerformed=self.clear)
        self.urlListModel = swing.DefaultListModel()
        self.urlList = swing.JList(self.urlListModel)
        self.urlListPane = swing.JScrollPane(self.urlList)
        self.addButton = swing.JButton("Add", actionPerformed=self.addURL)
        self.runLabel = swing.JLabel(
            "<html>Click the <b>RUN</b> button to attempt a connection to each URL in the URL List.  Successful connections will be added to Burp's sitemap.</html>"
        )
        self.runLabel.setFont(Font("Tahoma", 0, 12))
        self.redirectsCheckbox = swing.JCheckBox(
            "Enable: Follow Redirects (301 or 302 Response)")
        self.runButton = swing.JButton("RUN", actionPerformed=self.runClicked)
        self.runButton.setFont(Font("Tahoma", 1, 12))
        self.addUrlField = swing.JTextField("New URL...",
                                            focusGained=self.clearField,
                                            focusLost=self.fillField)
        self.logLabel = swing.JLabel("Log:")
        self.logLabel.setFont(Font("Tahoma", 1, 12))
        self.logPane = swing.JScrollPane()
        self.logArea = swing.JTextArea(
            "Burp Importer Log - Parsing and Run details will be appended here.\n"
        )
        self.logArea.setLineWrap(True)
        self.logPane.setViewportView(self.logArea)
        self.webPortDict = {'80':'http','81':'http','82':'http','83':'http','443':'https','2301':'http','2381':'https','8000':'http','8008':'http','8080':'http','8083':'https','8180':'http','8400':'http',\
        '8443':'https','8834':'https','8888':'http','9001':'http','9043':'https','9080':'http','9090':'http','9100':'http','9443':'https'}
        self.bar = swing.JSeparator(swing.SwingConstants.HORIZONTAL)
        self.bar2 = swing.JSeparator(swing.SwingConstants.HORIZONTAL)
        layout = swing.GroupLayout(self.tab)
        self.tab.setLayout(layout)

        # Credit to Antonio Sánchez and https://github.com/Dionach/HeadersAnalyzer/
        layout.setHorizontalGroup(
            layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING).
            addGroup(layout.createSequentialGroup().addGap(15).addGroup(
                layout.createParallelGroup(
                    swing.GroupLayout.Alignment.LEADING).addComponent(
                        self.titleLabel).addComponent(
                            self.infoLabel).addComponent(
                                self.fileOptionLabel).addComponent(
                                    self.fileDescLabel).addComponent(
                                        self.fileDescLabel2).addComponent(
                                            self.parseFileButton).addComponent(
                                                self.bar).addComponent(
                                                    self.urlLabel).
                addComponent(self.urlDescLabel).addComponent(
                    self.urlDescLabel2).addComponent(self.bar2).addComponent(
                        self.runLabel).addComponent(
                            self.redirectsCheckbox).addComponent(
                                self.runButton).addComponent(
                                    self.logPane,
                                    swing.GroupLayout.PREFERRED_SIZE, 525,
                                    swing.GroupLayout.PREFERRED_SIZE).
                addGroup(layout.createSequentialGroup().addGroup(
                    layout.createParallelGroup(
                        swing.GroupLayout.Alignment.TRAILING).
                    addComponent(self.addButton).addGroup(
                        layout.createParallelGroup(
                            swing.GroupLayout.Alignment.LEADING).addComponent(
                                self.logLabel).addGroup(
                                    layout.createParallelGroup(
                                        swing.GroupLayout.Alignment.TRAILING,
                                        False).addComponent(
                                            self.removeButton,
                                            swing.GroupLayout.DEFAULT_SIZE,
                                            swing.GroupLayout.DEFAULT_SIZE,
                                            lang.Short.MAX_VALUE).addComponent(
                                                self.pasteButton,
                                                swing.GroupLayout.DEFAULT_SIZE,
                                                swing.GroupLayout.DEFAULT_SIZE,
                                                lang.Short.MAX_VALUE).
                                    addComponent(
                                        self.loadButton,
                                        swing.GroupLayout.DEFAULT_SIZE,
                                        swing.GroupLayout.DEFAULT_SIZE,
                                        lang.Short.MAX_VALUE).addComponent(
                                            self.clearButton,
                                            swing.GroupLayout.DEFAULT_SIZE,
                                            swing.GroupLayout.PREFERRED_SIZE,
                                            lang.Short.MAX_VALUE)))
                ).addPreferredGap(
                    swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(
                        layout.createParallelGroup(
                            swing.GroupLayout.Alignment.LEADING).addComponent(
                                self.urlListPane,
                                swing.GroupLayout.PREFERRED_SIZE, 350,
                                swing.GroupLayout.PREFERRED_SIZE).addComponent(
                                    self.addUrlField,
                                    swing.GroupLayout.PREFERRED_SIZE, 350,
                                    swing.GroupLayout.PREFERRED_SIZE)))).
                     addContainerGap(26, lang.Short.MAX_VALUE)))

        layout.setVerticalGroup(
            layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING).
            addGroup(
                layout.createSequentialGroup().addGap(15).addComponent(
                    self.titleLabel).addGap(10).addComponent(
                        self.infoLabel).addGap(10).addComponent(
                            self.fileOptionLabel).addGap(10).addComponent(
                                self.fileDescLabel).addGap(10).addComponent(
                                    self.fileDescLabel2).addGap(10).
                addComponent(self.parseFileButton).addGap(10).addComponent(
                    self.bar).addComponent(
                        self.urlLabel).addGap(10).addComponent(
                            self.urlDescLabel).addGap(10).
                addComponent(self.urlDescLabel2).addPreferredGap(
                    swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(
                        layout.createParallelGroup(
                            swing.GroupLayout.Alignment.LEADING).
                        addGroup(layout.createSequentialGroup().addGroup(
                            layout.createParallelGroup(
                                swing.GroupLayout.Alignment.LEADING).
                            addGroup(layout.createSequentialGroup(
                            ).addComponent(self.pasteButton).addPreferredGap(
                                swing.LayoutStyle.ComponentPlacement.RELATED
                            ).addComponent(self.loadButton).addPreferredGap(
                                swing.LayoutStyle.ComponentPlacement.RELATED
                            ).addComponent(self.removeButton).addPreferredGap(
                                swing.LayoutStyle.ComponentPlacement.RELATED
                            ).addComponent(self.clearButton)).addComponent(
                                self.urlListPane,
                                swing.GroupLayout.PREFERRED_SIZE, 138,
                                swing.GroupLayout.PREFERRED_SIZE)).addGap(10).
                                 addGroup(
                                     layout.createParallelGroup(
                                         swing.GroupLayout.Alignment.BASELINE).
                                     addComponent(self.addButton).addComponent(
                                         self.addUrlField,
                                         swing.GroupLayout.PREFERRED_SIZE,
                                         swing.GroupLayout.DEFAULT_SIZE,
                                         swing.GroupLayout.PREFERRED_SIZE)))
                    ).addGap(10).addComponent(self.bar2).addComponent(
                        self.runLabel).addGap(10).addComponent(
                            self.redirectsCheckbox).addGap(10).addComponent(
                                self.runButton).addGap(10).
                addComponent(self.logLabel).addPreferredGap(
                    swing.LayoutStyle.ComponentPlacement.RELATED).addGap(
                        8, 8, 8).addComponent(
                            self.logPane, swing.GroupLayout.PREFERRED_SIZE,
                            125,
                            swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(
                                swing.LayoutStyle.ComponentPlacement.RELATED
                            ).addContainerGap(swing.GroupLayout.DEFAULT_SIZE,
                                              lang.Short.MAX_VALUE)))
        return
Example #10
0
        def createWidgets(self):

            self.dialog = swing.JDialog()
            self.dialog.setTitle("Spell Checker")
            cpane = self.dialog.getContentPane()
            blayout = swing.BoxLayout(cpane, swing.BoxLayout.Y_AXIS)
            cpane.setLayout(blayout)
            self.word = swing.JTextField()
            self.word.setEditable(False)
            cwborder = sborder.TitledBorder("Current Word:")
            self.word.setBorder(cwborder)
            cpane.add(self.word)
            self.possible = swing.JTextField()
            pborder = sborder.TitledBorder("Change To:")
            self.possible.setBorder(pborder)
            cpane.add(self.possible)
            center = swing.JPanel()
            blayout = swing.BoxLayout(center, swing.BoxLayout.X_AXIS)
            center.setLayout(blayout)
            self.jlist = swing.JList()
            self.jlist.setSelectionMode(
                swing.ListSelectionModel.SINGLE_SELECTION)
            self.jlist.setVisibleRowCount(5)

            class _listSelectionListener(sevent.ListSelectionListener):
                def __init__(self, jlist, possible):
                    self.jlist = jlist
                    self.possible = possible

                def valueChanged(self, event):
                    self.possible.setText(str(self.jlist.getSelectedValue()))

            self.jlist.addListSelectionListener(
                _listSelectionListener(self.jlist, self.possible))
            spane = swing.JScrollPane(self.jlist)
            spborder = sborder.TitledBorder("Suggestions")
            spane.setBorder(spborder)
            center.add(spane)
            bpanel = swing.JPanel()
            blayout = swing.BoxLayout(bpanel, swing.BoxLayout.Y_AXIS)
            bpanel.setLayout(blayout)
            center.add(bpanel)
            change = swing.JButton("Change")
            change.actionPerformed = self.change
            changeall = swing.JButton("Change All")
            changeall.actionPerformed = self.changeAll
            ignore = swing.JButton("Ignore All")
            ignore.actionPerformed = self.ignore
            add = swing.JButton("Add")
            add.actionPerformed = self.add
            bpanel.add(change)
            bpanel.add(changeall)
            bpanel.add(ignore)
            bpanel.add(add)
            cpane.add(center)
            self.next = swing.JButton("Next")
            self.next.actionPerformed = self.checkNextWord
            self.close = swing.JButton("Close")
            self.close.actionPerformed = lambda event: self.dialog.hide()
            jpanel = swing.JPanel()
            jpanel.add(self.next)
            jpanel.add(self.close)
            cpane.add(jpanel)
            self.dialog.pack()
Example #11
0
 def __init__(self):
     self._jlist = swing.JList()
     self.layout = awt.BorderLayout()
     self._jscrollpane = swing.JScrollPane(self._jlist)
     self.add(self._jscrollpane, awt.BorderLayout.CENTER)
Example #12
0
    def initGui(self):

        # Define elements        
        self.tab = swing.JPanel()
        self.settingsLabel = swing.JLabel("Settings:")
        self.settingsLabel.setFont(Font("Tahoma", 1, 12));
        self.boringHeadersLabel = swing.JLabel("Boring Headers")
        self.pasteButton = swing.JButton("Paste", actionPerformed=self.paste)
        self.loadButton = swing.JButton("Load", actionPerformed=self.load)
        self.removeButton = swing.JButton("Remove", actionPerformed=self.remove)
        self.clearButton = swing.JButton("Clear", actionPerformed=self.clear)
        self.jScrollPane1 = swing.JScrollPane()
        self.boringHeadersList = swing.JList()
        self.addButton = swing.JButton("Add", actionPerformed=self.add)
        self.addTF = swing.JTextField("New item...", focusGained=self.emptyTF, focusLost=self.fillTF)
        self.interestingHeadersCB = swing.JCheckBox("Check for Interesting Headers")
        self.securityHeadersCB = swing.JCheckBox("Check for Security Headers", actionPerformed=self.onSelect)
        self.xFrameOptionsCB = swing.JCheckBox("X-Frame-Options")
        self.xContentTypeOptionsCB = swing.JCheckBox("X-Content-Type-Options")
        self.xXssProtectionCB = swing.JCheckBox("X-XSS-Protection")
        self.HstsCB = swing.JCheckBox("Strict-Transport-Security (HSTS)")
        self.CorsCB = swing.JCheckBox("Access-Control-Allow-Origin (CORS)")
        self.contentSecurityPolicyCB = swing.JCheckBox("Content-Security-Policy")
        self.xPermittedCrossDomainPoliciesCB = swing.JCheckBox("X-Permitted-Cross-Domain-Policies")
        self.outputLabel = swing.JLabel("Output:")
        self.outputLabel.setFont(Font("Tahoma", 1, 12));
        self.logsLabel = swing.JLabel("Logs")
        self.jScrollPane2 = swing.JScrollPane()
        self.logsTA = swing.JTextArea()
        self.exportButton = swing.JButton("Export in report friendly format", actionPerformed=self.export)

        self.jScrollPane1.setViewportView(self.boringHeadersList)
        self.logsTA.setColumns(20)
        self.logsTA.setRows(7)
        self.jScrollPane2.setViewportView(self.logsTA)

        # Configure layout

        layout = swing.GroupLayout(self.tab)
        self.tab.setLayout(layout)
        layout.setHorizontalGroup(
            layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(33, 33, 33)
                .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(83, 83, 83)
                        .addComponent(self.boringHeadersLabel))
                    .addComponent(self.settingsLabel)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(self.interestingHeadersCB)
                        .addGap(149, 149, 149)
                        .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
                            .addComponent(self.securityHeadersCB)
                            .addComponent(self.HstsCB)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(layout.createSequentialGroup()
                                            .addComponent(self.xFrameOptionsCB)
                                            .addGap(83, 83, 83))
                                        .addGroup(layout.createSequentialGroup()
                                            .addComponent(self.xContentTypeOptionsCB)
                                            .addGap(47, 47, 47)))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(self.xXssProtectionCB)
                                        .addGap(83, 83, 83)))
                                .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(self.xPermittedCrossDomainPoliciesCB)
                                    .addComponent(self.contentSecurityPolicyCB)
                                    .addComponent(self.CorsCB)))))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(self.addButton)
                            .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
                                .addComponent(self.outputLabel)
                                .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.TRAILING, False)
                                    .addComponent(self.removeButton, swing.GroupLayout.DEFAULT_SIZE, swing.GroupLayout.DEFAULT_SIZE, lang.Short.MAX_VALUE)
                                    .addComponent(self.pasteButton, swing.GroupLayout.DEFAULT_SIZE, swing.GroupLayout.DEFAULT_SIZE, lang.Short.MAX_VALUE)
                                    .addComponent(self.loadButton, swing.GroupLayout.DEFAULT_SIZE, swing.GroupLayout.DEFAULT_SIZE, lang.Short.MAX_VALUE)
                                    .addComponent(self.clearButton, swing.GroupLayout.DEFAULT_SIZE, swing.GroupLayout.PREFERRED_SIZE, lang.Short.MAX_VALUE))))
                        .addPreferredGap(swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
                            .addComponent(self.jScrollPane1, swing.GroupLayout.PREFERRED_SIZE, 200, swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(self.addTF, swing.GroupLayout.PREFERRED_SIZE, 200, swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(self.jScrollPane2, swing.GroupLayout.PREFERRED_SIZE, 450, swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(self.logsLabel)
                            .addComponent(self.exportButton))))
                .addContainerGap(26, lang.Short.MAX_VALUE))
        )

        layout.setVerticalGroup(
            layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addComponent(self.settingsLabel)
                .addGap(31, 31, 31)
                .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(self.interestingHeadersCB)
                    .addComponent(self.securityHeadersCB))
                .addGap(26, 26, 26)
                .addComponent(self.boringHeadersLabel)
                .addPreferredGap(swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(self.pasteButton)
                                .addPreferredGap(swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(self.loadButton)
                                .addPreferredGap(swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(self.removeButton)
                                .addPreferredGap(swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(self.clearButton))
                            .addComponent(self.jScrollPane1, swing.GroupLayout.PREFERRED_SIZE, 138, swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(self.addButton)
                            .addComponent(self.addTF, swing.GroupLayout.PREFERRED_SIZE, swing.GroupLayout.DEFAULT_SIZE, swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(self.xFrameOptionsCB)
                            .addComponent(self.CorsCB))
                        .addPreferredGap(swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
                            .addComponent(self.xContentTypeOptionsCB)
                            .addComponent(self.contentSecurityPolicyCB, swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(self.xXssProtectionCB)
                            .addComponent(self.xPermittedCrossDomainPoliciesCB))
                        .addPreferredGap(swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(self.HstsCB)))
                .addGap(30, 30, 30)
                .addComponent(self.outputLabel)
                .addPreferredGap(swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(self.logsLabel)
                .addGap(8, 8, 8)
                .addComponent(self.jScrollPane2, swing.GroupLayout.PREFERRED_SIZE, 250, swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(self.exportButton)
                .addContainerGap(swing.GroupLayout.DEFAULT_SIZE, lang.Short.MAX_VALUE))
        )
Example #13
0
    def __init__(self, movie):
        try:
            self.size = (600, 400)
            self.movie = movie
            self.fps = 30

            # The buttons on the right side

            self.clearButton = swing.JButton(
                COMMAND_CLEAR_IMG, actionPerformed=self.actionPerformed)
            self.addButton = swing.JButton(
                COMMAND_ADD_IMG, actionPerformed=self.actionPerformed)
            self.addDirectoryButton = swing.JButton(
                COMMAND_ADD_DIR, actionPerformed=self.actionPerformed)
            self.deleteButton = swing.JButton(
                COMMAND_DELETE_IMG, actionPerformed=self.actionPerformed)
            self.playButton = swing.JButton(
                COMMAND_PLAY_MOVIE, actionPerformed=self.actionPerformed)
            self.moveUpButton = swing.JButton(
                COMMAND_MOVE_UP, actionPerformed=self.actionPerformed)
            self.moveDownButton = swing.JButton(
                COMMAND_MOVE_DOWN, actionPerformed=self.actionPerformed)
            self.changeFPSButton = swing.JButton(
                COMMAND_CHANGE_FPS, actionPerformed=self.actionPerformed)

            self.buttonpane = swing.JPanel()
            self.buttonpane.setLayout(
                swing.BoxLayout(self.buttonpane, swing.BoxLayout.Y_AXIS))

            self.buttonpane.add(self.clearButton)
            self.buttonpane.add(self.deleteButton)
            self.buttonpane.add(self.addDirectoryButton)
            self.buttonpane.add(self.addButton)
            self.buttonpane.add(self.playButton)
            self.buttonpane.add(self.moveUpButton)
            self.buttonpane.add(self.moveDownButton)
            self.buttonpane.add(self.changeFPSButton)

            # The images on the left side

            self.listModel = swing.DefaultListModel()
            self.list = swing.JList(self.listModel)

            self.listpane = swing.JScrollPane(self.list)
            #self.listpane.setLayout(swing.BoxLayout(self.listpane, swing.BoxLayout.X_AXIS))
            # self.listpane.add(self.list)

            # The splitter pane

            splitterPane = swing.JSplitPane()
            splitterPane.orientation = swing.JSplitPane.HORIZONTAL_SPLIT
            splitterPane.leftComponent = self.listpane
            splitterPane.rightComponent = self.buttonpane
            splitterPane.setDividerSize(SPLITTER_SIZE)
            splitterPane.setDividerLocation(VSPLITTER_LOCATION)
            splitterPane.setResizeWeight(1.0)

            self.add(splitterPane)
            self.addFramesIntoListModel(self.movie)
            self.show()

        except:
            import traceback
            import sys
            a, b, c = sys.exc_info()
            print "FrameSequencerTool exception:"
            traceback.print_exception(a, b, c)
Example #14
0
    def getUiComponent(self):
        # Create the tab
        self.tab = swing.JPanel(BorderLayout())

        # Created a tabbed pane to go in the center of the
        # main tab, below the text area
        tabbedPane = swing.JTabbedPane()
        self.tab.add("Center", tabbedPane)

        # First tab
        parseTab = swing.JPanel(BorderLayout())
        tabbedPane.addTab("Parser", parseTab)

        # Second tab
        enumTab = swing.JPanel(BorderLayout())
        tabbedPane.addTab("Enumerate Functions", enumTab)

        # Create a vertical box to house GWT message and label
        # Create a horizontal box for GWT-RPC text box's label
        # Add the label to the horizontal box
        # Add the horizontal box to the vertical box
        gwtMessageBoxVertical = swing.Box.createVerticalBox()
        gwtLabelBoxHorizontal = swing.Box.createHorizontalBox()
        gwtRPCTextLabel = swing.JLabel("GWT-RPC Message")
        gwtLabelBoxHorizontal.add(gwtRPCTextLabel)
        gwtMessageBoxVertical.add(gwtLabelBoxHorizontal)

        # Create a horizontal text box to house the GWT message itself
        # Add text area to message box
        # Add new box to gwtMessageBoxVertical
        gwtMessageTextBoxHorizontal = swing.Box.createHorizontalBox()
        self.gwtTextArea = swing.JTextArea('', 4, 120)
        self.gwtTextArea.setLineWrap(True)
        gwtMessageTextBoxHorizontal.add(self.gwtTextArea)
        gwtMessageBoxVertical.add(gwtMessageTextBoxHorizontal)

        #
        gwtParseButtonBoxHorizontal = swing.Box.createHorizontalBox()
        parseButtonPanel = swing.JPanel()
        parseButtonPanel.add(
            swing.JButton('Parse', actionPerformed=self.parseGWT))
        gwtParseButtonBoxHorizontal.add(parseButtonPanel)
        gwtMessageBoxVertical.add(gwtParseButtonBoxHorizontal)

        # Panel for the boxes. Each label and text field
        # will go in horizontal boxes which will then go in
        # a vertical box

        parseTabGWTMessageBoxHorizontal = swing.Box.createHorizontalBox()
        parseTabGWTMessageBoxHorizontal.add(gwtMessageBoxVertical)
        parseTab.add("North", parseTabGWTMessageBoxHorizontal)

        parsedBoxVertical = swing.Box.createVerticalBox()

        parsedBoxHorizontal = swing.Box.createHorizontalBox()
        self.parsedGWTField = swing.JTextArea()
        parsedBoxHorizontal.add(self.parsedGWTField)
        parsedBoxVertical.add(parsedBoxHorizontal)

        # Label for the insertion points box
        # horizontal box (label)
        # horizontal box (textarea)
        # inside a vertical box (insertBoxVertical)
        insertBoxVertical = swing.Box.createVerticalBox()

        insertPointBoxHorizontal = swing.Box.createHorizontalBox()
        self.insertPointField = swing.JTextArea()
        insertPointBoxHorizontal.add(self.insertPointField)
        insertBoxVertical.add(insertPointBoxHorizontal)

        functions = ["test", "test2"]
        functionList = swing.JList(functions)

        # Create and set split pane contents for enumerate tab
        spl = swing.JSplitPane(swing.JSplitPane.HORIZONTAL_SPLIT)
        spl.leftComponent = swing.JScrollPane(functionList)
        spl.rightComponent = swing.JLabel("right")

        enumTab.add("Center", spl)

        parseTabTabbedPane = swing.JTabbedPane()
        parseTab.add(parseTabTabbedPane)

        # Parse tab
        parsedRPCTab = swing.JPanel(BorderLayout())
        parseTabTabbedPane.addTab("Parsed", parsedRPCTab)

        # Insert points tab
        insertPointsTab = swing.JPanel(BorderLayout())
        parseTabTabbedPane.addTab("Insertion Points", insertPointsTab)

        parsedRPCTab.add("Center", parsedBoxVertical)
        insertPointsTab.add("Center", insertBoxVertical)

        return self.tab
def generateUI(file_list):
    # window
    frame = swing.JFrame("Marcksl1 prescreen tool")
    frame.setDefaultCloseOperation(swing.JFrame.DISPOSE_ON_CLOSE)
    frame.setPreferredSize(Dimension(700, 500))
    frame.setSize(Dimension(700, 500))
    frame.setLocationByPlatform(True)

    layout = GridBagLayout()
    frame.setLayout(layout)

    # image list
    lst_constraints = quickSetGridBagConstraints(GridBagConstraints(), 0, 0,
                                                 0.5, 0.33)
    lst_constraints.fill = GridBagConstraints.BOTH
    lst = swing.JList(file_list)
    lst_scrollpane = swing.JScrollPane(lst)
    layout.setConstraints(lst_scrollpane, lst_constraints)
    frame.add(lst_scrollpane)

    # radio buttons
    radio_panel_constraints = quickSetGridBagConstraints(
        GridBagConstraints(), 1, 0, 0.25, 0.33)
    radio_panel_constraints.fill = GridBagConstraints.HORIZONTAL

    isvButton = swing.JRadioButton("ISV", True)
    dlavButton = swing.JRadioButton("DLAV")

    radio_group = swing.ButtonGroup()
    radio_group.add(isvButton)
    radio_group.add(dlavButton)

    radio_panel = swing.JPanel()
    radio_panel_layout = GridLayout(2, 1)
    radio_panel.setLayout(radio_panel_layout)
    radio_panel.add(isvButton)
    radio_panel.add(dlavButton)
    radio_panel.setBorder(
        swing.BorderFactory.createTitledBorder(
            swing.BorderFactory.createEtchedBorder(), "Vessel type"))
    layout.setConstraints(radio_panel, radio_panel_constraints)
    frame.add(radio_panel)

    # checkboxes
    chk_constraints = quickSetGridBagConstraints(GridBagConstraints(), 2, 0,
                                                 0.25, 0.33)
    chk_constraints.fill = GridBagConstraints.HORIZONTAL
    chkbox = swing.JCheckBox("Is lumenised?", True)
    layout.setConstraints(chkbox, chk_constraints)
    frame.add(chkbox)

    # add ROI button
    roi_but_constraints = quickSetGridBagConstraints(GridBagConstraints(), 0,
                                                     1, 1, 0.16)
    roi_but_constraints.gridwidth = 3
    roi_but_constraints.fill = GridBagConstraints.BOTH
    roi_but = swing.JButton("Add current ROI")
    layout.setConstraints(roi_but, roi_but_constraints)
    frame.add(roi_but)

    # metadata display table
    mdtbl_constraints = quickSetGridBagConstraints(GridBagConstraints(), 0, 2,
                                                   1, 0.33)
    mdtbl_constraints.gridwidth = 3
    mdtbl_constraints.fill = GridBagConstraints.BOTH

    mdtbl_colnames = [
        'Experiment', 'Embryo', 'Imaged region index', 'ROI index',
        'Vessel type', 'Lumenised?'
    ]
    mdtbl_model = swing.table.DefaultTableModel(mdtbl_colnames, 10)
    mdtbl = swing.JTable()

    mdtbl_scrollpane = swing.JScrollPane(mdtbl)
    layout.setConstraints(mdtbl_scrollpane, mdtbl_constraints)
    frame.add(mdtbl_scrollpane)

    # buttons
    del_but_constraints = quickSetGridBagConstraints(GridBagConstraints(), 1,
                                                     3, 0.25, 0.16)
    del_but_constraints.fill = GridBagConstraints.BOTH
    del_but = swing.JButton("Delete selected ROI")
    layout.setConstraints(del_but, del_but_constraints)
    frame.add(del_but)

    save_but_constraints = quickSetGridBagConstraints(GridBagConstraints(), 2,
                                                      3, 0.25, 0.16)
    save_but_constraints.fill = GridBagConstraints.BOTH
    save_but = swing.JButton("Save...")
    layout.setConstraints(save_but, save_but_constraints)
    frame.add(save_but)

    # show window
    frame.setVisible(True)
    frame.pack()
Example #16
0
FirstRow += 1
LastRow += 1

# Debug mode (display amount and first and last row)
if debug:
    print "FirstRow : " + FirstRow.toString()
    print "LastRow  : " + LastRow.toString()
    print "Amount   : " + amount.toString()

while not _session.isStopMacroRequested() and not done:
    screen.sendKeys("[pf5]")
    waitWhileLocked(1)
    screenChars = screen.getScreenAsChars()
    times = 0
    lm = swing.DefaultListModel()
    list = swing.JList(lm)
    while times < amount:
        prtdev = java.lang.StringBuffer()
        fillWithValues(9 + times, 7, 10, prtdev)
        status = java.lang.StringBuffer()
        fillWithValues(9 + times, 19, 4, status)
        if status.toString() == "MSGW":
            lm.addElement("   " + prtdev.toString() + "   " + \
                          "Check Printer")
            count += 1
        times += 1
    if not lm.isEmpty():
        done = 1
        StatusWindow()
    else:
        if screen.getOIA().isKeyBoardLocked():