예제 #1
0
        def getMainComponent(self):
            self._mainPanel = JPanel(BorderLayout())
            # input
            self._consolePwd = JTextField()
            self._consolePwd.setEditable(False)
            self._consolePwd.setText("Not initialized")
            self._consoleInput = JTextField()
            #Remove 'tab' low-level tab-function of jumping to other component, so I can use it
            self._consoleInput.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET)
            self._consoleInput.addActionListener(self.EnterPress())
            self._consoleInput.addKeyListener(self.KeyPress())
            self._inputPanel = JPanel(BorderLayout())
            self._inputPanel.add(self._consolePwd, BorderLayout.WEST)
            self._inputPanel.add(self._consoleInput, BorderLayout.CENTER)
            # output
            self._consoleOutput = JTextArea()
            self._consoleOutput.setEditable(False)
            self._consoleOutput.setForeground(Color.WHITE)
            self._consoleOutput.setBackground(Color.BLACK)
            self._consoleOutput.setFont(self._consoleOutput.getFont().deriveFont(12.0))

            self._scrollPaneConsoleOutput = JScrollPane(self._consoleOutput)

            # Add to main panel and return the main panel
            self._mainPanel.add(self._scrollPaneConsoleOutput, BorderLayout.CENTER)
            self._mainPanel.add(self._inputPanel, BorderLayout.SOUTH)
            return self._mainPanel
예제 #2
0
    def __init__(self, table):

        self.setTitle("Add Proxy")
        self.setSize(200, 100)
        self.setVisible(True)
        self.table = table
        #self.getContentPane().add(about,BorderLayout.CENTER)

        boxHorizontal = Box.createHorizontalBox()
        boxVertical = Box.createVerticalBox()
        boxHorizontal.add(JLabel("IP:"))
        self.jIpText = JTextField(20)
        boxHorizontal.add(self.jIpText)
        boxVertical.add(boxHorizontal)

        boxHorizontal = Box.createHorizontalBox()
        boxHorizontal.add(JLabel("PROT:"))
        self.jPortText = JTextField(20)
        boxHorizontal.add(self.jPortText)
        boxVertical.add(boxHorizontal)

        boxHorizontal = Box.createHorizontalBox()
        boxHorizontal.add(JButton("Add", actionPerformed=self.addIP))
        boxVertical.add(boxHorizontal)

        self.getContentPane().add(boxVertical, BorderLayout.CENTER)
예제 #3
0
def makeUI(model):
    table = JTable(model)
    jsp = JScrollPane(table)
    regex_label = JLabel("Search: ")
    regex_field = JTextField(20)
    top = JPanel()
    top.add(regex_label)
    top.add(regex_field)
    top.setLayout(BoxLayout(top, BoxLayout.X_AXIS))
    base_path_label = JLabel("Base path:")
    base_path_field = JTextField(50)
    bottom = JPanel()
    bottom.add(base_path_label)
    bottom.add(base_path_field)
    bottom.setLayout(BoxLayout(bottom, BoxLayout.X_AXIS))
    all = JPanel()
    all.add(top)
    all.add(jsp)
    all.add(bottom)
    all.setLayout(BoxLayout(all, BoxLayout.Y_AXIS))
    frame = JFrame("File paths")
    frame.getContentPane().add(all)
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
    frame.addWindowListener(Closing())
    frame.pack()
    frame.setVisible(True)
    # Listeners
    regex_field.addKeyListener(EnterListener(table, model, frame))
    table.addMouseListener(RowClickListener(base_path_field))
    #
    return model, table, regex_field, frame
예제 #4
0
파일: gui.py 프로젝트: kfuruya/ChatClient
 def __init__(self):
     # Launches the login screen, initializes self.window, the primary frame
     self.done = False
     self.friendsData = ['']
     self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     self.chatHistory = {}
     self.usernameField = JTextField('guest', 20)
     self.status = JTextField(text='setStatus', editable=True)
     self.portNumber = "6666"
     self.IP = "127.0.0.1"
     self.window = swing.JFrame("Catchy Messenger Name")
     self.chatWindow = swing.JFrame()
     self.window.windowClosing = self.goodbye
     tempPanel = swing.JPanel()
     tempPanel = awt.BorderLayout()
     loginPage = JPanel(GridLayout(0, 2))
     self.window.add(loginPage)
     loginPage.add(JLabel("Enter today's username", SwingConstants.RIGHT))
     loginPage.add(self.usernameField)
     textIP = swing.JTextField(text=self.IP, editable=True)
     #chatHistory = swing.JTextArea(text = "new chat instance!", editable = False, lineWrap = True, size = (300,1))
     loginButton = JButton('Log in', actionPerformed=self.login)
     loginPage.add(JLabel(""))
     loginPage.add(loginButton)
     loginPage.add(textIP)
     loginPage.add(JLabel("Change IP from default?", SwingConstants.LEFT))
     loginPage.add(swing.JTextField(text=self.portNumber, editable=True))
     loginPage.add(JLabel("Change Port from default?"))
     self.window.pack()
     self.window.visible = True
     return
예제 #5
0
    def __init__(self, app):
        strings = app.strings

        self.setLayout(GridLayout(3, 2, 5, 5))
        userLbl = JLabel(strings.getString("osmose_pref_username"))
        self.userTextField = JTextField(20)
        self.userTextField.setToolTipText(
            strings.getString("osmose_pref_username_tooltip"))

        levelLbl = JLabel(strings.getString("osmose_pref_level"))
        self.levels = ["1", "1,2", "1,2,3", "2", "3"]
        self.levelsCombo = JComboBox(self.levels)
        self.levelsCombo.setToolTipText(
            strings.getString("osmose_pref_level_tooltip"))

        limitLbl = JLabel(strings.getString("osmose_pref_limit"))
        self.limitTextField = JTextField(20)
        self.limitTextField.setToolTipText(
            strings.getString("osmose_pref_limit_tooltip"))

        self.add(userLbl)
        self.add(self.userTextField)
        self.add(levelLbl)
        self.add(self.levelsCombo)
        self.add(limitLbl)
        self.add(self.limitTextField)
예제 #6
0
    def testJTextField(self):
        firstNameField = JTextField()
        lastNameField = JTextField()
        birthYearField = JFormattedTextField()
        self.group.bind(self.person, u'firstName', firstNameField,
                        u'text', mode=TWOWAY)
        self.group.bind(self.person, u'lastName', lastNameField,
                        u'text', mode=TWOWAY)
        self.group.bind(self.person, u'birthYear', birthYearField,
                        u'value', mode=TWOWAY)
        self.group.bind(self.person,
                        u'"%s %s, %s" % (firstName, lastName, birthYear)',
                        self.dummy, u'value')
        assert firstNameField.text == u'Joe'

        firstNameField.text = u'Mary'
        assert self.person.firstName == u'Mary'
        assert self.dummy.value == u'Mary Average, 1970'

        self.person.firstName = u'Susan'
        assert firstNameField.text == u'Susan'
        assert self.dummy.value == u'Susan Average, 1970'

        self.person.lastName = u'Mediocre'
        assert lastNameField.text == u'Mediocre'
        assert self.dummy.value == u'Susan Mediocre, 1970'
예제 #7
0
 def __init__(self):
     self.usernameLabel = JLabel('Username : '******'Password : '******'Login', actionPerformed=self.login)
     self.initComponents()
예제 #8
0
 def build(self):
     #labels
     cl = JLabel("Celcius")
     cl.setBounds(10, 10, 60, 20)
     fl = JLabel("Farenheit")
     fl.setBounds(120, 10, 60, 20)
     kl = JLabel("Kelvin")
     kl.setBounds(230, 10, 60, 20)
     #celcius textfield
     c = JTextField()
     c.setBounds(10, 40, 60, 20)
     c.addActionListener(lambda x: log(x))
     #farenheit textfield
     f = JTextField()
     f.setBounds(120, 40, 60, 20)
     f.addActionListener(lambda x: log(x))
     #kelvin textfield
     k = JTextField()
     k.setBounds(230, 40, 60, 20)
     k.addActionListener(lambda x: log(x))
     #buttons
     cv = JButton("Convert")
     cv.addActionListener(lambda x: self.convert(x))
     cv.setBounds(10, 70, 300 - 10, 30)
     clean = JButton("Clean")
     clean.addActionListener(lambda x: self.clean())
     clean.setBounds(10, 110, 300 - 10, 30)
     #add vars to frame
     list(map(lambda x: self.add(x), [cl, kl, fl, c, f, k, cv, clean]))
     self.k = k
     self.c = c
     self.f = f
     self.textfields = {self.c, self.f, self.k}
def changePasswordForm(check):
    global frame
    global tfOldPassword
    global tfNewPassword
    global tfConfirmPassword
    global value

    value = check

    frame = JFrame("Change Password")
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
    frame.setSize(500, 350)
    frame.setLocation(200, 200)
    frame.setLayout(None)
    frame.setVisible(True)

    panel = JPanel()
    panel.setSize(500, 350)
    panel.setLocation(0, 0)
    panel.setLayout(None)
    panel.setVisible(True)
    panel.setBackground(Color.LIGHT_GRAY)

    heading = JLabel("Change Password")
    heading.setBounds(200, 30, 150, 40)

    lbOldPassword = JLabel("Old Password")
    lbNewPassword = JLabel("New Password")
    lbConfirmPassword = JLabel("Confirm Password")

    tfOldPassword = JTextField()
    tfNewPassword = JTextField()
    tfConfirmPassword = JTextField()

    lbOldPassword.setBounds(50, 100, 150, 30)
    lbNewPassword.setBounds(50, 150, 150, 30)
    lbConfirmPassword.setBounds(50, 200, 150, 30)

    tfOldPassword.setBounds(220, 100, 150, 30)
    tfNewPassword.setBounds(220, 150, 150, 30)
    tfConfirmPassword.setBounds(220, 200, 150, 30)

    btnSave = JButton("Save", actionPerformed=clickSave)
    btnCancel = JButton("Cancel", actionPerformed=clickCancel)

    btnSave.setBounds(350, 280, 100, 30)
    btnCancel.setBounds(50, 280, 100, 30)

    panel.add(heading)
    panel.add(lbOldPassword)
    panel.add(lbNewPassword)
    panel.add(lbConfirmPassword)
    panel.add(tfOldPassword)
    panel.add(tfNewPassword)
    panel.add(tfConfirmPassword)
    panel.add(btnSave)
    panel.add(btnCancel)

    frame.add(panel)
예제 #10
0
 def __init__(self):
     self.usernameLabel = JLabel('Username : '******'Super Password : '******'Delete',
                                   actionPerformed=self.deleteAdmin)
     self.initComponents()
예제 #11
0
    def initializeGUI(self):
        # table panel of scope entries
        self._url_table = Table(self)
        table_popup = JPopupMenu();
        remove_item_menu = JMenuItem(self._remove_description, actionPerformed=self.removeFromScope)
        table_popup.add(remove_item_menu)
        self._url_table.setComponentPopupMenu(table_popup)
        self._url_table.addMouseListener(TableMouseListener(self._url_table))
        scrollPane = JScrollPane(self._url_table)

        # setting panel              

        ##  locate checkboxes
        ### for constants, see: https://portswigger.net/burp/extender/api/constant-values.html#burp.IBurpExtenderCallbacks.TOOL_PROXY          
        self._checkboxes = {
            2:    JCheckBox('Target'),
            4:    JCheckBox('Proxy'),
            8:    JCheckBox('Spider'),
            16:   JCheckBox('Scanner'),
            32:   JCheckBox('Intruder'),            
            64:   JCheckBox('Repeater'),
            128:  JCheckBox('Sequencer'),
            1024: JCheckBox('Extender')
        }
        checkboxes_components = {0: dict(zip(range(1,len(self._checkboxes) + 1), self._checkboxes.values()))}

        self._label_value_regex_now_1 = JLabel("(1) Regex for the value to store: ")
        self._label_value_regex_now_2 = JLabel("")
        self._label_value_regex = JLabel("(1) New regex:")
        self._form_value_regex = JTextField("", 64)
        self._button_value_regex = JButton('Update', actionPerformed=self.updateTokenSourceRegex)        
        self._label_header_now_1 = JLabel("(2) Header for sending the value: ")
        self._label_header_now_2 = JLabel("")
        self._label_header = JLabel("(2) New header key: ")
        self._form_header = JTextField("", 64)
        self._button_header = JButton('Update', actionPerformed=self.updateHeaderName)
        self._label_add_url = JLabel("Add this URL: ")
        self._form_add_url = JTextField("", 64)
        self._button_add_url = JButton('Add', actionPerformed=self.addURLDirectly)
                
        ## logate regex settings
        ui_components_for_settings_pane = {
            0: { 0: JLabel("Local Settings:") },
            1: { 0: self._label_value_regex_now_1, 1: self._label_value_regex_now_2 },
            2: { 0: self._label_value_regex, 1: self._form_value_regex, 2: self._button_value_regex},
            3: { 0: self._label_header_now_1, 1: self._label_header_now_2 },
            4: { 0: self._label_header, 1: self._form_header, 2: self._button_header},
            5: { 0: {'item': JSeparator(JSeparator.HORIZONTAL), 'width': 3, }},
            6: { 0: JLabel("General Settings:") },
            7: { 0: self._label_add_url, 1: self._form_add_url, 2: self._button_add_url},
            8: { 0: JLabel("Use this extender in:"), 1: {'item': self.compose_ui(checkboxes_components), 'width': 3} }
        }
        # build a split panel & set UI component
        self._splitpane = JSplitPane(JSplitPane.VERTICAL_SPLIT)
        self._splitpane.setResizeWeight(0.85)
        self._splitpane.setLeftComponent(scrollPane)
        self._splitpane.setRightComponent(self.compose_ui(ui_components_for_settings_pane))
        self._callbacks.customizeUiComponent(self._splitpane)
예제 #12
0
def addCourse():
    global tfCourseName
    global tfCourseId
    global tfCourseFee
    global frame
    global btnEnter

    frame = JFrame("Add Course ")
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
    frame.setSize(450, 450)
    frame.setLocation(200, 200)
    frame.setLayout(None)
    frame.setVisible(True)

    panel = JPanel()
    panel.setSize(450, 450)
    panel.setLocation(0, 0)
    panel.setLayout(None)
    panel.setVisible(True)
    panel.setBackground(Color.LIGHT_GRAY)

    heading = JLabel("ADD COURSE")
    heading.setBounds(200, 30, 150, 40)

    lbCourseName = JLabel("Course Name ")
    lbCourseId = JLabel("Course Id")
    lbCourseFee = JLabel(" Course Fee")

    tfCourseName = JTextField()
    tfCourseId = JTextField()
    tfCourseFee = JTextField()

    lbCourseName.setBounds(70, 120, 130, 30)
    lbCourseId.setBounds(70, 170, 130, 30)
    lbCourseFee.setBounds(70, 220, 130, 30)

    tfCourseName.setBounds(220, 120, 150, 30)
    tfCourseId.setBounds(220, 170, 150, 30)
    tfCourseFee.setBounds(220, 220, 150, 30)

    btnEnter = JButton("Enter", actionPerformed=clickAddCourseFee)
    btnEnter.setBounds(300, 300, 100, 40)

    btnCancel = JButton("Cancel", actionPerformed=clickCancel)
    btnCancel.setBounds(70, 300, 100, 40)

    panel.add(heading)
    panel.add(lbCourseName)
    panel.add(lbCourseId)
    panel.add(lbCourseFee)
    panel.add(tfCourseFee)
    panel.add(tfCourseName)
    panel.add(tfCourseId)
    panel.add(tfCourseFee)
    panel.add(btnEnter)
    panel.add(btnCancel)

    frame.add(panel)
예제 #13
0
 def getUiComponent(self):
     self.HaEPanel = JPanel()
     self.HaEPanel.setBorder(None)
     self.HaEPanel.setLayout(BorderLayout(0, 0))
     self.panel = JPanel()
     self.HaEPanel.add(self.panel, BorderLayout.NORTH)
     self.panel.setLayout(BorderLayout(0, 0))
     self.tabbedPane = JTabbedPane(JTabbedPane.TOP)
     self.panel.add(self.tabbedPane, BorderLayout.CENTER)
     self.setPanel = JPanel()
     self.tabbedPane.addTab("Set", None, self.setPanel, None)
     self.setPanel.setLayout(BorderLayout(0, 0))
     self.setPanel_1 = JPanel()
     self.setPanel.add(self.setPanel_1, BorderLayout.NORTH)
     self.nameString = JLabel("Name")
     self.setPanel_1.add(self.nameString)
     self.nameTextField = JTextField()
     self.setPanel_1.add(self.nameTextField)
     self.nameTextField.setColumns(10)
     self.regexString = JLabel("Regex")
     self.setPanel_1.add(self.regexString)
     self.regexTextField = JTextField()
     self.setPanel_1.add(self.regexTextField)
     self.regexTextField.setColumns(10)
     self.extractCheckBox = JCheckBox("Extract")
     self.setPanel_1.add(self.extractCheckBox)
     self.highlightCheckBox = JCheckBox("Highlight")
     self.setPanel_1.add(self.highlightCheckBox)
     self.setPanel_2 = JPanel()
     self.setPanel.add(self.setPanel_2)
     self.colorString = JLabel("Color")
     self.setPanel_2.add(self.colorString)
     self.colorTextField = JTextField()
     self.setPanel_2.add(self.colorTextField)
     self.colorTextField.setColumns(5)
     self.addBottun = JButton("Add", actionPerformed=self.addConfig)
     self.setPanel_2.add(self.addBottun)
     self.tipString = JLabel("")
     self.setPanel_2.add(self.tipString)
     self.configPanel = JPanel()
     self.tabbedPane.addTab("Config", None, self.configPanel, None)
     self.configPanel.setLayout(BorderLayout(0, 0))
     self.configString = JLabel("This is config file content.")
     self.configString.setHorizontalAlignment(SwingConstants.CENTER)
     self.configPanel.add(self.configString, BorderLayout.NORTH)
     self.configTextArea = JTextArea()
     self.configTextArea.setEnabled(False)
     self.configTextArea.setTabSize(4)
     self.configTextArea.setLineWrap(True)
     self.configTextArea.setRows(20)
     self.configPanel.add(self.configTextArea, BorderLayout.SOUTH)
     self.scrollPane = JScrollPane(self.configTextArea)
     self.configPanel.add(self.scrollPane, BorderLayout.SOUTH)
     self.reloadButton = JButton("Reload",
                                 actionPerformed=self.reloadConfig)
     self.configPanel.add(self.reloadButton, BorderLayout.CENTER)
     return self.HaEPanel
예제 #14
0
    def __init__(self):  # constructor
        # origing of coordinates
        self.coordx = 10
        self.coordy = 10

        # inintialize values
        self.Canvas = None
        self.default_naming = 'MouseID_ExperimentalGroup_slide-X'

        # create panel (what is inside the GUI)
        self.panel = self.getContentPane()
        self.panel.setLayout(GridLayout(8, 2))
        self.setTitle('Subdividing ROIs')

        # define buttons here:
        self.subimage_number = DefaultListModel()
        mylist = JList(self.subimage_number, valueChanged=self.open_lowres_image)
        # mylist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        mylist.setLayoutOrientation(JList.VERTICAL)
        mylist.setVisibleRowCount(1)
        listScroller1 = JScrollPane(mylist)
        listScroller1.setPreferredSize(Dimension(200, 90))

        quitButton = JButton("Quit", actionPerformed=self.quit)
        selectInputFolderButton = JButton("Select Input", actionPerformed=self.select_input)
        cubifyROIButton = JButton("Cubify ROI", actionPerformed=self.cubify_ROI)
        saveButton = JButton("Save ROIs", actionPerformed=self.save_ROIs)

        self.textfield1 = JTextField('18')
        self.textfield2 = JTextField(self.default_naming)
        self.textfield3 = JTextField('R-Tail')
        self.textfield4 = JTextField('6, 4, 22.619')
        self.textfield5 = JTextField('0')

        # add buttons here
        self.panel.add(Label("Name your image, or use filename"))
        self.panel.add(self.textfield2)
        self.panel.add(selectInputFolderButton)
        self.panel.add(listScroller1)
        self.panel.add(Label("Adjust the size of the squared ROIs"))
        self.panel.add(self.textfield1)
        self.panel.add(Label("give a name of your hand-drawn ROI"))
        self.panel.add(self.textfield3)
        self.panel.add(Label("For ARA: piram, ch, res"))
        # piramid number (high to low), channel number, final resolution (um/px)"))
        self.panel.add(self.textfield4)
        self.panel.add(Label("Piramid to check (0:none; 1:highest)"))
        self.panel.add(self.textfield5)
        self.panel.add(cubifyROIButton)
        self.panel.add(saveButton)
        self.panel.add(quitButton)

        # other stuff to improve the look
        self.pack()  # packs the frame
        self.setVisible(True)  # shows the JFrame
        self.setLocation(self.coordx, self.coordy)
예제 #15
0
    def run(self):
        frame = JFrame('VerifierTest1',
                       locationRelativeTo=None,
                       defaultCloseOperation=JFrame.EXIT_ON_CLOSE)
        frame.add(JTextField('Enter "pass"', inputVerifier=inputChecker()),
                  BorderLayout.NORTH)
        frame.add(JTextField('TextField 2'), BorderLayout.SOUTH)

        frame.pack()
        frame.setVisible(1)
예제 #16
0
    def tab_ui(self):
        self.panel = JPanel()
        self.panel.setLayout(None)

        self.ui_client_dnslog_label_1 = JLabel('-' * 10 +
                                               u' IP伪造请求头 & DNSLog 配置 ' +
                                               '-' * 155)
        self.ui_client_dnslog_label_1.setBounds(20, 10, 1000, 28)

        self.ui_client_ip_label_1 = JLabel(u'伪造IP: ')
        self.ui_client_ip_label_1.setBounds(20, 40, 70, 30)
        self.ui_client_ip = JTextField('127.0.0.1')
        self.ui_client_ip.setBounds(80, 40, 200, 28)

        self.ui_client_url_label_1 = JLabel(u'dnslog url: ')
        self.ui_client_url_label_1.setBounds(10, 80, 70, 30)
        self.ui_client_url = JTextField('http://examlpe.com')
        self.ui_client_url.setBounds(80, 80, 200, 28)

        self.ui_button_label = JLabel('-' * 210)
        self.ui_button_label.setBounds(20, 110, 1000, 28)

        #self.ui_web_test_button = JButton(u'登录测试', actionPerformed=self.login_test)
        #self.ui_web_test_button.setBounds(20, 140, 100, 28)

        self.ui_save_button = JButton(u'保存配置',
                                      actionPerformed=self.save_configuration)
        self.ui_save_button.setBounds(20, 140, 100, 28)

        self.ui_debug_button = JButton('Debug', actionPerformed=self.debug_fun)
        self.ui_debug_button.setBounds(135, 140, 100, 28)
        self.panel.add(self.ui_debug_button)

        self.ui_log_box = JTextArea('')
        self.ui_log_box.setLineWrap(True)
        self.ui_log_box.setEditable(False)
        self.ui_log_scroll_pane = JScrollPane(self.ui_log_box)
        self.ui_log_scroll_pane.setBounds(20, 190, self.log_box_width,
                                          self.log_box_height)

        self.panel.add(self.ui_client_dnslog_label_1)
        self.panel.add(self.ui_client_ip_label_1)
        self.panel.add(self.ui_client_ip)
        self.panel.add(self.ui_client_url_label_1)
        self.panel.add(self.ui_client_url)

        self.panel.add(self.ui_button_label)
        #self.panel.add(self.ui_web_test_button)
        self.panel.add(self.ui_save_button)

        self.panel.add(self.ui_log_scroll_pane)

        self.tools.panel = self.panel
        self.tools.log_box = self.ui_log_box
        self.tools.log_scroll_pane = self.ui_log_scroll_pane
예제 #17
0
def makeUI(model):
    # Components:
    table = JTable(model)
    jsp = JScrollPane(table)
    regex_label = JLabel("Search: ")
    regex_field = JTextField(20)
    base_path_label = JLabel("Base path:")
    base_path_field = JTextField(50)
    if base_path is not None:
        base_path_field.setText(base_path)
    # Panel for all components
    all = JPanel()
    all.setBorder(EmptyBorder(20, 20, 20, 20))
    layout, c = GridBagLayout(), GC()
    all.setLayout(layout)
    # First row: label and regex text field
    add(all, regex_label, gridx=0, gridy=0)  # with default constraints
    add(all, regex_field, gridx=1, gridy=0, fill=GC.HORIZONTAL, weightx=1.0)
    # Second row: the table
    add(all,
        jsp,
        gridx=0,
        gridy=1,
        fill=GC.BOTH,
        gridwidth=2,
        weightx=1.0,
        weighty=1.0)  # full weights so it stretches when resizing
    # Third row: the base path
    add(all, base_path_label, gridx=0, gridy=2)
    add(all,
        base_path_field,
        gridx=1,
        gridy=2,
        fill=GC.HORIZONTAL,
        weightx=1.0)
    # Window frame
    frame = JFrame("File paths")
    frame.getContentPane().add(all)
    #frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
    frame.addWindowListener(Closing())
    frame.pack()
    frame.setVisible(True)
    # Listeners
    regex_field.addKeyListener(EnterListener(table))
    table.addMouseListener(RowClickListener(base_path_field))
    al = ArrowListener(table, regex_field)
    table.addKeyListener(al)
    regex_field.addKeyListener(al)
    # Instead of a KeyListener, use the input vs action map
    table.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
                            "enter")
    table.getActionMap().put("enter", OpenImageFromTableCell())
    #
    return model, table, regex_field, frame
예제 #18
0
    def __init__(self):
        self.running = True
        menuBar = JMenuBar()

        menu = JMenu("File")
        menu.add(OpenAction(self))
        menu.add(CloseAction(self))
        menu.addSeparator()
        menu.add(QuitAction(self))
        self.addWindowListener(ProfelisWindowAdapter(self))
        menuBar.add(menu)

        self.setJMenuBar(menuBar)

        self.contentPane = JPanel()
        self.contentPane.layout = GridBagLayout()
        constraints = GridBagConstraints()

        self.blastLocation = JTextField(
            System.getProperty("user.home") + "/blast")
        self.databaseLocation = JTextField(
            System.getProperty("user.home") + "/blast/db")
        self.projects = JTabbedPane()

        constraints.gridx, constraints.gridy = 0, 0
        constraints.gridwidth, constraints.gridheight = 1, 1
        constraints.fill = GridBagConstraints.NONE
        constraints.weightx, constraints.weighty = 0, 0
        self.contentPane.add(JLabel("Blast Location"), constraints)
        constraints.gridx, constraints.gridy = 1, 0
        constraints.fill = GridBagConstraints.HORIZONTAL
        constraints.weightx, constraints.weighty = 1, 0
        self.contentPane.add(self.blastLocation, constraints)
        constraints.gridx, constraints.gridy = 2, 0
        constraints.fill = GridBagConstraints.NONE
        constraints.weightx, constraints.weighty = 0, 0
        self.contentPane.add(JButton(BlastAction(self)), constraints)
        constraints.gridx, constraints.gridy = 3, 0
        constraints.fill = GridBagConstraints.NONE
        constraints.weightx, constraints.weighty = 0, 0
        self.contentPane.add(JLabel("Database Location"), constraints)
        constraints.gridx, constraints.gridy = 4, 0
        constraints.fill = GridBagConstraints.HORIZONTAL
        constraints.weightx, constraints.weighty = 1, 0
        self.contentPane.add(self.databaseLocation, constraints)
        constraints.gridx, constraints.gridy = 5, 0
        constraints.fill = GridBagConstraints.NONE
        constraints.weightx, constraints.weighty = 0, 0
        self.contentPane.add(JButton(DatabaseAction(self)), constraints)
        constraints.gridx, constraints.gridy = 0, 1
        constraints.gridwidth, constraints.gridheight = 6, 1
        constraints.fill = GridBagConstraints.BOTH
        constraints.weightx, constraints.weighty = 1, 1
        self.contentPane.add(self.projects, constraints)
예제 #19
0
    def buildAddEditPrompt(self,
                           typeValue=None,
                           searchValue=None,
                           replacementValue=None):
        """
        Builds the replacement rules add/edit prompt.

        Args:
            typeValue: the value that will be set on the type JLabel.
            searchValue: the value that will be set on the search JLabel.
            replacementValue: the value that will be set on the replacement JLabel.

        Return:
            tuple: (type, search, replacement) as input by user.
        """
        panel = Box.createVerticalBox()

        typeLabel = JLabel("Replacement type")
        type = JComboBox([REPLACE_HEADER_NAME])
        searchLabel = JLabel("Header Name / Search String")
        search = JTextField()
        replaceLabel = JLabel("Replacement Value")
        replacement = JTextField()

        panel.add(typeLabel)
        panel.add(type)
        panel.add(searchLabel)
        panel.add(search)
        panel.add(replaceLabel)
        panel.add(replacement)

        if typeValue:
            type.setSelectedItem(typeValue)

        if searchValue:
            search.text = searchValue

        if replacementValue:
            replacement.text = replacementValue

        title = "Add Replacement Rule" if type == None else "Edit Replacement Rule"

        result = JOptionPane.showConfirmDialog(None, panel,
                                               "Add Replacement Rule",
                                               JOptionPane.PLAIN_MESSAGE)

        if result == JOptionPane.OK_OPTION:
            if search.text.strip() == "":
                self.messageDialog("Header name must be non-blank.")
                raise InvalidInputException()
            else:
                return type.selectedItem, search.text, replacement.text
        else:
            raise InvalidInputException()
    def __init__(self):
        JPanel.__init__(self)

        self.setLayout(GridBagLayout())
        self.setBorder(TitledBorder("Channel"))

        # some helper constants
        REL = GridBagConstraints.RELATIVE
        REM = GridBagConstraints.REMAINDER
        HORIZ = GridBagConstraints.HORIZONTAL
        NW = GridBagConstraints.NORTHWEST
        CENTER = GridBagConstraints.CENTER

        # --- title
        label = JLabel("Title:")
        self.constrain(label, REL, REL, REL, 1, HORIZ, CENTER, 1.0, 1.0, 2, 2,
                       2, 2)
        self.field_title = JTextField()
        self.field_title.setEditable(0)
        self.constrain(self.field_title, REL, REL, REM, 1, HORIZ, CENTER, 1.0,
                       1.0, 2, 2, 2, 2)

        # --- description
        label = JLabel("Description:")
        self.constrain(label, REL, REL, REL, 1, HORIZ, NW, 1.0, 1.0, 2, 2, 2,
                       2)
        self.field_descr = JTextArea(3, 40)
        self.field_descr.setEditable(0)
        # wrap long lines
        self.field_descr.setLineWrap(1)
        # allow only full words to be wrapped
        self.field_descr.setWrapStyleWord(1)
        # ensure that the border look is the same
        self.field_descr.setBorder(self.field_title.getBorder())
        self.constrain(self.field_descr, REL, REL, REM, 1, HORIZ, NW, 1.0, 1.0,
                       2, 2, 2, 2)

        # --- location
        label = JLabel("Location:")
        self.constrain(label, REL, REL, REL, 1, HORIZ, NW, 1.0, 1.0, 2, 2, 2,
                       2)
        self.field_location = JTextField()
        self.constrain(self.field_location, REL, REL, REM, REL, HORIZ, NW, 1.0,
                       1.0, 2, 2, 2, 2)

        # --- last update
        label = JLabel("Last Update:")
        self.constrain(label, REL, REL, REL, REM, HORIZ, NW, 1.0, 1.0, 2, 2, 2,
                       2)
        self.field_lastupdate = JTextField()
        self.field_lastupdate.setEditable(0)
        self.constrain(self.field_lastupdate, REL, REL, REM, REM, HORIZ, NW,
                       1.0, 1.0, 2, 2, 2, 2)
예제 #21
0
    def __init__(self, extender):
        self._callbacks = extender._callbacks
        self._helpers = extender._callbacks.getHelpers()
        self._callbacks.registerScannerCheck(self)
        # Creamos el contenedor de paneles.
        self.contenedor = JTabbedPane()

        # Campos del sub-tab 1 (mash up)
        self._tab1_nombre = JTextField()
        self._tab1_apellido = JTextField()
        self._tab1_FNacimiento = JTextField()
        self._tab1_mascota = JTextField()
        self._tab1_otro = JTextField()

        self._tab1_feedback_ta = JTextArea('This may take a while . . .')
        self._tab1_feedback_ta.setEditable(False)
        self._tab1_feedback_sp = JScrollPane(self._tab1_feedback_ta)

        self._tab1_minsize = JSlider(4, 16, 6)
        self._tab1_minsize.setMajorTickSpacing(1)
        self._tab1_minsize.setPaintLabels(True)

        self._tab1_maxsize = JSlider(4, 16, 10)
        self._tab1_maxsize.setMajorTickSpacing(1)
        self._tab1_maxsize.setPaintLabels(True)

        self._tab1_specialchars = JTextField('!,@,#,$,&,*')
        self._tab1_transformations = JCheckBox('1337 mode')
        self._tab1_firstcapital = JCheckBox('first capital letter')

        # Campos del sub-tab 2 (redirect)
        self._tab2_JTFa = JTextField()
        self._tab2_JTFaa = JTextField()
        self._tab2_JTFb = JTextField()
        self._tab2_JTFbb = JTextField()
        self._tab2_boton = JButton(' Redirect is Off ',
                                   actionPerformed=self.switch_redirect)
        self._tab2_boton.background = Color.lightGray
        self._tab2_encendido = False

        # Campos del sub-tab 3 (loader)
        self._tab3_urls_ta = JTextArea(15, 5)
        self._tab3_urls_sp = JScrollPane(self._tab3_urls_ta)

        # Campos del sub-tab 4 (headers)
        self._tab4_tabla_model = DefaultTableModel()
        self._tab4_headers_dict = {}

        # Campos del sub-tab 5 (reverse ip)
        self._tab5_target = JTextArea(15, 5)
        self._tab5_target_sp = JScrollPane(self._tab5_target)
예제 #22
0
 def build_ampersand_row(self):
     '''
     Builds the &-line row.
     '''
     # Build own panel with SpringLayout.
     panel = JPanel()
     layout = SpringLayout()
     panel.setLayout(layout)
     # Create necessary components and add them to panel.
     ampersand_label = JLabel("CDLI's ID: ")
     self.left_field = JTextField('&')
     equals_label = JLabel('=')
     self.right_field = JTextField()
     tooltip_text = ("<html><body>This is the ID and text's designation "
                     "according to<br/>the CDLI catalog. If your text is "
                     "not yet in the<br/>catalog, please email "
                     "[email protected] to get<br/>an ID and designation.")
     help_label = self.build_help_label(tooltip_text)
     panel.add(ampersand_label)
     panel.add(self.left_field)
     panel.add(equals_label)
     panel.add(self.right_field)
     panel.add(help_label)
     # Set up constraints to tell panel how to position components.
     layout.putConstraint(SpringLayout.WEST, ampersand_label, 20,
                          SpringLayout.WEST, panel)
     layout.putConstraint(SpringLayout.NORTH, ampersand_label, 23,
                          SpringLayout.NORTH, panel)
     layout.putConstraint(SpringLayout.WEST, self.left_field, 90,
                          SpringLayout.WEST, panel)
     layout.putConstraint(SpringLayout.NORTH, self.left_field, 20,
                          SpringLayout.NORTH, panel)
     layout.putConstraint(SpringLayout.WEST, equals_label, 5,
                          SpringLayout.EAST, self.left_field)
     layout.putConstraint(SpringLayout.NORTH, equals_label, 23,
                          SpringLayout.NORTH, panel)
     layout.putConstraint(SpringLayout.WEST, self.right_field, 5,
                          SpringLayout.EAST, equals_label)
     layout.putConstraint(SpringLayout.NORTH, self.right_field, 20,
                          SpringLayout.NORTH, panel)
     layout.putConstraint(SpringLayout.WEST, help_label, 5,
                          SpringLayout.EAST, self.right_field)
     layout.putConstraint(SpringLayout.NORTH, help_label, 23,
                          SpringLayout.NORTH, panel)
     layout.putConstraint(SpringLayout.EAST, panel, 15, SpringLayout.EAST,
                          help_label)
     layout.putConstraint(SpringLayout.SOUTH, panel, 10, SpringLayout.SOUTH,
                          help_label)
     # Add this to NewAtf JFrame
     return panel
예제 #23
0
def install(helper):
    print('install called')

    frame = JFrame("Please Input Values")
    frame.setLocation(100, 100)
    frame.setSize(500, 400)
    frame.setLayout(None)

    lbl1 = JLabel("Input1: ")
    lbl1.setBounds(60, 20, 60, 20)
    txt1 = JTextField(100)
    txt1.setBounds(130, 20, 200, 20)
    lbl2 = JLabel("Input2: ")
    lbl2.setBounds(60, 50, 100, 20)
    txt2 = JTextField(100)
    txt2.setBounds(130, 50, 200, 20)
    lbl3 = JLabel("Input3: ")
    lbl3.setBounds(60, 80, 140, 20)
    txt3 = JTextField(100)
    txt3.setBounds(130, 80, 200, 20)
    lbl4 = JLabel("Input4: ")
    lbl4.setBounds(60, 110, 180, 20)
    txt4 = JTextField(100)
    txt4.setBounds(130, 110, 200, 20)

    def getValues(event):
        print "clicked"
        ScriptVars.setGlobalVar("Input1", str(txt1.getText()))
        print(ScriptVars.getGlobalVar("Input1"))
        ScriptVars.setGlobalVar("Input2", str(txt2.getText()))
        print(ScriptVars.getGlobalVar("Input2"))
        ScriptVars.setGlobalVar("Input3", str(txt3.getText()))
        print(ScriptVars.getGlobalVar("Input3"))
        ScriptVars.setGlobalVar("Input4", str(txt4.getText()))
        print(ScriptVars.getGlobalVar("Input4"))

    btn = JButton("Submit", actionPerformed=getValues)
    btn.setBounds(160, 150, 100, 20)

    frame.add(lbl1)
    frame.add(txt1)
    frame.add(lbl2)
    frame.add(txt2)
    frame.add(btn)
    frame.add(lbl3)
    frame.add(txt3)
    frame.add(lbl4)
    frame.add(txt4)
    frame.setVisible(True)
예제 #24
0
def tree():
  """
  tree(xmlfile="dsm2.xml")
    creates a tree view on a given xml file of dsm2 input data
  """
  tv = TreeViewer()
  mp2 = JPanel()
  mp2.setLayout(BorderLayout())
  tf = JTextField("dsm2.inp")
  pb = JButton("parse")
  mp2.add(tf,BorderLayout.CENTER)
  mp2.add(pb,BorderLayout.EAST)
  class ParseListener(ActionListener):
    def __init__(self,tf,tv,fr):
      self.tf = tf
      self.tv = tv
      self.fr = fr
    def actionPerformed(self,evt):
      dsm2file = self.tf.getText()
      parser = DSM2Parser(dsm2file)
      self.tv.xdoc = parser.dsm2_data.toXml()
      self.fr.getContentPane().add(self.tv.gui(),BorderLayout.CENTER)
      self.fr.pack()
      self.fr.setVisible(1)
  fr = JFrame()
  fr.setTitle("DSM2Tree")
  fr.setLocation(100,100)
  fr.setSize(600,60)
  fr.getContentPane().setLayout(BorderLayout())
  fr.getContentPane().add(mp2,BorderLayout.NORTH)
  al = ParseListener(tf,tv,fr)
  pb.addActionListener(al)
  fr.pack()
  fr.setVisible(1)
예제 #25
0
def move_script_warning():
    """Warn the user to move qat_script directory into Scripting Plugin
       directory
    """
    scriptingPluginDir = PluginHandler.getPlugin("scripting").getPluginDir()
    pane = JPanel(GridLayout(3, 1, 5, 5))
    warningTitle = "Warning: qat_script directory not found"
    pane.add(
        JLabel(
            "Please, move qat_script directory to the following location and start the script again:\n"
        ))
    defaultPathTextField = JTextField(scriptingPluginDir,
                                      editable=0,
                                      border=None,
                                      background=None)
    pane.add(defaultPathTextField)

    if not Desktop.isDesktopSupported():
        JOptionPane.showMessageDialog(Main.parent, pane, warningTitle,
                                      JOptionPane.WARNING_MESSAGE)
    else:
        #add a button to open default path with the files manager
        pane.add(JLabel("Do you want to open this folder?"))
        options = ["No", "Yes"]
        answer = JOptionPane.showOptionDialog(Main.parent, pane, warningTitle,
                                              JOptionPane.YES_NO_OPTION,
                                              JOptionPane.QUESTION_MESSAGE,
                                              None, options, options[1])
        if answer == 1:
            Desktop.getDesktop().open(File(scriptingPluginDir))
예제 #26
0
    def initPanelConfig(self):
        self._jPanel.setBounds(0, 0, 1000, 1000)
        self._jPanel.setLayout(GridBagLayout())

        self._jAboutPanel.setBounds(0, 0, 1000, 1000)
        self._jAboutPanel.setLayout(GridBagLayout())

        self._jLabelAdditionalCmdLine = JLabel("set url:")
        self._jPanelConstraints.fill = GridBagConstraints.HORIZONTAL
        self._jPanelConstraints.gridx = 0
        self._jPanelConstraints.gridy = 0
        self._jPanel.add(self._jLabelAdditionalCmdLine, self._jPanelConstraints)

        self._jTextFieldParameters = JTextField("",20)
        self._jPanelConstraints.fill = GridBagConstraints.HORIZONTAL
        self._jPanelConstraints.gridx = 1
        self._jPanelConstraints.gridy = 0
        self._jPanel.add(self._jTextFieldParameters, self._jPanelConstraints)

        self._jButtonSetCommandLine = JButton('go to test', actionPerformed=self.createNewInstance)
        self._jPanelConstraints.fill = GridBagConstraints.HORIZONTAL
        self._jPanelConstraints.gridx = 0
        self._jPanelConstraints.gridy = 5
        self._jPanelConstraints.gridwidth = 2
        self._jPanel.add(self._jButtonSetCommandLine, self._jPanelConstraints)

        self._jLabelAbout = JLabel("<html><body>%s</body></html>" % self.aboutText)
        self._jPanelConstraints.fill = GridBagConstraints.HORIZONTAL
        self._jPanelConstraints.gridx = 0
        self._jPanelConstraints.gridy = 0
        self._jAboutPanel.add(self._jLabelAbout, self._jPanelConstraints)
예제 #27
0
    def run(self):
        frame = JFrame('List6',
                       size=(200, 220),
                       layout=GridLayout(1, 2),
                       defaultCloseOperation=JFrame.EXIT_ON_CLOSE)

        panel = JPanel(layout=GridLayout(0, 1))
        self.buttons = {}
        for name in 'First,Last,Before,After,Remove'.split(','):
            self.buttons[name] = panel.add(self.button(name))

        self.text = panel.add(JTextField(10))
        self.addInputMethodListener(self)
        #       self.addTextListener( self )
        frame.add(panel)

        data = ('Now is the time for all good spam ' +
                'to come to the aid of their eggs').split(' ')
        model = DefaultListModel()
        for word in data:
            model.addElement(word)
        self.info = JList(model,
                          valueChanged=self.selection,
                          selectionMode=ListSelectionModel.SINGLE_SELECTION)
        frame.add(JScrollPane(self.info, preferredSize=(200, 100)))
        frame.setVisible(1)
예제 #28
0
    def __init__(self, program):
        self.setLayout(GridBagLayout())
        self.setBorder(make_title_border("User-Agent", padding=5))
        btn = JButton("Add to settings")
        ua_text = JTextField(program.user_agent)
        self.add(
            ua_text, make_constraints(weightx=4, fill=GridBagConstraints.HORIZONTAL)
        )
        self.add(btn, make_constraints(weightx=1))
        self.setMaximumSize(Dimension(9999999, self.getPreferredSize().height + 10))

        def add_to_options(event):
            prefix = "Generated by YWH-addon"
            config = json.loads(
                context.callbacks.saveConfigAsJson("proxy.match_replace_rules")
            )

            # remove other YWH addon rules
            match_replace_rules = filter(
                lambda rule: not rule["comment"].startswith(prefix),
                config["proxy"]["match_replace_rules"],
            )
            new_rule = {
                "is_simple_match": False,
                "enabled": True,
                "rule_type": "request_header",
                "string_match": "^User-Agent: (.*)$",
                "string_replace": "User-Agent: $1 {}".format(program.user_agent),
                "comment": "{} for {}".format(prefix, program.slug),
            }
            match_replace_rules.append(new_rule)
            config["proxy"]["match_replace_rules"] = match_replace_rules
            context.callbacks.loadConfigFromJson(json.dumps(config))

        btn.addActionListener(CallbackActionListener(add_to_options))
예제 #29
0
    def __init__(self, plugin):
        super(EmulatorComponentProvider,
              self).__init__(plugin.getTool(), "Emulator", "emulate_function")
        self.plugin = plugin

        self.panel = JPanel(GridBagLayout())
        c = GridBagConstraints()
        c.fill = GridBagConstraints.HORIZONTAL
        c.gridy = 0

        c.gridx = 0
        c.weightx = 0.8
        self.panel_label = JLabel("")
        self.panel.add(self.panel_label, c)

        c.gridx = 1
        c.weightx = 0.2
        self.panel_btn = JButton("Start")
        self.panel_btn.addActionListener(EmulatorBtnAction(self))
        self.panel.add(self.panel_btn, c)

        c.gridy = 1
        c.gridx = 0
        c.gridwidth = 2
        self.panel_input = JTextField()
        self.panel_input.addActionListener(EmulatorInputAction(self))
        self.panel.add(self.panel_input, c)

        self.setStatus("Stopped")
예제 #30
0
파일: mpconfig.py 프로젝트: DMDhariya/core
    def __init__(self, tree):
        TreeCellEditor.__init__(self)
        self.editor = None
        self.tree = tree

        flowLayout = FlowLayout(FlowLayout.LEFT, 0, 0)

        self.cbPanel = JPanel(flowLayout)
        self.cb = JCheckBox(actionPerformed=self.checked)
        self.cbPanel.add(self.cb)
        self.cbLabel = JLabel()
        self.cbPanel.add(self.cbLabel)

        self.tcbPanel = JPanel(flowLayout)
        self.tcb = TristateCheckBox(self.checked)
        self.tcbPanel.add(self.tcb)
        self.tcbLabel = JLabel()
        self.tcbPanel.add(self.tcbLabel)

        self.rbPanel = JPanel(flowLayout)
        self.rb = JRadioButton(actionPerformed=self.checked)
        self.rbPanel.add(self.rb)
        self.rbLabel = JLabel()
        self.rbPanel.add(self.rbLabel)

        self.tfPanel = JPanel(flowLayout)
        self.tfLabel = JLabel()
        self.tfPanel.add(self.tfLabel)
        self.tf = JTextField()
        self.tf.setColumns(12)
        self.tf.addActionListener(self)
        self.tfPanel.add(self.tf)